run_test_cases.yaml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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:
  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: ${{ inputs.runner }}
  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: AutoModality/action-clean@v1
  39. - uses: actions/download-artifact@v3
  40. with:
  41. name: ${{ matrix.profile }}
  42. - name: extract artifact
  43. run: |
  44. unzip -o -q ${{ matrix.profile }}.zip
  45. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  46. # produces eunit.coverdata
  47. - name: eunit
  48. env:
  49. PROFILE: ${{ matrix.profile }}
  50. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
  51. run: make eunit
  52. # produces proper.coverdata
  53. - name: proper
  54. env:
  55. PROFILE: ${{ matrix.profile }}
  56. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}
  57. run: make proper
  58. - uses: actions/upload-artifact@v3
  59. with:
  60. name: coverdata
  61. path: _build/test/cover
  62. ct_docker:
  63. runs-on: ${{ inputs.runner }}
  64. name: "ct_docker (${{ matrix.app }}-${{ matrix.suitegroup }})"
  65. strategy:
  66. fail-fast: false
  67. matrix:
  68. include: ${{ fromJson(inputs.ct-docker) }}
  69. defaults:
  70. run:
  71. shell: bash
  72. steps:
  73. - uses: AutoModality/action-clean@v1
  74. - uses: actions/download-artifact@v3
  75. with:
  76. name: ${{ matrix.profile }}
  77. - name: extract artifact
  78. run: |
  79. unzip -o -q ${{ matrix.profile }}.zip
  80. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  81. # produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
  82. - name: run common tests
  83. env:
  84. DOCKER_CT_RUNNER_IMAGE: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
  85. MONGO_TAG: "5"
  86. MYSQL_TAG: "8"
  87. PGSQL_TAG: "13"
  88. REDIS_TAG: "7.0"
  89. INFLUXDB_TAG: "2.5.0"
  90. TDENGINE_TAG: "3.0.2.4"
  91. OPENTS_TAG: "9aa7f88"
  92. MINIO_TAG: "RELEASE.2023-03-20T20-16-18Z"
  93. PROFILE: ${{ matrix.profile }}
  94. SUITEGROUP: ${{ matrix.suitegroup }}
  95. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
  96. run: ./scripts/ct/run.sh --ci --app ${{ matrix.app }}
  97. - uses: actions/upload-artifact@v3
  98. with:
  99. name: coverdata
  100. path: _build/test/cover
  101. - uses: actions/upload-artifact@v3
  102. if: failure()
  103. with:
  104. name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
  105. path: _build/test/logs
  106. ct:
  107. runs-on: ${{ inputs.runner }}
  108. name: "ct (${{ matrix.app }}-${{ matrix.suitegroup }})"
  109. strategy:
  110. fail-fast: false
  111. matrix:
  112. include: ${{ fromJson(inputs.ct-host) }}
  113. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
  114. defaults:
  115. run:
  116. shell: bash
  117. steps:
  118. - uses: AutoModality/action-clean@v1
  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. - uses: actions/upload-artifact@v3
  140. if: failure()
  141. with:
  142. name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
  143. path: _build/test/logs
  144. tests_passed:
  145. needs:
  146. - eunit_and_proper
  147. - ct
  148. - ct_docker
  149. runs-on: ${{ inputs.runner }}
  150. strategy:
  151. fail-fast: false
  152. steps:
  153. - run: echo "All tests passed"
  154. make_cover:
  155. needs:
  156. - eunit_and_proper
  157. - ct
  158. - ct_docker
  159. runs-on: ${{ inputs.runner }}
  160. container: ${{ inputs.builder }}
  161. strategy:
  162. fail-fast: false
  163. matrix:
  164. profile:
  165. - emqx-enterprise
  166. steps:
  167. - uses: AutoModality/action-clean@v1
  168. - uses: actions/download-artifact@v3
  169. with:
  170. name: ${{ matrix.profile }}
  171. - name: extract artifact
  172. run: |
  173. unzip -o -q ${{ matrix.profile }}.zip
  174. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  175. - uses: actions/download-artifact@v3
  176. name: download coverdata
  177. with:
  178. name: coverdata
  179. path: _build/test/cover
  180. - name: make cover
  181. env:
  182. PROFILE: emqx-enterprise
  183. run: make cover
  184. - name: send to coveralls
  185. env:
  186. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  187. PROFILE: emqx-enterprise
  188. run: make coveralls
  189. - name: get coveralls logs
  190. if: failure()
  191. run: cat rebar3.crashdump
  192. # do this in a separate job
  193. upload_coverdata:
  194. needs: make_cover
  195. runs-on: ${{ inputs.runner }}
  196. steps:
  197. - name: Coveralls Finished
  198. env:
  199. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  200. run: |
  201. curl -v -k https://coveralls.io/webhook \
  202. --header "Content-Type: application/json" \
  203. --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_ID,\"status\":\"done\"}}" || true