run_emqx_app_tests.yaml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: Check emqx app standalone
  2. # These tests are needed because we provide the `emqx` application as a standalone
  3. # dependency for plugins.
  4. concurrency:
  5. group: test-standalone-${{ github.event_name }}-${{ github.ref }}
  6. cancel-in-progress: true
  7. on:
  8. workflow_call:
  9. inputs:
  10. builder:
  11. required: true
  12. type: string
  13. before_ref:
  14. required: true
  15. type: string
  16. after_ref:
  17. required: true
  18. type: string
  19. env:
  20. IS_CI: "yes"
  21. jobs:
  22. run_emqx_app_tests:
  23. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  24. container: ${{ inputs.builder }}
  25. defaults:
  26. run:
  27. shell: bash
  28. steps:
  29. - uses: actions/checkout@v3
  30. with:
  31. fetch-depth: 0
  32. - name: run
  33. env:
  34. BEFORE_REF: ${{ inputs.before_ref }}
  35. AFTER_REF: ${{ inputs.after_ref }}
  36. run: |
  37. git config --global --add safe.directory "$GITHUB_WORKSPACE"
  38. changed_files="$(git diff --name-only ${BEFORE_REF} ${AFTER_REF} apps/emqx)"
  39. if [ "$changed_files" = '' ]; then
  40. echo "nothing changed in apps/emqx, ignored."
  41. exit 0
  42. fi
  43. make ensure-rebar3
  44. cp rebar3 apps/emqx/
  45. cd apps/emqx
  46. ./rebar3 xref
  47. ./rebar3 dialyzer
  48. ./rebar3 eunit -v --name 'eunit@127.0.0.1'
  49. ./rebar3 as standalone_test ct --name 'test@127.0.0.1' -v --readable=true
  50. ./rebar3 proper -d test/props
  51. - uses: actions/upload-artifact@v3
  52. if: failure()
  53. with:
  54. name: logs-emqx-app-tests
  55. path: apps/emqx/_build/test/logs
  56. retention-days: 7