run_test_cases.yaml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. name: Run test case
  2. concurrency:
  3. group: test-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. push:
  7. branches:
  8. - '**'
  9. tags:
  10. - v*
  11. - e*
  12. pull_request:
  13. jobs:
  14. prepare:
  15. runs-on: aws-amd64
  16. strategy:
  17. fail-fast: false
  18. matrix:
  19. profile:
  20. - emqx
  21. - emqx-enterprise
  22. builder:
  23. - 5.0-26
  24. otp:
  25. - 24.3.4.2-1
  26. - 25.1.2-2
  27. elixir:
  28. - 1.13.4
  29. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu20.04"
  30. outputs:
  31. fast_ct_apps: ${{ steps.find_ct_apps.outputs.fast_ct_apps }}
  32. docker_ct_apps: ${{ steps.find_ct_apps.outputs.docker_ct_apps }}
  33. steps:
  34. - uses: AutoModality/action-clean@v1
  35. - uses: actions/checkout@v3
  36. with:
  37. path: source
  38. - name: Find CT Apps
  39. working-directory: source
  40. id: find_ct_apps
  41. run: |
  42. fast_ct_apps="$(./scripts/find-apps.sh --ci fast)"
  43. docker_ct_apps="$(./scripts/find-apps.sh --ci docker)"
  44. echo "fast_ct_apps=$fast_ct_apps" | tee -a $GITHUB_OUTPUT
  45. echo "docker_ct_apps=$docker_ct_apps" | tee -a $GITHUB_OUTPUT
  46. - name: get_all_deps
  47. working-directory: source
  48. env:
  49. PROFILE: ${{ matrix.profile }}
  50. #DIAGNOSTIC: 1
  51. run: |
  52. make ensure-rebar3
  53. # fetch all deps and compile
  54. make ${{ matrix.profile }}
  55. make test-compile
  56. cd ..
  57. zip -ryq source.zip source/* source/.[^.]*
  58. - uses: actions/upload-artifact@v3
  59. with:
  60. name: source-${{ matrix.profile }}-${{ matrix.otp }}
  61. path: source.zip
  62. eunit_and_proper:
  63. needs: [prepare]
  64. runs-on: ${{ matrix.runs-on }}
  65. strategy:
  66. fail-fast: false
  67. matrix:
  68. profile:
  69. - emqx
  70. - emqx-enterprise
  71. builder:
  72. - 5.0-26
  73. otp:
  74. - 24.3.4.2-1
  75. - 25.1.2-2
  76. elixir:
  77. - 1.13.4
  78. runs-on:
  79. - aws-amd64
  80. - ubuntu-20.04
  81. use-self-hosted:
  82. - ${{ github.repository_owner == 'emqx' }}
  83. exclude:
  84. - runs-on: ubuntu-20.04
  85. use-self-hosted: true
  86. - runs-on: aws-amd64
  87. use-self-hosted: false
  88. defaults:
  89. run:
  90. shell: bash
  91. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu20.04"
  92. steps:
  93. - uses: AutoModality/action-clean@v1
  94. - uses: actions/download-artifact@v3
  95. with:
  96. name: source-${{ matrix.profile }}-${{ matrix.otp }}
  97. path: .
  98. - name: unzip source code
  99. run: unzip -o -q source.zip
  100. # produces eunit.coverdata
  101. - name: eunit
  102. env:
  103. PROFILE: ${{ matrix.profile }}
  104. working-directory: source
  105. run: make eunit
  106. # produces proper.coverdata
  107. - name: proper
  108. env:
  109. PROFILE: ${{ matrix.profile }}
  110. working-directory: source
  111. run: make proper
  112. - uses: actions/upload-artifact@v3
  113. with:
  114. name: coverdata
  115. path: source/_build/test/cover
  116. ct_docker:
  117. needs: [prepare]
  118. strategy:
  119. fail-fast: false
  120. matrix:
  121. app: ${{ fromJson(needs.prepare.outputs.docker_ct_apps) }}
  122. runs-on:
  123. - aws-amd64
  124. - ubuntu-20.04
  125. use-self-hosted:
  126. - ${{ github.repository_owner == 'emqx' }}
  127. builder:
  128. - 5.0-26
  129. otp:
  130. - 24.3.4.2-1
  131. - 25.1.2-2
  132. elixir:
  133. - 1.13.4
  134. exclude:
  135. - runs-on: ubuntu-20.04
  136. use-self-hosted: true
  137. - runs-on: aws-amd64
  138. use-self-hosted: false
  139. runs-on: ${{ matrix.runs-on }}
  140. defaults:
  141. run:
  142. shell: bash
  143. steps:
  144. - uses: AutoModality/action-clean@v1
  145. - uses: actions/download-artifact@v3
  146. with:
  147. name: source-${{ matrix.app[1] }}-${{ matrix.otp }}
  148. path: .
  149. - name: unzip source code
  150. run: unzip -q source.zip
  151. - name: run tests
  152. working-directory: source
  153. env:
  154. DOCKER_CT_RUNNER_IMAGE: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu20.04"
  155. MONGO_TAG: 5
  156. MYSQL_TAG: 8
  157. PGSQL_TAG: 13
  158. REDIS_TAG: 6
  159. INFLUXDB_TAG: 2.5.0
  160. WHICH_APP: ${{ matrix.app[0] }}
  161. PROFILE: ${{ matrix.app[1] }}
  162. run: |
  163. echo $PROFILE
  164. rm _build/default/lib/rocksdb/_build/cmake/CMakeCache.txt
  165. ./scripts/ct/run.sh --app $WHICH_APP
  166. - uses: actions/upload-artifact@v3
  167. with:
  168. name: coverdata
  169. path: source/_build/test/cover
  170. - uses: actions/upload-artifact@v3
  171. if: failure()
  172. with:
  173. name: logs-${{ matrix.app[1] }}-${{ matrix.app[2] }}
  174. path: source/_build/test/logs
  175. ct:
  176. needs: [prepare]
  177. strategy:
  178. fail-fast: false
  179. matrix:
  180. app: ${{ fromJson(needs.prepare.outputs.fast_ct_apps) }}
  181. builder:
  182. - 5.0-26
  183. otp:
  184. - 24.3.4.2-1
  185. - 25.1.2-2
  186. elixir:
  187. - 1.13.4
  188. runs-on:
  189. - aws-amd64
  190. - ubuntu-20.04
  191. use-self-hosted:
  192. - ${{ github.repository_owner == 'emqx' }}
  193. exclude:
  194. - runs-on: ubuntu-20.04
  195. use-self-hosted: true
  196. - runs-on: aws-amd64
  197. use-self-hosted: false
  198. runs-on: ${{ matrix.runs-on }}
  199. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu20.04"
  200. defaults:
  201. run:
  202. shell: bash
  203. steps:
  204. - uses: AutoModality/action-clean@v1
  205. - uses: actions/download-artifact@v3
  206. with:
  207. name: source-${{ matrix.app[1] }}-${{ matrix.otp }}
  208. path: .
  209. - name: unzip source code
  210. run: unzip -q source.zip
  211. # produces $PROFILE-<app-name>.coverdata
  212. - name: run common test
  213. working-directory: source
  214. env:
  215. WHICH_APP: ${{ matrix.app[0] }}
  216. PROFILE: ${{ matrix.app[1] }}
  217. run: |
  218. make "${WHICH_APP}-ct"
  219. - uses: actions/upload-artifact@v3
  220. with:
  221. name: coverdata
  222. path: source/_build/test/cover
  223. if-no-files-found: warn # do not fail if no coverdata found
  224. - uses: actions/upload-artifact@v3
  225. if: failure()
  226. with:
  227. name: logs-${{ matrix.app[1] }}-${{ matrix.app[2] }}
  228. path: source/_build/test/logs
  229. make_cover:
  230. needs:
  231. - eunit_and_proper
  232. - ct
  233. - ct_docker
  234. runs-on: ubuntu-20.04
  235. container: "ghcr.io/emqx/emqx-builder/5.0-26:1.13.4-24.3.4.2-1-ubuntu20.04"
  236. steps:
  237. - uses: AutoModality/action-clean@v1
  238. - uses: actions/download-artifact@v3
  239. with:
  240. name: source-emqx-enterprise-24.3.4.2-1
  241. path: .
  242. - name: unzip source code
  243. run: unzip -q source.zip
  244. - uses: actions/download-artifact@v3
  245. name: download coverdata
  246. with:
  247. name: coverdata
  248. path: source/_build/test/cover
  249. - name: make cover
  250. working-directory: source
  251. env:
  252. PROFILE: emqx-enterprise
  253. run: make cover
  254. - name: send to coveralls
  255. working-directory: source
  256. env:
  257. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  258. PROFILE: emqx-enterprise
  259. run: make coveralls
  260. - name: get coveralls logs
  261. working-directory: source
  262. if: failure()
  263. run: cat rebar3.crashdump
  264. # do this in a separate job
  265. upload_coverdata:
  266. needs: make_cover
  267. runs-on: ubuntu-20.04
  268. steps:
  269. - name: Coveralls Finished
  270. env:
  271. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  272. run: |
  273. curl -v -k https://coveralls.io/webhook \
  274. --header "Content-Type: application/json" \
  275. --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_ID,\"status\":\"done\"}}" || true