diff --git a/.github/workflows/_pr_entrypoint.yaml b/.github/workflows/_pr_entrypoint.yaml index ec2bbf2e1..dce8a91eb 100644 --- a/.github/workflows/_pr_entrypoint.yaml +++ b/.github/workflows/_pr_entrypoint.yaml @@ -146,6 +146,17 @@ jobs: path: ${{ matrix.profile }}.zip retention-days: 1 + run_emqx_app_tests: + needs: + - sanity-checks + - compile + uses: ./.github/workflows/run_emqx_app_tests.yaml + with: + runner: ${{ needs.sanity-checks.outputs.runner }} + builder: ${{ needs.sanity-checks.outputs.builder }} + before_ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} + after_ref: ${{ github.sha }} + run_test_cases: needs: - sanity-checks diff --git a/.github/workflows/_push-entrypoint.yaml b/.github/workflows/_push-entrypoint.yaml index 9ef517ab9..bc3bc486e 100644 --- a/.github/workflows/_push-entrypoint.yaml +++ b/.github/workflows/_push-entrypoint.yaml @@ -158,6 +158,17 @@ jobs: path: ${{ matrix.profile }}.zip retention-days: 1 + run_emqx_app_tests: + needs: + - prepare + - compile + uses: ./.github/workflows/run_emqx_app_tests.yaml + with: + runner: ${{ needs.prepare.outputs.runner }} + builder: ${{ needs.prepare.outputs.builder }} + before_ref: ${{ github.event.before }} + after_ref: ${{ github.sha }} + run_test_cases: if: needs.prepare.outputs.release != 'true' needs: diff --git a/.github/workflows/run_emqx_app_tests.yaml b/.github/workflows/run_emqx_app_tests.yaml new file mode 100644 index 000000000..5479a86ab --- /dev/null +++ b/.github/workflows/run_emqx_app_tests.yaml @@ -0,0 +1,65 @@ +name: Check emqx app standalone + +# These tests are needed because we provide the `emqx` application as a standalone +# dependency for plugins. + +concurrency: + group: test-standalone-${{ github.event_name }}-${{ github.ref }} + cancel-in-progress: true + +on: + workflow_call: + inputs: + runner: + required: true + type: string + builder: + required: true + type: string + before_ref: + required: true + type: string + after_ref: + required: true + type: string + +env: + IS_CI: "yes" + +jobs: + run_emqx_app_tests: + runs-on: ${{ inputs.runner }} + container: ${{ inputs.builder }} + + defaults: + run: + shell: bash + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: run + env: + BEFORE_REF: ${{ inputs.before_ref }} + AFTER_REF: ${{ inputs.after_ref }} + run: | + git config --global --add safe.directory "$GITHUB_WORKSPACE" + changed_files="$(git diff --name-only ${BEFORE_REF} ${AFTER_REF} apps/emqx)" + if [ "$changed_files" = '' ]; then + echo "nothing changed in apps/emqx, ignored." + exit 0 + fi + make ensure-rebar3 + cp rebar3 apps/emqx/ + cd apps/emqx + ./rebar3 xref + ./rebar3 dialyzer + ./rebar3 eunit -v + ./rebar3 ct --name 'test@127.0.0.1' -v --readable=true + ./rebar3 proper -d test/props + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: logs-${{ inputs.runner }} + path: apps/emqx/_build/test/logs