run_test_cases.yaml 6.1 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. builder:
  9. required: true
  10. type: string
  11. ct-matrix:
  12. required: true
  13. type: string
  14. ct-host:
  15. required: true
  16. type: string
  17. ct-docker:
  18. required: true
  19. type: string
  20. env:
  21. IS_CI: "yes"
  22. jobs:
  23. eunit_and_proper:
  24. runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
  25. name: "eunit_and_proper (${{ matrix.profile }})"
  26. strategy:
  27. fail-fast: false
  28. matrix:
  29. include: ${{ fromJson(inputs.ct-matrix) }}
  30. defaults:
  31. run:
  32. shell: bash
  33. container: ${{ inputs.builder }}
  34. env:
  35. PROFILE: ${{ matrix.profile }}
  36. ENABLE_COVER_COMPILE: 1
  37. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}
  38. permissions:
  39. contents: read
  40. steps:
  41. - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
  42. with:
  43. name: ${{ matrix.profile }}
  44. - name: extract artifact
  45. run: |
  46. unzip -o -q ${{ matrix.profile }}.zip
  47. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  48. # produces eunit.coverdata
  49. - run: make eunit
  50. # produces proper.coverdata
  51. - run: make proper
  52. - run: make cover
  53. - name: send to coveralls
  54. if: github.repository == 'emqx/emqx'
  55. env:
  56. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  57. run: make coveralls
  58. - run: cat rebar3.crashdump
  59. if: failure()
  60. ct_docker:
  61. runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
  62. name: "${{ matrix.app }}-${{ matrix.suitegroup }} (${{ matrix.profile }})"
  63. strategy:
  64. fail-fast: false
  65. matrix:
  66. include: ${{ fromJson(inputs.ct-docker) }}
  67. defaults:
  68. run:
  69. shell: bash
  70. env:
  71. PROFILE: ${{ matrix.profile }}
  72. permissions:
  73. contents: read
  74. steps:
  75. - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
  76. with:
  77. name: ${{ matrix.profile }}
  78. - name: extract artifact
  79. run: |
  80. unzip -o -q ${{ matrix.profile }}.zip
  81. # produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
  82. - name: run common tests
  83. env:
  84. DOCKER_CT_RUNNER_IMAGE: ${{ inputs.builder }}
  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. SUITEGROUP: ${{ matrix.suitegroup }}
  94. ENABLE_COVER_COMPILE: 1
  95. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-sg${{ matrix.suitegroup }}
  96. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  97. run: ./scripts/ct/run.sh --ci --app ${{ matrix.app }} --keep-up
  98. - name: make cover
  99. run: |
  100. docker exec -e PROFILE="$PROFILE" -t erlang make cover
  101. - name: send to coveralls
  102. if: github.repository == 'emqx/emqx'
  103. run: |
  104. ls _build/test/cover/*.coverdata || exit 0
  105. docker exec -e PROFILE="$PROFILE" -t erlang make coveralls
  106. - name: rebar3.crashdump
  107. if: failure()
  108. run: cat rebar3.crashdump
  109. - name: compress logs
  110. if: failure()
  111. run: tar -czf logs.tar.gz _build/test/logs
  112. - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
  113. if: failure()
  114. with:
  115. name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-sg${{ matrix.suitegroup }}
  116. path: logs.tar.gz
  117. compression-level: 0
  118. retention-days: 7
  119. ct:
  120. runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
  121. name: "${{ matrix.app }}-${{ matrix.suitegroup }} (${{ matrix.profile }})"
  122. strategy:
  123. fail-fast: false
  124. matrix:
  125. include: ${{ fromJson(inputs.ct-host) }}
  126. container: ${{ inputs.builder }}
  127. defaults:
  128. run:
  129. shell: bash
  130. permissions:
  131. contents: read
  132. env:
  133. PROFILE: ${{ matrix.profile }}
  134. SUITEGROUP: ${{ matrix.suitegroup }}
  135. ENABLE_COVER_COMPILE: 1
  136. CT_COVER_EXPORT_PREFIX: ${{ matrix.profile }}-sg${{ matrix.suitegroup }}
  137. steps:
  138. - uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
  139. with:
  140. name: ${{ matrix.profile }}
  141. - name: extract artifact
  142. run: |
  143. unzip -o -q ${{ matrix.profile }}.zip
  144. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  145. # produces $PROFILE-<app-name>-<otp-vsn>-sg<suitegroup>.coverdata
  146. - name: run common tests
  147. run: make "${{ matrix.app }}-ct"
  148. - run: make cover
  149. - name: send to coveralls
  150. if: github.repository == 'emqx/emqx'
  151. env:
  152. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  153. run: |
  154. ls _build/test/cover/*.coverdata || exit 0
  155. make coveralls
  156. - run: cat rebar3.crashdump
  157. if: failure()
  158. - name: compress logs
  159. if: failure()
  160. run: tar -czf logs.tar.gz _build/test/logs
  161. - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
  162. if: failure()
  163. with:
  164. name: logs-${{ matrix.profile }}-${{ matrix.prefix }}-sg${{ matrix.suitegroup }}
  165. path: logs.tar.gz
  166. compression-level: 0
  167. retention-days: 7
  168. tests_passed:
  169. needs:
  170. - eunit_and_proper
  171. - ct
  172. - ct_docker
  173. runs-on: ubuntu-22.04
  174. strategy:
  175. fail-fast: false
  176. permissions:
  177. pull-requests: write
  178. steps:
  179. - name: Coveralls finished
  180. if: github.repository == 'emqx/emqx'
  181. uses: coverallsapp/github-action@643bc377ffa44ace6394b2b5d0d3950076de9f63 # v2.3.0
  182. with:
  183. parallel-finished: true
  184. git-branch: ${{ github.ref }}
  185. git-commit: ${{ github.sha }}
  186. - run: echo "All tests passed"