run_test_cases.yaml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. strategy:
  29. fail-fast: false
  30. matrix:
  31. include: ${{ fromJson(inputs.ct-matrix) }}
  32. defaults:
  33. run:
  34. shell: bash
  35. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
  36. steps:
  37. - uses: AutoModality/action-clean@v1
  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: ${{ inputs.runner }}
  63. strategy:
  64. fail-fast: false
  65. matrix:
  66. include: ${{ fromJson(inputs.ct-docker) }}
  67. defaults:
  68. run:
  69. shell: bash
  70. steps:
  71. - uses: AutoModality/action-clean@v1
  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. - uses: actions/upload-artifact@v3
  100. if: failure()
  101. with:
  102. name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
  103. path: _build/test/logs
  104. ct:
  105. runs-on: ${{ inputs.runner }}
  106. strategy:
  107. fail-fast: false
  108. matrix:
  109. include: ${{ fromJson(inputs.ct-host) }}
  110. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir }}-${{ matrix.otp }}-ubuntu22.04"
  111. defaults:
  112. run:
  113. shell: bash
  114. steps:
  115. - uses: AutoModality/action-clean@v1
  116. - uses: actions/download-artifact@v3
  117. with:
  118. name: ${{ matrix.profile }}
  119. - name: extract artifact
  120. run: |
  121. unzip -o -q ${{ matrix.profile }}.zip
  122. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  123. # produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
  124. - name: run common tests
  125. env:
  126. PROFILE: ${{ matrix.profile }}
  127. SUITEGROUP: ${{ matrix.suitegroup }}
  128. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
  129. run: |
  130. make "${{ matrix.app }}-ct"
  131. - uses: actions/upload-artifact@v3
  132. with:
  133. name: coverdata
  134. path: _build/test/cover
  135. if-no-files-found: warn # do not fail if no coverdata found
  136. - uses: actions/upload-artifact@v3
  137. if: failure()
  138. with:
  139. name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-${{ matrix.otp }}-sg${{ matrix.suitegroup }}
  140. path: _build/test/logs
  141. make_cover:
  142. needs:
  143. - eunit_and_proper
  144. - ct
  145. - ct_docker
  146. runs-on: ${{ inputs.runner }}
  147. container: ${{ inputs.builder }}
  148. strategy:
  149. fail-fast: false
  150. matrix:
  151. profile:
  152. - emqx-enterprise
  153. steps:
  154. - uses: AutoModality/action-clean@v1
  155. - uses: actions/download-artifact@v3
  156. with:
  157. name: ${{ matrix.profile }}
  158. - name: extract artifact
  159. run: |
  160. unzip -o -q ${{ matrix.profile }}.zip
  161. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  162. - uses: actions/download-artifact@v3
  163. name: download coverdata
  164. with:
  165. name: coverdata
  166. path: _build/test/cover
  167. - name: make cover
  168. env:
  169. PROFILE: emqx-enterprise
  170. run: make cover
  171. - name: send to coveralls
  172. env:
  173. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  174. PROFILE: emqx-enterprise
  175. run: make coveralls
  176. - name: get coveralls logs
  177. if: failure()
  178. run: cat rebar3.crashdump
  179. # do this in a separate job
  180. upload_coverdata:
  181. needs: make_cover
  182. runs-on: ${{ inputs.runner }}
  183. steps:
  184. - name: Coveralls Finished
  185. env:
  186. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  187. run: |
  188. curl -v -k https://coveralls.io/webhook \
  189. --header "Content-Type: application/json" \
  190. --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_ID,\"status\":\"done\"}}" || true