run_test_cases.yaml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. tags:
  8. - v*
  9. - e*
  10. pull_request:
  11. jobs:
  12. run_static_analysis:
  13. strategy:
  14. matrix:
  15. emqx_builder:
  16. - 5.0-2:24.1.5-2 # run dialyzer on latest OTP
  17. runs-on: ubuntu-20.04
  18. container: "ghcr.io/emqx/emqx-builder/${{ matrix.emqx_builder }}-ubuntu20.04"
  19. steps:
  20. - uses: actions/checkout@v2
  21. - name: xref
  22. run: make xref
  23. - name: dialyzer
  24. run: make dialyzer
  25. run_proper_test:
  26. strategy:
  27. matrix:
  28. emqx_builder:
  29. - 5.0-2:24.1.5-2
  30. runs-on: ubuntu-20.04
  31. container: "ghcr.io/emqx/emqx-builder/${{ matrix.emqx_builder }}-ubuntu20.04"
  32. steps:
  33. - uses: actions/checkout@v2
  34. - name: proper
  35. run: make proper
  36. run_common_test:
  37. strategy:
  38. matrix:
  39. otp_release:
  40. - "erlang23"
  41. - "erlang24"
  42. runs-on: ubuntu-20.04
  43. steps:
  44. - uses: actions/checkout@v2
  45. - name: docker compose up
  46. env:
  47. MYSQL_TAG: 8
  48. PGSQL_TAG: 13
  49. REDIS_TAG: 6
  50. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  51. run: |
  52. docker-compose \
  53. -f .ci/docker-compose-file/docker-compose-mysql-tcp.yaml \
  54. -f .ci/docker-compose-file/docker-compose-pgsql-tcp.yaml \
  55. -f .ci/docker-compose-file/docker-compose-redis-single-tcp.yaml \
  56. -f .ci/docker-compose-file/docker-compose.yaml \
  57. up -d --build
  58. - name: run eunit
  59. run: |
  60. docker exec -i ${{ matrix.otp_release }} bash -c "make eunit"
  61. - name: run common test
  62. run: |
  63. docker exec -i ${{ matrix.otp_release }} bash -c "make ct"
  64. - name: run cover
  65. run: |
  66. printenv > .env
  67. docker exec -i ${{ matrix.otp_release }} bash -c "DIAGNOSTIC=1 make cover"
  68. docker exec --env-file .env -i ${{ matrix.otp_release }} bash -c "DIAGNOSTIC=1 make coveralls"
  69. - name: cat rebar.crashdump
  70. if: failure()
  71. run: if [ -f 'rebar3.crashdump' ];then cat 'rebar3.crashdump'; fi
  72. - uses: actions/upload-artifact@v1
  73. if: failure()
  74. with:
  75. name: logs_${{ matrix.otp_release }}
  76. path: _build/test/logs
  77. - uses: actions/upload-artifact@v1
  78. with:
  79. name: cover_${{ matrix.otp_release }}
  80. path: _build/test/cover
  81. finish:
  82. needs: run_common_test
  83. runs-on: ubuntu-20.04
  84. steps:
  85. - name: Coveralls Finished
  86. env:
  87. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  88. run: |
  89. curl -v -k https://coveralls.io/webhook \
  90. --header "Content-Type: application/json" \
  91. --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_ID,\"status\":\"done\"}}" || true