run_test_cases.yaml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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-3:24.1.5-3 # 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-3:24.1.5-3
  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. MONGO_TAG: 5
  48. MYSQL_TAG: 8
  49. PGSQL_TAG: 13
  50. REDIS_TAG: 6
  51. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  52. run: |
  53. docker-compose \
  54. -f .ci/docker-compose-file/docker-compose-mongo-single-tcp.yaml \
  55. -f .ci/docker-compose-file/docker-compose-mysql-tcp.yaml \
  56. -f .ci/docker-compose-file/docker-compose-pgsql-tcp.yaml \
  57. -f .ci/docker-compose-file/docker-compose-redis-single-tcp.yaml \
  58. -f .ci/docker-compose-file/docker-compose.yaml \
  59. up -d --build
  60. - name: run eunit
  61. run: |
  62. docker exec -i ${{ matrix.otp_release }} bash -c "make eunit"
  63. - name: run common test
  64. run: |
  65. docker exec -i ${{ matrix.otp_release }} bash -c "make ct"
  66. - name: run cover
  67. run: |
  68. printenv > .env
  69. docker exec -i ${{ matrix.otp_release }} bash -c "DIAGNOSTIC=1 make cover"
  70. docker exec --env-file .env -i ${{ matrix.otp_release }} bash -c "DIAGNOSTIC=1 make coveralls"
  71. - name: cat rebar.crashdump
  72. if: failure()
  73. run: if [ -f 'rebar3.crashdump' ];then cat 'rebar3.crashdump'; fi
  74. - uses: actions/upload-artifact@v1
  75. if: failure()
  76. with:
  77. name: logs_${{ matrix.otp_release }}
  78. path: _build/test/logs
  79. - uses: actions/upload-artifact@v1
  80. with:
  81. name: cover_${{ matrix.otp_release }}
  82. path: _build/test/cover
  83. finish:
  84. needs: run_common_test
  85. runs-on: ubuntu-20.04
  86. steps:
  87. - name: Coveralls Finished
  88. env:
  89. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  90. run: |
  91. curl -v -k https://coveralls.io/webhook \
  92. --header "Content-Type: application/json" \
  93. --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_ID,\"status\":\"done\"}}" || true