From de04be4cfe8541be7d32d663d3cfd5c3ac140bd5 Mon Sep 17 00:00:00 2001 From: Tom Ratcliffe Date: Fri, 15 Aug 2025 13:27:37 +0100 Subject: [PATCH] Chore: Skip database integration tests when files are not changed (#103923) --- .github/workflows/pr-test-integration.yml | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/pr-test-integration.yml b/.github/workflows/pr-test-integration.yml index 3fe89523a45..6a2bb5cede7 100644 --- a/.github/workflows/pr-test-integration.yml +++ b/.github/workflows/pr-test-integration.yml @@ -18,7 +18,27 @@ concurrency: permissions: {} jobs: + detect-changes: + name: Detect whether code changed + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + changed: ${{ steps.detect-changes.outputs.backend }} + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: true # required to get more history in the changed-files action + fetch-depth: 2 + - name: Detect changes + id: detect-changes + uses: ./.github/actions/change-detection + with: + self: .github/workflows/pr-test-integration.yml + sqlite: + needs: detect-changes + if: needs.detect-changes.outputs.changed == 'true' strategy: matrix: shard: [ @@ -49,6 +69,8 @@ jobs: readarray -t PACKAGES <<< "$(./scripts/ci/backend-tests/pkgs-with-tests-named.sh -b TestIntegration | ./scripts/ci/backend-tests/shard.sh -N"$SHARD" -d-)" go test -tags=sqlite -timeout=8m -run '^TestIntegration' "${PACKAGES[@]}" mysql: + needs: detect-changes + if: needs.detect-changes.outputs.changed == 'true' strategy: matrix: shard: [ @@ -95,6 +117,8 @@ jobs: readarray -t PACKAGES <<< "$(./scripts/ci/backend-tests/pkgs-with-tests-named.sh -b TestIntegration | ./scripts/ci/backend-tests/shard.sh -N"$SHARD" -d-)" CGO_ENABLED=0 go test -p=1 -tags=mysql -timeout=8m -run '^TestIntegration' "${PACKAGES[@]}" postgres: + needs: detect-changes + if: needs.detect-changes.outputs.changed == 'true' strategy: matrix: shard: [