run_test_cases.yaml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  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-24: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-24: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[1] }}-${{ matrix.app[2] }}
  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. runs-on:
  190. - aws-amd64
  191. - ubuntu-20.04
  192. use-self-hosted:
  193. - ${{ github.repository_owner == 'emqx' }}
  194. exclude:
  195. - runs-on: ubuntu-20.04
  196. use-self-hosted: true
  197. - runs-on: aws-amd64
  198. use-self-hosted: false
  199. runs-on: ${{ matrix.runs-on }}
  200. container: "ghcr.io/emqx/emqx-builder/5.0-24:1.13.4-24.3.4.2-1-ubuntu20.04"
  201. defaults:
  202. run:
  203. shell: bash
  204. steps:
  205. - uses: AutoModality/action-clean@v1
  206. - uses: actions/download-artifact@v3
  207. with:
  208. name: source-${{ matrix.app[1] }}
  209. path: .
  210. - name: unzip source code
  211. run: unzip -q source.zip
  212. # produces $PROFILE-<app-name>.coverdata
  213. - name: run common test
  214. working-directory: source
  215. env:
  216. WHICH_APP: ${{ matrix.app[0] }}
  217. PROFILE: ${{ matrix.app[1] }}
  218. run: |
  219. make "${WHICH_APP}-ct"
  220. - uses: actions/upload-artifact@v3
  221. with:
  222. name: coverdata
  223. path: source/_build/test/cover
  224. if-no-files-found: warn # do not fail if no coverdata found
  225. - uses: actions/upload-artifact@v3
  226. if: failure()
  227. with:
  228. name: logs-${{ matrix.app[1] }}-${{ matrix.app[2] }}
  229. path: source/_build/test/logs
  230. make_cover:
  231. needs:
  232. - eunit_and_proper
  233. - ct
  234. - ct_docker
  235. runs-on: ubuntu-20.04
  236. container: "ghcr.io/emqx/emqx-builder/5.0-24:1.13.4-24.3.4.2-1-ubuntu20.04"
  237. steps:
  238. - uses: AutoModality/action-clean@v1
  239. - uses: actions/download-artifact@v3
  240. with:
  241. name: source-emqx-enterprise
  242. path: .
  243. - name: unzip source code
  244. run: unzip -q source.zip
  245. - uses: actions/download-artifact@v3
  246. name: download coverdata
  247. with:
  248. name: coverdata
  249. path: source/_build/test/cover
  250. - name: make cover
  251. working-directory: source
  252. env:
  253. PROFILE: emqx-enterprise
  254. run: make cover
  255. - name: send to coveralls
  256. working-directory: source
  257. env:
  258. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  259. PROFILE: emqx-enterprise
  260. run: make coveralls
  261. - name: get coveralls logs
  262. working-directory: source
  263. if: failure()
  264. run: cat rebar3.crashdump
  265. # do this in a separate job
  266. upload_coverdata:
  267. needs: make_cover
  268. runs-on: ubuntu-20.04
  269. steps:
  270. - name: Coveralls Finished
  271. env:
  272. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  273. run: |
  274. curl -v -k https://coveralls.io/webhook \
  275. --header "Content-Type: application/json" \
  276. --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_ID,\"status\":\"done\"}}" || true