run_fvt_tests.yaml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. name: Functional Verification Tests
  2. on:
  3. push:
  4. tags:
  5. - v*
  6. release:
  7. types:
  8. - published
  9. pull_request:
  10. jobs:
  11. docker_test:
  12. runs-on: ubuntu-20.04
  13. steps:
  14. - uses: actions/checkout@v1
  15. - name: prepare
  16. run: |
  17. if make emqx-ee --dry-run > /dev/null 2>&1; then
  18. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  19. git config --global credential.helper store
  20. echo "${{ secrets.CI_GIT_TOKEN }}" >> scripts/git-token
  21. make deps-emqx-ee
  22. echo "TARGET=emqx/emqx-ee" >> $GITHUB_ENV
  23. else
  24. echo "TARGET=emqx/emqx" >> $GITHUB_ENV
  25. fi
  26. - name: make emqx image
  27. run: make docker
  28. - name: run emqx
  29. timeout-minutes: 5
  30. run: |
  31. set -e -u -x
  32. docker-compose -f .ci/fvt_tests/docker-compose.yaml up -d
  33. while [ "$(docker inspect -f '{{ .State.Health.Status}}' node1.emqx.io)" != "healthy" ] || [ "$(docker inspect -f '{{ .State.Health.Status}}' node2.emqx.io)" != "healthy" ]; do
  34. if [ $(docker ps -a -f name=fvt_tests_emqx -f status=exited -q | wc -l) -ne 0 ]; then
  35. echo "['$(date -u +"%Y-%m-%dT%H:%M:%SZ")']:emqx stop";
  36. exit;
  37. else
  38. echo "['$(date -u +"%Y-%m-%dT%H:%M:%SZ")']:waiting emqx";
  39. sleep 5;
  40. fi;
  41. done
  42. - name: make paho tests
  43. run: |
  44. docker exec -i paho_client sh -c "apk update && apk add git curl \
  45. && git clone -b develop-4.0 https://github.com/emqx/paho.mqtt.testing.git /paho.mqtt.testing \
  46. && pip install pytest \
  47. && pytest -v /paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host node1.emqx.io \
  48. && pytest -v /paho.mqtt.testing/interoperability/test_cluster --host1 node1.emqx.io --host2 node2.emqx.io \
  49. && pytest -v /paho.mqtt.testing/interoperability/test_client --host node1.emqx.io"
  50. helm_test:
  51. runs-on: ubuntu-20.04
  52. steps:
  53. - uses: actions/checkout@v1
  54. - name: prepare
  55. run: |
  56. if make emqx-ee --dry-run > /dev/null 2>&1; then
  57. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  58. git config --global credential.helper store
  59. echo "${{ secrets.CI_GIT_TOKEN }}" >> scripts/git-token
  60. make deps-emqx-ee
  61. echo "TARGET=emqx/emqx-ee" >> $GITHUB_ENV
  62. else
  63. echo "TARGET=emqx/emqx" >> $GITHUB_ENV
  64. fi
  65. - name: make emqx image
  66. run: make docker
  67. - name: install k3s
  68. env:
  69. KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
  70. run: |
  71. sudo sh -c "echo \"127.0.0.1 $(hostname)\" >> /etc/hosts"
  72. curl -sfL https://get.k3s.io | sh -
  73. sudo chmod 644 /etc/rancher/k3s/k3s.yaml
  74. kubectl cluster-info
  75. - name: install helm
  76. env:
  77. KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
  78. run: |
  79. curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
  80. sudo chmod 700 get_helm.sh
  81. sudo ./get_helm.sh
  82. helm version
  83. - name: run emqx on chart
  84. env:
  85. KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
  86. timeout-minutes: 5
  87. run: |
  88. version=$(./pkg-vsn.sh)
  89. sudo docker save ${TARGET}:$version -o emqx.tar.gz
  90. sudo k3s ctr image import emqx.tar.gz
  91. sed -i -r "s/^appVersion: .*$/appVersion: \"${version}\"/g" deploy/charts/emqx/Chart.yaml
  92. sed -i '/emqx_telemetry/d' deploy/charts/emqx/values.yaml
  93. helm install emqx \
  94. --set image.repository=${TARGET} \
  95. --set image.pullPolicy=Never \
  96. --set emqxAclConfig="" \
  97. --set image.pullPolicy=Never \
  98. --set emqxConfig.EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s \
  99. --set emqxConfig.EMQX_MQTT__MAX_TOPIC_ALIAS=10 \
  100. deploy/charts/emqx \
  101. --debug
  102. while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
  103. != "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
  104. echo "==============================";
  105. kubectl get pods;
  106. echo "==============================";
  107. echo "waiting emqx started";
  108. sleep 10;
  109. done
  110. - name: get pods log
  111. if: failure()
  112. env:
  113. KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
  114. run: kubectl describe pods emqx-0
  115. - uses: actions/checkout@v2
  116. with:
  117. repository: emqx/paho.mqtt.testing
  118. ref: develop-4.0
  119. path: paho.mqtt.testing
  120. - name: install pytest
  121. run: |
  122. pip install pytest
  123. echo "$HOME/.local/bin" >> $GITHUB_PATH
  124. - name: run paho test
  125. env:
  126. KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
  127. run: |
  128. emqx_svc=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
  129. emqx1=$(kubectl get pods emqx-1 -o jsonpath='{.status.podIP}')
  130. emqx2=$(kubectl get pods emqx-2 -o jsonpath='{.status.podIP}')
  131. pytest -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host $emqx_svc
  132. pytest -v paho.mqtt.testing/interoperability/test_cluster --host1 $emqx1 --host2 $emqx2
  133. relup_test:
  134. runs-on: ubuntu-20.04
  135. container: emqx/build-env:erl23.2.7-ubuntu20.04
  136. defaults:
  137. run:
  138. shell: bash
  139. steps:
  140. - uses: actions/setup-python@v2
  141. with:
  142. python-version: '3.8'
  143. architecture: 'x64'
  144. - uses: actions/checkout@v2
  145. with:
  146. repository: emqx/paho.mqtt.testing
  147. ref: develop-4.0
  148. path: paho.mqtt.testing
  149. - uses: actions/checkout@v2
  150. with:
  151. repository: terry-xiaoyu/one_more_emqx
  152. ref: master
  153. path: one_more_emqx
  154. - uses: actions/checkout@v2
  155. with:
  156. repository: emqx/emqtt-bench
  157. ref: master
  158. path: emqtt-bench
  159. - uses: actions/checkout@v2
  160. with:
  161. repository: hawk/lux
  162. ref: lux-2.4
  163. path: lux
  164. - uses: actions/checkout@v2
  165. with:
  166. repository: ${{ github.repository }}
  167. path: emqx
  168. fetch-depth: 0
  169. - name: prepare
  170. run: |
  171. if make -C emqx emqx-ee --dry-run > /dev/null 2>&1; then
  172. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  173. git config --global credential.helper store
  174. echo "${{ secrets.CI_GIT_TOKEN }}" >> emqx/scripts/git-token
  175. echo "PROFILE=emqx-ee" >> $GITHUB_ENV
  176. else
  177. echo "PROFILE=emqx" >> $GITHUB_ENV
  178. fi
  179. - name: get version
  180. run: |
  181. set -e -x -u
  182. cd emqx
  183. if [ $PROFILE = "emqx" ];then
  184. broker="emqx-ce"
  185. edition='opensource'
  186. else
  187. broker="emqx-ee"
  188. edition='enterprise'
  189. fi
  190. vsn="$(grep -E "define.+EMQX_RELEASE.+${edition}" include/emqx_release.hrl | cut -d '"' -f2)"
  191. echo "VSN=$vsn" >> $GITHUB_ENV
  192. pre_vsn="$(echo $vsn | grep -oE '^[0-9]+.[0-9]')"
  193. if [ $PROFILE = "emqx" ]; then
  194. old_vsns="$(git tag -l "v$pre_vsn.[0-9]" | tr "\n" " " | sed "s/v$vsn//")"
  195. else
  196. old_vsns="$(git tag -l "e$pre_vsn.[0-9]" | tr "\n" " " | sed "s/v$vsn//")"
  197. fi
  198. echo "OLD_VSNS=$old_vsns" >> $GITHUB_ENV
  199. - name: download emqx
  200. run: |
  201. set -e -x -u
  202. cd emqx
  203. old_vsns=($(echo $OLD_VSNS | tr ' ' ' '))
  204. for old_vsn in ${old_vsns[@]}; do
  205. wget https://s3-${{ secrets.AWS_DEFAULT_REGION }}.amazonaws.com/${{ secrets.AWS_S3_BUCKET }}/$broker/$old_vsn/$PROFILE-ubuntu20.04-${old_vsn#[e|v]}-x86_64.zip
  206. done
  207. - name: build emqx
  208. run: make -C emqx ${PROFILE}-zip
  209. - name: build emqtt-bench
  210. run: make -C emqtt-bench
  211. - name: build lux
  212. run: |
  213. set -e -u -x
  214. cd lux
  215. autoconf
  216. ./configure
  217. make
  218. make install
  219. - name: run relup test
  220. run: |
  221. set -e -x -u
  222. if [ -n "$OLD_VSNS" ]; then
  223. mkdir -p packages
  224. cp emqx/_packages/emqx/*.zip packages
  225. cp emqx/*.zip packages
  226. lux -v \
  227. --timeout 600000 \
  228. --var PACKAGE_PATH=$(pwd)/packages \
  229. --var BENCH_PATH=$(pwd)/emqtt-bench \
  230. --var ONE_MORE_EMQX_PATH=$(pwd)/one_more_emqx \
  231. --var VSN="$VSN" \
  232. --var OLD_VSNS="$OLD_VSNS" \
  233. emqx/.ci/fvt_tests/relup.lux
  234. fi
  235. - uses: actions/upload-artifact@v1
  236. if: failure()
  237. with:
  238. name: lux_logs
  239. path: lux_logs