run_test_cases.yaml 4.0 KB

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