run_test_cases.yaml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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: aws-amd64
  82. strategy:
  83. fail-fast: false
  84. matrix:
  85. profile:
  86. - emqx
  87. - emqx-enterprise
  88. defaults:
  89. run:
  90. shell: bash
  91. container: "ghcr.io/emqx/emqx-builder/5.0-24:1.13.4-24.3.4.2-1-ubuntu20.04"
  92. steps:
  93. - uses: AutoModality/action-clean@v1
  94. - uses: actions/download-artifact@v3
  95. with:
  96. name: source-${{ matrix.profile }}
  97. path: .
  98. - name: unzip source code
  99. env:
  100. PROFILE: ${{ matrix.profile }}
  101. run: unzip -o -q source.zip
  102. # produces eunit.coverdata
  103. - name: eunit
  104. env:
  105. PROFILE: ${{ matrix.profile }}
  106. working-directory: source
  107. run: make eunit
  108. # produces proper.coverdata
  109. - name: proper
  110. env:
  111. PROFILE: ${{ matrix.profile }}
  112. working-directory: source
  113. run: make proper
  114. - uses: actions/upload-artifact@v3
  115. with:
  116. name: coverdata
  117. path: source/_build/test/cover
  118. ct_docker:
  119. needs:
  120. - prepare
  121. - prepare_ee
  122. strategy:
  123. fail-fast: false
  124. matrix:
  125. app: ${{ fromJson(needs.prepare.outputs.docker_ct_apps) }}
  126. runs-on: aws-amd64
  127. defaults:
  128. run:
  129. shell: bash
  130. steps:
  131. - uses: AutoModality/action-clean@v1
  132. - uses: actions/download-artifact@v3
  133. with:
  134. name: source-${{ matrix.app[1] }}
  135. path: .
  136. - name: unzip source code
  137. run: unzip -q source.zip
  138. - name: run tests
  139. working-directory: source
  140. env:
  141. MONGO_TAG: 5
  142. MYSQL_TAG: 8
  143. PGSQL_TAG: 13
  144. REDIS_TAG: 6
  145. INFLUXDB_TAG: 2.5.0
  146. WHICH_APP: ${{ matrix.app[0] }}
  147. PROFILE: ${{ matrix.app[1] }}
  148. run: |
  149. echo $PROFILE
  150. rm _build/default/lib/rocksdb/_build/cmake/CMakeCache.txt
  151. ./scripts/ct/run.sh --app $WHICH_APP
  152. - uses: actions/upload-artifact@v3
  153. with:
  154. name: coverdata
  155. path: source/_build/test/cover
  156. - uses: actions/upload-artifact@v3
  157. if: failure()
  158. with:
  159. name: logs-${{ matrix.app[0] }}-${{ matrix.app[1] }}
  160. path: source/_build/test/logs
  161. ct:
  162. needs:
  163. - prepare
  164. - prepare_ee
  165. strategy:
  166. fail-fast: false
  167. matrix:
  168. app: ${{ fromJson(needs.prepare.outputs.fast_ct_apps) }}
  169. profile:
  170. - emqx
  171. - emqx-enterprise
  172. runs-on:
  173. - aws-amd64
  174. - ubuntu-20.04
  175. use-self-hosted:
  176. - ${{ github.repository_owner == 'emqx' }}
  177. exclude:
  178. - runs-on: ubuntu-20.04
  179. use-self-hosted: true
  180. - runs-on: aws-amd64
  181. use-self-hosted: false
  182. runs-on: ${{ matrix.runs-on }}
  183. container: "ghcr.io/emqx/emqx-builder/5.0-24:1.13.4-24.3.4.2-1-ubuntu20.04"
  184. defaults:
  185. run:
  186. shell: bash
  187. steps:
  188. - uses: AutoModality/action-clean@v1
  189. - uses: actions/download-artifact@v3
  190. with:
  191. name: source-${{ matrix.app[1] }}
  192. path: .
  193. - name: unzip source code
  194. run: unzip -q source.zip
  195. # produces $PROFILE-<app-name>.coverdata
  196. - name: run common test
  197. working-directory: source
  198. env:
  199. WHICH_APP: ${{ matrix.app[0] }}
  200. PROFILE: ${{ matrix.app[1] }}
  201. run: |
  202. make "${WHICH_APP}-ct"
  203. - uses: actions/upload-artifact@v3
  204. with:
  205. name: coverdata
  206. path: source/_build/test/cover
  207. if-no-files-found: warn # do not fail if no coverdata found
  208. - uses: actions/upload-artifact@v3
  209. if: failure()
  210. with:
  211. name: logs-${{ matrix.app[0] }}-${{ matrix.app[1] }}
  212. path: source/_build/test/logs
  213. make_cover:
  214. needs:
  215. - eunit_and_proper
  216. - ct
  217. - ct_docker
  218. runs-on: ubuntu-20.04
  219. container: "ghcr.io/emqx/emqx-builder/5.0-24:1.13.4-24.3.4.2-1-ubuntu20.04"
  220. steps:
  221. - uses: AutoModality/action-clean@v1
  222. - uses: actions/download-artifact@v3
  223. with:
  224. name: source-emqx-enterprise
  225. path: .
  226. - name: unzip source code
  227. run: unzip -q source.zip
  228. - uses: actions/download-artifact@v3
  229. name: download coverdata
  230. with:
  231. name: coverdata
  232. path: source/_build/test/cover
  233. - name: make cover
  234. working-directory: source
  235. env:
  236. PROFILE: emqx-enterprise
  237. run: make cover
  238. - name: send to coveralls
  239. working-directory: source
  240. env:
  241. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  242. PROFILE: emqx-enterprise
  243. run: make coveralls
  244. - name: get coveralls logs
  245. working-directory: source
  246. if: failure()
  247. run: cat rebar3.crashdump
  248. # do this in a separate job
  249. upload_coverdata:
  250. needs: make_cover
  251. runs-on: ubuntu-20.04
  252. steps:
  253. - name: Coveralls Finished
  254. env:
  255. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  256. run: |
  257. curl -v -k https://coveralls.io/webhook \
  258. --header "Content-Type: application/json" \
  259. --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_ID,\"status\":\"done\"}}" || true