run_test_cases.yaml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. name: Run test case
  2. concurrency:
  3. group: test-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. workflow_call:
  7. inputs:
  8. runner_labels:
  9. required: true
  10. type: string
  11. builder:
  12. required: true
  13. type: string
  14. ct-matrix:
  15. required: true
  16. type: string
  17. ct-host:
  18. required: true
  19. type: string
  20. ct-docker:
  21. required: true
  22. type: string
  23. env:
  24. IS_CI: "yes"
  25. jobs:
  26. eunit_and_proper:
  27. runs-on: ${{ fromJSON(inputs.runner_labels) }}
  28. name: "eunit_and_proper (${{ matrix.profile }})"
  29. strategy:
  30. fail-fast: false
  31. matrix:
  32. include: ${{ fromJson(inputs.ct-matrix) }}
  33. defaults:
  34. run:
  35. shell: bash
  36. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
  37. steps:
  38. - uses: actions/download-artifact@v3
  39. with:
  40. name: ${{ matrix.profile }}
  41. - name: extract artifact
  42. run: |
  43. unzip -o -q ${{ matrix.profile }}.zip
  44. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  45. # produces eunit.coverdata
  46. - name: eunit
  47. env:
  48. PROFILE: ${{ matrix.profile }}
  49. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
  50. run: make eunit
  51. # produces proper.coverdata
  52. - name: proper
  53. env:
  54. PROFILE: ${{ matrix.profile }}
  55. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
  56. run: make proper
  57. - uses: actions/upload-artifact@v3
  58. with:
  59. name: coverdata
  60. path: _build/test/cover
  61. ct_docker:
  62. runs-on: ${{ fromJSON(inputs.runner_labels) }}
  63. name: "ct_docker (${{ matrix.app }}-${{ matrix.suitegroup }})"
  64. strategy:
  65. fail-fast: false
  66. matrix:
  67. include: ${{ fromJson(inputs.ct-docker) }}
  68. defaults:
  69. run:
  70. shell: bash
  71. steps:
  72. - uses: actions/download-artifact@v3
  73. with:
  74. name: ${{ matrix.profile }}
  75. - name: extract artifact
  76. run: |
  77. unzip -o -q ${{ matrix.profile }}.zip
  78. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  79. # produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
  80. - name: run common tests
  81. env:
  82. DOCKER_CT_RUNNER_IMAGE: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
  83. MONGO_TAG: "5"
  84. MYSQL_TAG: "8"
  85. PGSQL_TAG: "13"
  86. REDIS_TAG: "7.0"
  87. INFLUXDB_TAG: "2.5.0"
  88. TDENGINE_TAG: "3.0.2.4"
  89. OPENTS_TAG: "9aa7f88"
  90. MINIO_TAG: "RELEASE.2023-03-20T20-16-18Z"
  91. PROFILE: ${{ matrix.profile }}
  92. SUITEGROUP: ${{ matrix.suitegroup }}
  93. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
  94. run: ./scripts/ct/run.sh --ci --app ${{ matrix.app }}
  95. - uses: actions/upload-artifact@v3
  96. with:
  97. name: coverdata
  98. path: _build/test/cover
  99. - name: compress logs
  100. if: failure()
  101. run: tar -czf logs.tar.gz _build/test/logs
  102. - uses: actions/upload-artifact@v3
  103. if: failure()
  104. with:
  105. name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
  106. path: logs.tar.gz
  107. ct:
  108. runs-on: ${{ fromJSON(inputs.runner_labels) }}
  109. name: "ct (${{ matrix.app }}-${{ matrix.suitegroup }})"
  110. strategy:
  111. fail-fast: false
  112. matrix:
  113. include: ${{ fromJson(inputs.ct-host) }}
  114. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
  115. defaults:
  116. run:
  117. shell: bash
  118. steps:
  119. - uses: actions/download-artifact@v3
  120. with:
  121. name: ${{ matrix.profile }}
  122. - name: extract artifact
  123. run: |
  124. unzip -o -q ${{ matrix.profile }}.zip
  125. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  126. # produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
  127. - name: run common tests
  128. env:
  129. PROFILE: ${{ matrix.profile }}
  130. SUITEGROUP: ${{ matrix.suitegroup }}
  131. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
  132. run: |
  133. make "${{ matrix.app }}-ct"
  134. - uses: actions/upload-artifact@v3
  135. with:
  136. name: coverdata
  137. path: _build/test/cover
  138. if-no-files-found: warn # do not fail if no coverdata found
  139. - name: compress logs
  140. if: failure()
  141. run: tar -czf logs.tar.gz _build/test/logs
  142. - uses: actions/upload-artifact@v3
  143. if: failure()
  144. with:
  145. name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
  146. path: logs.tar.gz
  147. tests_passed:
  148. needs:
  149. - eunit_and_proper
  150. - ct
  151. - ct_docker
  152. runs-on: ${{ fromJSON(inputs.runner_labels) }}
  153. strategy:
  154. fail-fast: false
  155. steps:
  156. - run: echo "All tests passed"
  157. make_cover:
  158. needs:
  159. - eunit_and_proper
  160. - ct
  161. - ct_docker
  162. runs-on: ${{ fromJSON(inputs.runner_labels) }}
  163. container: ${{ inputs.builder }}
  164. strategy:
  165. fail-fast: false
  166. matrix:
  167. profile:
  168. - emqx-enterprise
  169. steps:
  170. - uses: actions/download-artifact@v3
  171. with:
  172. name: ${{ matrix.profile }}
  173. - name: extract artifact
  174. run: |
  175. unzip -o -q ${{ matrix.profile }}.zip
  176. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  177. - uses: actions/download-artifact@v3
  178. name: download coverdata
  179. with:
  180. name: coverdata
  181. path: _build/test/cover
  182. - name: make cover
  183. env:
  184. PROFILE: emqx-enterprise
  185. run: make cover
  186. - name: send to coveralls
  187. env:
  188. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  189. PROFILE: emqx-enterprise
  190. run: make coveralls
  191. - name: get coveralls logs
  192. if: failure()
  193. run: cat rebar3.crashdump
  194. # do this in a separate job
  195. upload_coverdata:
  196. needs: make_cover
  197. runs-on: ${{ fromJSON(inputs.runner_labels) }}
  198. steps:
  199. - name: Coveralls Finished
  200. env:
  201. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  202. run: |
  203. curl -v -k https://coveralls.io/webhook \
  204. --header "Content-Type: application/json" \
  205. --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_ID,\"status\":\"done\"}}" || true