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: builder: required: true type: string before_ref: required: true type: string after_ref: required: true type: string env: IS_CI: "yes" permissions: contents: read jobs: prepare_matrix: runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }} container: ${{ inputs.builder }} defaults: run: shell: bash outputs: matrix: ${{ steps.matrix.outputs.matrix }} skip: ${{ steps.matrix.outputs.skip }} steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-depth: 0 - name: prepare test matrix id: matrix 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." echo 'matrix=[]' | tee -a $GITHUB_OUTPUT echo 'skip=true' | tee -a $GITHUB_OUTPUT exit 0 else echo 'skip=false' | tee -a $GITHUB_OUTPUT echo 'matrix=[{"type": "eunit_proper_and_static"},{"type": "1_3"},{"type": "2_3"},{"type": "3_3"}]' | tee -a $GITHUB_OUTPUT fi run_emqx_app_tests: if: needs.prepare_matrix.outputs.skip != 'true' needs: - prepare_matrix runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }} container: ${{ inputs.builder }} strategy: fail-fast: false matrix: include: ${{ fromJson(needs.prepare_matrix.outputs.matrix) }} defaults: run: shell: bash steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-depth: 0 - name: run run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" make ensure-rebar3 cp rebar3 apps/emqx/ cd apps/emqx if [[ ${{ matrix.type }} == "eunit_proper_and_static" ]]; then ./rebar3 xref ./rebar3 dialyzer ./rebar3 eunit -v --name 'eunit@127.0.0.1' ./rebar3 proper -d test/props else export SUITEGROUP=${{ matrix.type }} SUITES=$(../../scripts/find-suites.sh apps/emqx | \ sed -e 's|apps/emqx/test/||g' | \ sed -Ee 's|,?apps/emqx/integration_test/.*||g' | \ sed -e 's/\.erl//g') echo "Suites: $SUITES" ./rebar3 as standalone_test ct --name 'test@127.0.0.1' -v --readable=true --suite="$SUITES" fi - uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5 if: failure() with: name: logs-emqx-app-tests-${{ matrix.type }} path: apps/emqx/_build/test/logs retention-days: 7