run_fvt_tests.yaml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 "${{ matrix.cluster_db_backend }}"; then
  94. echo "DUMP_CONTAINER_LOGS_BGN"
  95. echo "============== haproxy =============="
  96. docker logs haproxy
  97. echo "============== node1 =============="
  98. docker logs node1.emqx.io
  99. echo "============== node2 =============="
  100. docker logs node2.emqx.io
  101. echo "DUMP_CONTAINER_LOGS_END"
  102. exit 1
  103. fi
  104. helm_test:
  105. runs-on: ubuntu-20.04
  106. needs: prepare
  107. strategy:
  108. fail-fast: false
  109. matrix:
  110. otp:
  111. - 23.2.7.2-emqx-2
  112. - 24.1.1-emqx-1
  113. steps:
  114. - uses: actions/download-artifact@v2
  115. with:
  116. name: source-${{ matrix.otp }}
  117. path: .
  118. - name: unzip source code
  119. run: unzip -q source-${{ matrix.otp }}.zip
  120. - name: make docker image
  121. working-directory: source
  122. env:
  123. OTP: ${{ matrix.otp }}
  124. run: |
  125. make ${{ needs.prepare.outputs.profile }}-docker
  126. echo "TARGET=emqx/${{ needs.prepare.outputs.profile }}" >> $GITHUB_ENV
  127. echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
  128. - run: minikube start
  129. - name: run emqx on chart
  130. timeout-minutes: 5
  131. working-directory: source
  132. run: |
  133. minikube image load $TARGET:$EMQX_TAG
  134. sed -i -r "s/^appVersion: .*$/appVersion: \"$EMQX_TAG\"/g" deploy/charts/emqx/Chart.yaml
  135. helm install emqx \
  136. --set image.repository=$TARGET \
  137. --set image.pullPolicy=Never \
  138. --set emqxAclConfig="" \
  139. --set image.pullPolicy=Never \
  140. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__RETRY_INTERVAL=2s \
  141. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__MAX_TOPIC_ALIAS=10 \
  142. deploy/charts/emqx \
  143. --debug
  144. while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
  145. != "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
  146. echo "==============================";
  147. kubectl get pods;
  148. echo "==============================";
  149. echo "waiting emqx started";
  150. sleep 10;
  151. done
  152. - name: get emqx-0 pods log
  153. if: failure()
  154. run: |
  155. kubectl describe pods emqx-0
  156. kubectl logs emqx-0
  157. - name: get emqx-1 pods log
  158. if: failure()
  159. run: |
  160. kubectl describe pods emqx-1
  161. kubectl logs emqx-1
  162. - name: get emqx-2 pods log
  163. if: failure()
  164. run: |
  165. kubectl describe pods emqx-2
  166. kubectl logs emqx-2
  167. - uses: actions/checkout@v2
  168. with:
  169. repository: emqx/paho.mqtt.testing
  170. ref: develop-4.0
  171. path: paho.mqtt.testing
  172. - name: install pytest
  173. run: |
  174. pip install pytest
  175. echo "$HOME/.local/bin" >> $GITHUB_PATH
  176. - name: run paho test
  177. run: |
  178. kubectl port-forward service/emqx 1883:1883 > /dev/null &
  179. pytest -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host "127.0.0.1"