run_fvt_tests.yaml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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_client --host $emqx_svc
  133. pytest -v paho.mqtt.testing/interoperability/test_cluster --host1 $emqx1 --host2 $emqx2
  134. relup_test:
  135. runs-on: ubuntu-20.04
  136. container: emqx/build-env:erl23.2.7-ubuntu20.04
  137. defaults:
  138. run:
  139. shell: bash
  140. steps:
  141. - uses: actions/setup-python@v2
  142. with:
  143. python-version: '3.8'
  144. architecture: 'x64'
  145. - uses: actions/checkout@v2
  146. with:
  147. repository: emqx/paho.mqtt.testing
  148. ref: develop-4.0
  149. path: paho.mqtt.testing
  150. - uses: actions/checkout@v2
  151. with:
  152. repository: terry-xiaoyu/one_more_emqx
  153. ref: master
  154. path: one_more_emqx
  155. - uses: actions/checkout@v2
  156. with:
  157. repository: emqx/emqtt-bench
  158. ref: master
  159. path: emqtt-bench
  160. - uses: actions/checkout@v2
  161. with:
  162. repository: hawk/lux
  163. ref: lux-2.4
  164. path: lux
  165. - uses: actions/checkout@v2
  166. with:
  167. repository: ${{ github.repository }}
  168. path: emqx
  169. fetch-depth: 0
  170. - name: prepare
  171. run: |
  172. if make -C emqx emqx-ee --dry-run > /dev/null 2>&1; then
  173. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  174. git config --global credential.helper store
  175. echo "${{ secrets.CI_GIT_TOKEN }}" >> emqx/scripts/git-token
  176. echo "PROFILE=emqx-ee" >> $GITHUB_ENV
  177. else
  178. echo "PROFILE=emqx" >> $GITHUB_ENV
  179. fi
  180. - name: get version
  181. run: |
  182. set -e -x -u
  183. cd emqx
  184. if [ $PROFILE = "emqx" ];then
  185. broker="emqx-ce"
  186. edition='opensource'
  187. else
  188. broker="emqx-ee"
  189. edition='enterprise'
  190. fi
  191. vsn="$(grep -E "define.+EMQX_RELEASE.+${edition}" include/emqx_release.hrl | cut -d '"' -f2)"
  192. echo "VSN=$vsn" >> $GITHUB_ENV
  193. pre_vsn="$(echo $vsn | grep -oE '^[0-9]+.[0-9]')"
  194. if [ $PROFILE = "emqx" ]; then
  195. old_vsns="$(git tag -l "v$pre_vsn.[0-9]" | tr "\n" " " | sed "s/v$vsn//")"
  196. else
  197. old_vsns="$(git tag -l "e$pre_vsn.[0-9]" | tr "\n" " " | sed "s/v$vsn//")"
  198. fi
  199. echo "OLD_VSNS=$old_vsns" >> $GITHUB_ENV
  200. - name: download emqx
  201. run: |
  202. set -e -x -u
  203. cd emqx
  204. old_vsns=($(echo $OLD_VSNS | tr ' ' ' '))
  205. for old_vsn in ${old_vsns[@]}; do
  206. 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
  207. done
  208. - name: build emqx
  209. run: make -C emqx ${PROFILE}-zip
  210. - name: build emqtt-bench
  211. run: make -C emqtt-bench
  212. - name: build lux
  213. run: |
  214. set -e -u -x
  215. cd lux
  216. autoconf
  217. ./configure
  218. make
  219. make install
  220. - name: run relup test
  221. run: |
  222. set -e -x -u
  223. if [ -n "$OLD_VSNS" ]; then
  224. mkdir -p packages
  225. cp emqx/_packages/emqx/*.zip packages
  226. cp emqx/*.zip packages
  227. lux -v \
  228. --timeout 600000 \
  229. --var PACKAGE_PATH=$(pwd)/packages \
  230. --var BENCH_PATH=$(pwd)/emqtt-bench \
  231. --var ONE_MORE_EMQX_PATH=$(pwd)/one_more_emqx \
  232. --var VSN="$VSN" \
  233. --var OLD_VSNS="$OLD_VSNS" \
  234. emqx/.ci/fvt_tests/relup.lux
  235. fi
  236. - uses: actions/upload-artifact@v1
  237. if: failure()
  238. with:
  239. name: lux_logs
  240. path: lux_logs