Skip to content

Commit dfb06af

Browse files
perf(ci): skip intensive tests for non-code PR changes
Add a check-code-changes job that detects whether a PR contains actual code changes or only CI/docs/config files (.github/, .claude/, .cursor/, docs/, README, LICENSE, etc.). When no code changes are detected, the following jobs are skipped: - vulnerability-scan (5 Python versions) - qa-checks-and-unit-tests (5 Python versions) - integration-tests (per-file matrix) - async-integration-tests (per-file matrix) Manual workflow_dispatch always runs everything. PRs with the run-async-tests label still trigger async tests as before.
1 parent a3e43f4 commit dfb06af

1 file changed

Lines changed: 45 additions & 5 deletions

File tree

.github/workflows/pyatlan-pr.yaml

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,45 @@ on:
1212
workflow_dispatch:
1313

1414
jobs:
15+
check-code-changes:
16+
runs-on: ubuntu-latest
17+
outputs:
18+
has-code-changes: ${{ steps.filter.outputs.has-code-changes }}
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Detect code changes
26+
id: filter
27+
run: |
28+
# For workflow_dispatch, always run everything
29+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
30+
echo "has-code-changes=true" >> $GITHUB_OUTPUT
31+
echo "Manual trigger: running all tests"
32+
exit 0
33+
fi
34+
35+
# Get changed files
36+
CHANGED=$(git diff --name-only origin/${{ github.event.pull_request.base.ref }}...HEAD)
37+
38+
# Check if any changed file is actual code (not just CI/docs/config)
39+
CODE_CHANGES=$(echo "$CHANGED" | grep -vE '^\.(github|claude|cursor)/|^docs/|^site/|^README|^HISTORY|^LICENSE|^NOTICE|^CODE_OF_CONDUCT|^CONTRIBUTING|^CLAUDE\.md|^\.gitignore|^\.pre-commit|^\.editorconfig|^mkdocs' || true)
40+
41+
if [ -n "$CODE_CHANGES" ]; then
42+
echo "has-code-changes=true" >> $GITHUB_OUTPUT
43+
echo "Code changes detected:"
44+
echo "$CODE_CHANGES" | head -20
45+
else
46+
echo "has-code-changes=false" >> $GITHUB_OUTPUT
47+
echo "No code changes detected, only CI/docs/config files:"
48+
echo "$CHANGED"
49+
fi
50+
1551
vulnerability-scan:
52+
needs: [check-code-changes]
53+
if: needs.check-code-changes.outputs.has-code-changes == 'true'
1654
runs-on: ubuntu-latest
1755
strategy:
1856
matrix:
@@ -80,7 +118,8 @@ jobs:
80118
fi
81119
82120
qa-checks-and-unit-tests:
83-
needs: [vulnerability-scan]
121+
needs: [check-code-changes, vulnerability-scan]
122+
if: needs.check-code-changes.outputs.has-code-changes == 'true'
84123
runs-on: ubuntu-latest
85124
outputs:
86125
files: ${{ steps.distribute-integration-test-files.outputs.files }}
@@ -141,7 +180,8 @@ jobs:
141180
fi
142181
143182
integration-tests:
144-
needs: [vulnerability-scan, qa-checks-and-unit-tests]
183+
needs: [check-code-changes, vulnerability-scan, qa-checks-and-unit-tests]
184+
if: needs.check-code-changes.outputs.has-code-changes == 'true'
145185
runs-on: ubuntu-latest
146186
strategy:
147187
fail-fast: false
@@ -181,10 +221,10 @@ jobs:
181221

182222

183223
async-integration-tests:
184-
needs: [vulnerability-scan, qa-checks-and-unit-tests, check-aio-changes]
224+
needs: [check-code-changes, vulnerability-scan, qa-checks-and-unit-tests, check-aio-changes]
185225
runs-on: ubuntu-latest
186-
# Only run if AIO changes detected or manual trigger
187-
if: needs.check-aio-changes.outputs.run-async-tests == 'true'
226+
# Only run if code changed AND (AIO changes detected or manual trigger)
227+
if: needs.check-code-changes.outputs.has-code-changes == 'true' && needs.check-aio-changes.outputs.run-async-tests == 'true'
188228
strategy:
189229
fail-fast: false
190230
matrix:

0 commit comments

Comments
 (0)