run_test_cases.yaml 8.7 KB

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