run_test_cases.yaml 3.4 KB

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