name: PR Entrypoint concurrency: group: pr-entrypoint-${{ github.event_name }}-${{ github.ref }} cancel-in-progress: true on: pull_request: workflow_dispatch: inputs: ref: required: false defaults: run: shell: bash env: IS_CI: "yes" jobs: init: runs-on: ubuntu-22.04 outputs: BUILDER_VSN: ${{ steps.env.outputs.BUILDER_VSN }} OTP_VSN: ${{ steps.env.outputs.OTP_VSN }} ELIXIR_VSN: ${{ steps.env.outputs.ELIXIR_VSN }} BUILDER: ${{ steps.env.outputs.BUILDER }} steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: ref: ${{ github.event.inputs.ref }} - name: Set up environment id: env run: | source ./env.sh echo "BUILDER_VSN=$EMQX_BUILDER_VSN" | tee -a "$GITHUB_OUTPUT" echo "OTP_VSN=$OTP_VSN" | tee -a "$GITHUB_OUTPUT" echo "ELIXIR_VSN=$ELIXIR_VSN" | tee -a "$GITHUB_OUTPUT" echo "BUILDER=$EMQX_BUILDER" | tee -a "$GITHUB_OUTPUT" sanity-checks: runs-on: ubuntu-22.04 needs: init container: ${{ needs.init.outputs.BUILDER }} outputs: ct-matrix: ${{ steps.matrix.outputs.ct-matrix }} ct-host: ${{ steps.matrix.outputs.ct-host }} ct-docker: ${{ steps.matrix.outputs.ct-docker }} permissions: contents: read steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: ref: ${{ github.event.inputs.ref }} fetch-depth: 0 - name: Work around https://github.com/actions/checkout/issues/766 run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Run gitlint env: BEFORE_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} AFTER_REF: ${{ github.sha }} run: | pip install --require-hashes -r .ci/gitlint.requirements.txt gitlint --commits $BEFORE_REF..$AFTER_REF --config .github/workflows/.gitlint - name: Run shellcheck run: | DEBIAN_FRONTEND=noninteractive apt-get update -qy && apt-get install -qy shellcheck ./scripts/shellcheck.sh - name: Run shell tests run: | DEBIAN_FRONTEND=noninteractive apt-get update -qy && apt-get install -qy shelltestrunner scripts/shelltest/run_tests.sh - name: Check workflow files env: ACTIONLINT_VSN: 1.6.25 run: | wget -q https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VSN}/actionlint_${ACTIONLINT_VSN}_linux_$(dpkg --print-architecture).tar.gz -O actionlint.tar.gz tar zxf actionlint.tar.gz actionlint # TODO: enable shellcheck when all the current issues are fixed ./actionlint -color \ -shellcheck= \ -ignore 'label ".+" is unknown' \ -ignore 'value "emqx-enterprise" in "exclude"' \ -ignore 'value "emqx-enterprise-elixir" in "exclude"' - name: Check line-break at EOF run: | ./scripts/check-nl-at-eof.sh - name: Check apps version run: | ./scripts/apps-version-check.sh - name: Setup mix env: MIX_ENV: emqx-enterprise PROFILE: emqx-enterprise run: | # mix local.hex --force --if-missing && mix local.rebar --force --if-missing mix local.hex 2.0.6 --force --if-missing && mix local.rebar --force --if-missing - name: Check formatting env: MIX_ENV: emqx-enterprise PROFILE: emqx-enterprise run: | ./scripts/check-format.sh - name: Run elvis check run: | ./scripts/elvis-check.sh $GITHUB_BASE_REF - name: Generate CT Matrix id: matrix run: | MATRIX="$(./scripts/find-apps.sh --ci)" echo "${MATRIX}" | jq CT_MATRIX="$(echo "${MATRIX}" | jq -c 'map({profile}) | unique')" CT_HOST="$(echo "${MATRIX}" | jq -c 'map(select(.runner == "host"))')" CT_DOCKER="$(echo "${MATRIX}" | jq -c 'map(select(.runner == "docker"))')" echo "ct-matrix=${CT_MATRIX}" | tee -a $GITHUB_OUTPUT echo "ct-host=${CT_HOST}" | tee -a $GITHUB_OUTPUT echo "ct-docker=${CT_DOCKER}" | tee -a $GITHUB_OUTPUT compile: runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral-xl","linux","x64"]') }} container: ${{ needs.init.outputs.BUILDER }} needs: - init - sanity-checks strategy: matrix: profile: - emqx - emqx-enterprise permissions: contents: read steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-depth: 0 - name: Work around https://github.com/actions/checkout/issues/766 run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" - id: compile env: PROFILE: ${{ matrix.profile }} ENABLE_COVER_COMPILE: 1 run: | make ensure-rebar3 make ${PROFILE}-compile test-compile echo "PROFILE=${PROFILE}" | tee -a .env echo "PKG_VSN=$(./pkg-vsn.sh ${PROFILE})" | tee -a .env zip -ryq -x@.github/workflows/.zipignore $PROFILE.zip . - uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5 with: name: ${{ matrix.profile }} path: ${{ matrix.profile }}.zip retention-days: 7 run_emqx_app_tests: needs: - init - sanity-checks - compile uses: ./.github/workflows/run_emqx_app_tests.yaml with: builder: ${{ needs.init.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: - init - sanity-checks - compile uses: ./.github/workflows/run_test_cases.yaml with: builder: ${{ needs.init.outputs.BUILDER }} ct-matrix: ${{ needs.sanity-checks.outputs.ct-matrix }} ct-host: ${{ needs.sanity-checks.outputs.ct-host }} ct-docker: ${{ needs.sanity-checks.outputs.ct-docker }} static_checks: needs: - init - sanity-checks - compile uses: ./.github/workflows/static_checks.yaml with: builder: ${{ needs.init.outputs.BUILDER }} ct-matrix: ${{ needs.sanity-checks.outputs.ct-matrix }} build_slim_packages: needs: - sanity-checks uses: ./.github/workflows/build_slim_packages.yaml build_docker_for_test: needs: - init - sanity-checks uses: ./.github/workflows/build_docker_for_test.yaml spellcheck: needs: - sanity-checks - build_slim_packages uses: ./.github/workflows/spellcheck.yaml run_conf_tests: needs: - init - sanity-checks - compile uses: ./.github/workflows/run_conf_tests.yaml with: builder: ${{ needs.init.outputs.BUILDER }} check_deps_integrity: needs: - init - sanity-checks uses: ./.github/workflows/check_deps_integrity.yaml with: builder: ${{ needs.init.outputs.BUILDER }} run_jmeter_tests: needs: - sanity-checks - build_docker_for_test uses: ./.github/workflows/run_jmeter_tests.yaml run_docker_tests: needs: - sanity-checks - build_docker_for_test uses: ./.github/workflows/run_docker_tests.yaml run_helm_tests: needs: - sanity-checks - build_docker_for_test uses: ./.github/workflows/run_helm_tests.yaml