run_fvt_tests.yaml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. name: Functional Verification Tests
  2. concurrency:
  3. group: fvt-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. push:
  7. tags:
  8. - v*
  9. - e*
  10. pull_request:
  11. jobs:
  12. prepare:
  13. strategy:
  14. matrix:
  15. otp:
  16. - "23.2.7.2-emqx-2"
  17. - "24.1.1-emqx-1"
  18. runs-on: ubuntu-20.04
  19. container: "ghcr.io/emqx/emqx-builder/5.0:${{ matrix.otp }}-ubuntu20.04"
  20. outputs:
  21. profile: ${{ steps.profile.outputs.profile }}
  22. steps:
  23. - name: get otp version
  24. id: get_otp_version
  25. run: |
  26. otp="$(erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell)"
  27. echo "::set-output name=otp::$otp"
  28. - uses: actions/checkout@v2
  29. with:
  30. path: source
  31. fetch-depth: 0
  32. - name: set profile
  33. id: profile
  34. shell: bash
  35. working-directory: source
  36. run: |
  37. vsn="$(./pkg-vsn.sh)"
  38. if make emqx-ee --dry-run > /dev/null 2>&1; then
  39. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  40. git config --global credential.helper store
  41. echo "::set-output name=profile::emqx-ee"
  42. else
  43. echo "::set-output name=profile::emqx"
  44. fi
  45. - name: get deps
  46. working-directory: source
  47. run: |
  48. make ensure-rebar3
  49. ./rebar3 as default get-deps
  50. rm -rf rebar.lock
  51. - name: gen zip file
  52. run: zip -ryq source-${{ steps.get_otp_version.outputs.otp }}.zip source/* source/.[^.]*
  53. - uses: actions/upload-artifact@v2
  54. with:
  55. name: source-${{ steps.get_otp_version.outputs.otp }}
  56. path: source-${{ steps.get_otp_version.outputs.otp }}.zip
  57. docker_test:
  58. runs-on: ubuntu-20.04
  59. needs: prepare
  60. strategy:
  61. fail-fast: false
  62. matrix:
  63. otp:
  64. - 23.2.7.2-emqx-2
  65. - 24.1.1-emqx-1
  66. cluster_db_backend:
  67. - "mnesia"
  68. - "rlog"
  69. steps:
  70. - uses: actions/download-artifact@v2
  71. with:
  72. name: source-${{ matrix.otp }}
  73. path: .
  74. - name: unzip source code
  75. run: unzip -q source-${{ matrix.otp }}.zip
  76. - name: make docker image
  77. working-directory: source
  78. env:
  79. OTP: ${{ matrix.otp }}
  80. run: |
  81. make ${{ needs.prepare.outputs.profile }}-docker
  82. echo "TARGET=emqx/${{ needs.prepare.outputs.profile }}" >> $GITHUB_ENV
  83. echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
  84. - name: run emqx
  85. timeout-minutes: 5
  86. working-directory: source
  87. run: |
  88. set -x
  89. export EMQX_TEST_DB_BACKEND="${{ matrix.cluster_db_backend }}"
  90. ./.ci/docker-compose-file/scripts/run-emqx.sh
  91. - name: make paho tests
  92. run: |
  93. if ! docker exec -i python /scripts/pytest.sh; then
  94. echo "DUMP_CONTAINER_LOGS_BGN"
  95. docker logs haproxy
  96. docker logs node1.emqx.io
  97. docker logs node2.emqx.io
  98. echo "DUMP_CONTAINER_LOGS_END"
  99. exit 1
  100. fi
  101. helm_test:
  102. runs-on: ubuntu-20.04
  103. needs: prepare
  104. strategy:
  105. fail-fast: false
  106. matrix:
  107. otp:
  108. - 23.2.7.2-emqx-2
  109. - 24.1.1-emqx-1
  110. steps:
  111. - uses: actions/download-artifact@v2
  112. with:
  113. name: source-${{ matrix.otp }}
  114. path: .
  115. - name: unzip source code
  116. run: unzip -q source-${{ matrix.otp }}.zip
  117. - name: make docker image
  118. working-directory: source
  119. env:
  120. OTP: ${{ matrix.otp }}
  121. run: |
  122. make ${{ needs.prepare.outputs.profile }}-docker
  123. echo "TARGET=emqx/${{ needs.prepare.outputs.profile }}" >> $GITHUB_ENV
  124. echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
  125. - run: minikube start
  126. - name: run emqx on chart
  127. timeout-minutes: 5
  128. working-directory: source
  129. run: |
  130. minikube image load $TARGET:$EMQX_TAG
  131. sed -i -r "s/^appVersion: .*$/appVersion: \"$EMQX_TAG\"/g" deploy/charts/emqx/Chart.yaml
  132. helm install emqx \
  133. --set image.repository=$TARGET \
  134. --set image.pullPolicy=Never \
  135. --set emqxAclConfig="" \
  136. --set image.pullPolicy=Never \
  137. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__RETRY_INTERVAL=2s \
  138. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__MAX_TOPIC_ALIAS=10 \
  139. deploy/charts/emqx \
  140. --debug
  141. while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
  142. != "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
  143. echo "==============================";
  144. kubectl get pods;
  145. echo "==============================";
  146. echo "waiting emqx started";
  147. sleep 10;
  148. done
  149. - name: get emqx-0 pods log
  150. if: failure()
  151. run: |
  152. kubectl describe pods emqx-0
  153. kubectl logs emqx-0
  154. - name: get emqx-1 pods log
  155. if: failure()
  156. run: |
  157. kubectl describe pods emqx-1
  158. kubectl logs emqx-1
  159. - name: get emqx-2 pods log
  160. if: failure()
  161. run: |
  162. kubectl describe pods emqx-2
  163. kubectl logs emqx-2
  164. - uses: actions/checkout@v2
  165. with:
  166. repository: emqx/paho.mqtt.testing
  167. ref: develop-4.0
  168. path: paho.mqtt.testing
  169. - name: install pytest
  170. run: |
  171. pip install pytest
  172. echo "$HOME/.local/bin" >> $GITHUB_PATH
  173. - name: run paho test
  174. run: |
  175. kubectl port-forward service/emqx 1883:1883 > /dev/null &
  176. pytest -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host "127.0.0.1"