run_test_cases.yaml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. otp:
  16. - "23.2.7.2-emqx-2"
  17. - "24.1.1-emqx-1"
  18. runs-on: ubuntu-20.04
  19. container: "ghcr.io/emqx/emqx-builder/5.0:${{ matrix.otp }}-ubuntu20.04"
  20. steps:
  21. - uses: actions/checkout@v2
  22. - name: set git credentials
  23. run: |
  24. if make emqx-ee --dry-run > /dev/null 2>&1; then
  25. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  26. git config --global credential.helper store
  27. fi
  28. - name: xref
  29. run: make xref
  30. - name: dialyzer
  31. run: make dialyzer
  32. run_proper_test:
  33. strategy:
  34. matrix:
  35. otp:
  36. - "23.2.7.2-emqx-2"
  37. - "24.1.1-emqx-1"
  38. runs-on: ubuntu-20.04
  39. container: "ghcr.io/emqx/emqx-builder/5.0:${{ matrix.otp }}-ubuntu20.04"
  40. steps:
  41. - uses: actions/checkout@v2
  42. - name: set git credentials
  43. run: |
  44. if make emqx-ee --dry-run > /dev/null 2>&1; then
  45. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  46. git config --global credential.helper store
  47. fi
  48. - name: proper
  49. run: make proper
  50. run_common_test:
  51. strategy:
  52. matrix:
  53. otp_release:
  54. - "erlang23"
  55. - "erlang24"
  56. runs-on: ubuntu-20.04
  57. steps:
  58. - uses: actions/checkout@v2
  59. - name: set edition
  60. id: set_edition
  61. run: |
  62. if make emqx-ee --dry-run > /dev/null 2>&1; then
  63. echo "EDITION=enterprise" >> $GITHUB_ENV
  64. else
  65. echo "EDITION=opensource" >> $GITHUB_ENV
  66. fi
  67. - name: docker compose up
  68. if: env.EDITION == 'opensource'
  69. env:
  70. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  71. run: |
  72. docker-compose \
  73. -f .ci/docker-compose-file/docker-compose.yaml \
  74. up -d --build
  75. - name: docker compose up
  76. if: env.EDITION == 'enterprise'
  77. env:
  78. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  79. timeout-minutes: 20
  80. run: |
  81. docker-compose \
  82. -f .ci/docker-compose-file/docker-compose.yaml \
  83. -f .ci/docker-compose-file/docker-compose-enterprise.yaml \
  84. up -d --build
  85. - name: run eunit
  86. run: |
  87. docker exec -i ${{ matrix.otp_release }} bash -c "make eunit"
  88. - name: run common test
  89. run: |
  90. docker exec -i ${{ matrix.otp_release }} bash -c "make ct"
  91. - name: run cover
  92. run: |
  93. printenv > .env
  94. docker exec -i ${{ matrix.otp_release }} bash -c "DIAGNOSTIC=1 make cover"
  95. docker exec --env-file .env -i ${{ matrix.otp_release }} bash -c "DIAGNOSTIC=1 make coveralls"
  96. - name: cat rebar.crashdump
  97. if: failure()
  98. run: if [ -f 'rebar3.crashdump' ];then cat 'rebar3.crashdump'; fi
  99. - uses: actions/upload-artifact@v1
  100. if: failure()
  101. with:
  102. name: logs_${{ matrix.otp_release }}
  103. path: _build/test/logs
  104. - uses: actions/upload-artifact@v1
  105. with:
  106. name: cover_${{ matrix.otp_release }}
  107. path: _build/test/cover
  108. finish:
  109. needs: run_common_test
  110. runs-on: ubuntu-20.04
  111. steps:
  112. - name: Coveralls Finished
  113. env:
  114. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  115. run: |
  116. curl -v -k https://coveralls.io/webhook \
  117. --header "Content-Type: application/json" \
  118. --data "{\"repo_name\":\"$GITHUB_REPOSITORY\",\"repo_token\":\"$GITHUB_TOKEN\",\"payload\":{\"build_num\":$GITHUB_RUN_ID,\"status\":\"done\"}}" || true