run_test_cases.yaml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. eunit_and_proper:
  15. strategy:
  16. matrix:
  17. otp:
  18. - 24.2.1-1
  19. elixir:
  20. - 1.13.3
  21. os:
  22. - ubuntu20.04
  23. arch:
  24. - amd64
  25. runs-on: aws-amd64
  26. container: "ghcr.io/emqx/emqx-builder/5.0-10:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
  27. steps:
  28. - uses: AutoModality/action-clean@v1
  29. - uses: actions/checkout@v2
  30. - name: Get deps git refs for cache
  31. id: deps-refs
  32. run: |
  33. scripts/get-dep-refs.sh
  34. make clean-all
  35. - name: load quicer cache
  36. uses: actions/cache@v2
  37. with:
  38. path: source/_build/default/lib/quicer/
  39. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  40. # produces eunit.coverdata
  41. - name: eunit
  42. run: make eunit
  43. # produces proper.coverdata
  44. - name: proper
  45. run: make proper
  46. - uses: actions/upload-artifact@v2
  47. with:
  48. name: coverdata
  49. path: _build/test/cover
  50. find_apps:
  51. runs-on: aws-amd64
  52. container: ghcr.io/emqx/emqx-builder/5.0-10:1.13.3-24.2.1-1-ubuntu20.04
  53. outputs:
  54. fast_ct_apps: ${{ steps.run_find_apps.outputs.fast_ct_apps }}
  55. docker_ct_apps: ${{ steps.run_find_apps.outputs.docker_ct_apps }}
  56. defaults:
  57. run:
  58. shell: bash
  59. steps:
  60. - uses: AutoModality/action-clean@v1
  61. - uses: actions/checkout@v2
  62. - name: find apps
  63. id: run_find_apps
  64. run: |
  65. fast_ct_apps="$(./scripts/find-apps.sh --ct fast --json)"
  66. docker_ct_apps="$(./scripts/find-apps.sh --ct docker --json)"
  67. echo "::set-output name=fast_ct_apps::$fast_ct_apps"
  68. echo "::set-output name=docker_ct_apps::$docker_ct_apps"
  69. ct_docker:
  70. needs: find_apps
  71. strategy:
  72. fail-fast: false
  73. matrix:
  74. app_name: ${{ fromJson(needs.find_apps.outputs.docker_ct_apps) }}
  75. otp_release:
  76. - "erlang23"
  77. - "erlang24"
  78. runs-on: ubuntu-20.04
  79. defaults:
  80. run:
  81. shell: bash
  82. steps:
  83. - uses: AutoModality/action-clean@v1
  84. - uses: actions/checkout@v2
  85. - name: docker compose up
  86. env:
  87. MONGO_TAG: 5
  88. MYSQL_TAG: 8
  89. PGSQL_TAG: 13
  90. REDIS_TAG: 6
  91. run: |
  92. docker-compose \
  93. -f .ci/docker-compose-file/docker-compose-mongo-single-tcp.yaml \
  94. -f .ci/docker-compose-file/docker-compose-mongo-single-tls.yaml \
  95. -f .ci/docker-compose-file/docker-compose-mysql-tcp.yaml \
  96. -f .ci/docker-compose-file/docker-compose-mysql-tls.yaml \
  97. -f .ci/docker-compose-file/docker-compose-pgsql-tcp.yaml \
  98. -f .ci/docker-compose-file/docker-compose-pgsql-tls.yaml \
  99. -f .ci/docker-compose-file/docker-compose-redis-single-tcp.yaml \
  100. -f .ci/docker-compose-file/docker-compose-redis-single-tls.yaml \
  101. -f .ci/docker-compose-file/docker-compose.yaml \
  102. up -d --build
  103. # produces <app-name>.coverdata
  104. - name: run common test
  105. run: |
  106. docker exec -i ${{ matrix.otp_release }} bash -c "make ${{ matrix.app_name }}-ct"
  107. - uses: actions/upload-artifact@v1
  108. if: matrix.otp_release == 'erlang24'
  109. with:
  110. name: coverdata
  111. path: _build/test/cover
  112. - uses: actions/upload-artifact@v1
  113. if: failure()
  114. with:
  115. name: logs_${{ matrix.otp_release }}
  116. path: _build/test/logs
  117. ct:
  118. needs: find_apps
  119. strategy:
  120. fail-fast: false
  121. matrix:
  122. app_name: ${{ fromJson(needs.find_apps.outputs.fast_ct_apps) }}
  123. otp:
  124. - 24.2.1-1
  125. elixir:
  126. - 1.13.3
  127. os:
  128. - ubuntu20.04
  129. arch:
  130. - amd64
  131. runs-on: aws-amd64
  132. container: "ghcr.io/emqx/emqx-builder/5.0-10:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
  133. defaults:
  134. run:
  135. shell: bash
  136. steps:
  137. - uses: AutoModality/action-clean@v1
  138. - uses: actions/checkout@v2
  139. # produces <app-name>.coverdata
  140. - name: run common test
  141. run: |
  142. make ${{ matrix.app_name }}-ct
  143. - uses: actions/upload-artifact@v1
  144. if: matrix.otp == '24.2.1-1'
  145. with:
  146. name: coverdata
  147. path: _build/test/cover
  148. - uses: actions/upload-artifact@v1
  149. if: failure()
  150. with:
  151. name: logs_${{ matrix.otp_release }}
  152. path: _build/test/logs
  153. make_cover:
  154. needs:
  155. - eunit_and_proper
  156. - ct
  157. - ct_docker
  158. strategy:
  159. matrix:
  160. otp:
  161. - 24.2.1-1
  162. elixir:
  163. - 1.13.3
  164. os:
  165. - ubuntu20.04
  166. arch:
  167. - amd64
  168. runs-on: aws-amd64
  169. container: "ghcr.io/emqx/emqx-builder/5.0-10:${{ matrix.elixir }}-${{ matrix.otp }}-${{ matrix.os }}"
  170. steps:
  171. - uses: AutoModality/action-clean@v1
  172. - uses: actions/checkout@v2
  173. - name: Get deps git refs for cache
  174. id: deps-refs
  175. run: |
  176. scripts/get-dep-refs.sh
  177. make clean-all
  178. - name: load quicer cache
  179. uses: actions/cache@v2
  180. with:
  181. path: source/_build/default/lib/quicer/
  182. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  183. - uses: actions/download-artifact@v2
  184. name: download coverdata
  185. with:
  186. name: coverdata
  187. path: _build/test/cover
  188. - name: make cover
  189. run: make cover
  190. - name: send to coveralls
  191. env:
  192. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  193. run: make coveralls
  194. # do this in a separate job
  195. upload_coverdata:
  196. needs: make_cover
  197. runs-on: aws-amd64
  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
  206. allgood_functional_tests:
  207. runs-on: ubuntu-20.04
  208. needs:
  209. - eunit_and_proper
  210. - ct_docker
  211. - ct
  212. steps:
  213. - name: Check if all functional tests succeeded
  214. uses: re-actors/alls-green@release/v1
  215. with:
  216. #allowed-failures:
  217. #allowed-skips:
  218. jobs: ${{ toJSON(needs) }}