From 94239d98dfaead8c80bc08b1c039e849d1996ef8 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Wed, 27 Apr 2022 13:16:03 +0200 Subject: [PATCH] ci: no need to test apps/emqx if nothing changed in this sub-dir --- .github/workflows/run_emqx_app_tests.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run_emqx_app_tests.yaml b/.github/workflows/run_emqx_app_tests.yaml index 8f02417f8..8f9b9133f 100644 --- a/.github/workflows/run_emqx_app_tests.yaml +++ b/.github/workflows/run_emqx_app_tests.yaml @@ -30,11 +30,17 @@ jobs: arch: - amd64 - runs-on: ubuntu-20.04 + runs-on: aws-amd64 container: "ghcr.io/emqx/emqx-builder/5.0-10:${{ matrix.elixir}}-${{ matrix.otp }}-${{ matrix.os }}" + defaults: + run: + shell: bash + steps: - uses: actions/checkout@v2 + with: + fetch-depth: 0 - name: Get deps git refs for cache id: deps-refs run: | @@ -47,6 +53,18 @@ jobs: key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }} - name: run run: | + echo "git diff base: $GITHUB_BASE_REF" + if [[ "$GITHUB_BASE_REF" =~ [0-9a-f]{8,40} ]]; then + # base is a commit sha1 + compare_base="$GITHUB_BASE_REF" + else + compare_base="origin/$GITHUB_BASE_REF" + fi + changed_files="$(git diff --name-only ${compare_base}...HEAD 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