run_emqx_app_tests.yaml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. name: Check emqx app standalone
  2. ## apps/emqx can be used as a rebar/mix dependency
  3. ## in other project, so we need to make sure apps/emqx
  4. ## as an Erlang/Elixir app works standalone
  5. on:
  6. pull_request:
  7. jobs:
  8. run_emqx_app_tests:
  9. strategy:
  10. matrix:
  11. otp:
  12. - 24.2.1-1
  13. # no need to use more than 1 version of Elixir, since tests
  14. # run using only Erlang code. This is needed just to specify
  15. # the base image.
  16. elixir:
  17. - 1.13.4
  18. os:
  19. - ubuntu20.04
  20. arch:
  21. - amd64
  22. runs-on: aws-amd64
  23. container: "ghcr.io/emqx/emqx-builder/5.0-16:${{ matrix.elixir}}-${{ matrix.otp }}-${{ matrix.os }}"
  24. defaults:
  25. run:
  26. shell: bash
  27. steps:
  28. - uses: actions/checkout@v2
  29. with:
  30. fetch-depth: 0
  31. - name: run
  32. run: |
  33. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  34. echo "git diff base: $GITHUB_BASE_REF"
  35. if [[ "$GITHUB_BASE_REF" =~ [0-9a-f]{8,40} ]]; then
  36. # base is a commit sha1
  37. compare_base="$GITHUB_BASE_REF"
  38. else
  39. repo="${GITHUB_REPOSITORY}"
  40. git remote -v
  41. remote="$(git remote -v | grep -E "github\.com(:|/)$repo((\.git)|(\s))" | grep fetch | awk '{print $1}')"
  42. git fetch "$remote" "$GITHUB_BASE_REF"
  43. compare_base="$remote/$GITHUB_BASE_REF"
  44. fi
  45. changed_files="$(git diff --name-only ${compare_base} HEAD apps/emqx)"
  46. if [ "$changed_files" = '' ]; then
  47. echo "nothing changed in apps/emqx, ignored."
  48. exit 0
  49. fi
  50. make ensure-rebar3
  51. cp rebar3 apps/emqx/
  52. cd apps/emqx
  53. ./rebar3 xref
  54. ./rebar3 dialyzer
  55. ./rebar3 eunit -v
  56. ./rebar3 ct -v
  57. ./rebar3 proper -d test/props
  58. - uses: actions/upload-artifact@v1
  59. if: failure()
  60. with:
  61. name: logs
  62. path: apps/emqx/_build/test/logs
  63. allgood_emqx_app_tests:
  64. runs-on: ubuntu-latest
  65. needs:
  66. - run_emqx_app_tests
  67. steps:
  68. - name: Check if all emqx app tests succeeded
  69. uses: re-actors/alls-green@release/v1
  70. with:
  71. #allowed-failures:
  72. #allowed-skips:
  73. jobs: ${{ toJSON(needs) }}