run_emqx_app_tests.yaml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. builder:
  12. - 5.0-26
  13. otp:
  14. - 24.3.4.2-1
  15. - 25.1.2-2
  16. # no need to use more than 1 version of Elixir, since tests
  17. # run using only Erlang code. This is needed just to specify
  18. # the base image.
  19. elixir:
  20. - 1.13.4
  21. os:
  22. - ubuntu20.04
  23. arch:
  24. - amd64
  25. runs-on:
  26. - aws-amd64
  27. - ubuntu-20.04
  28. use-self-hosted:
  29. - ${{ github.repository_owner == 'emqx' }}
  30. exclude:
  31. - runs-on: ubuntu-20.04
  32. use-self-hosted: true
  33. - runs-on: aws-amd64
  34. use-self-hosted: false
  35. runs-on: ${{ matrix.runs-on }}
  36. container: "ghcr.io/emqx/emqx-builder/${{ matrix.builder }}:${{ matrix.elixir}}-${{ matrix.otp }}-${{ matrix.os }}"
  37. defaults:
  38. run:
  39. shell: bash
  40. steps:
  41. - uses: actions/checkout@v3
  42. with:
  43. fetch-depth: 0
  44. - name: run
  45. run: |
  46. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  47. echo "git diff base: $GITHUB_BASE_REF"
  48. if [[ "$GITHUB_BASE_REF" =~ [0-9a-f]{8,40} ]]; then
  49. # base is a commit sha1
  50. compare_base="$GITHUB_BASE_REF"
  51. else
  52. repo="${GITHUB_REPOSITORY}"
  53. git remote -v
  54. remote="$(git remote -v | grep -E "github\.com(:|/)$repo((\.git)|(\s))" | grep fetch | awk '{print $1}')"
  55. git fetch "$remote" "$GITHUB_BASE_REF"
  56. compare_base="$remote/$GITHUB_BASE_REF"
  57. fi
  58. changed_files="$(git diff --name-only ${compare_base} HEAD apps/emqx)"
  59. if [ "$changed_files" = '' ]; then
  60. echo "nothing changed in apps/emqx, ignored."
  61. exit 0
  62. fi
  63. make ensure-rebar3
  64. cp rebar3 apps/emqx/
  65. cd apps/emqx
  66. ./rebar3 xref
  67. ./rebar3 dialyzer
  68. ./rebar3 eunit -v
  69. ./rebar3 ct -v
  70. ./rebar3 proper -d test/props
  71. - uses: actions/upload-artifact@v3
  72. if: failure()
  73. with:
  74. name: logs
  75. path: apps/emqx/_build/test/logs