Skip to content

Commit 36f1031

Browse files
committed
chore: Skip Code CI for non code changes
1 parent c0dc571 commit 36f1031

6 files changed

Lines changed: 167 additions & 17 deletions

File tree

.asf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ github:
5858
- "Check Markdown Links"
5959
- "Validate required_status_checks in .asf.yaml"
6060
- "Spell Check with Typos"
61+
- "Detect changes"
6162
- "Circular Dependency Check"
6263
- "Detect Unused Dependencies"
6364
- "linux build test"

.github/workflows/breaking_changes_detector.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ on:
4545
pull_request:
4646
branches:
4747
- main
48+
paths-ignore:
49+
- "docs/**"
50+
- "**.md"
51+
- ".github/ISSUE_TEMPLATE/**"
52+
- ".github/pull_request_template.md"
4853

4954
permissions:
5055
contents: read

.github/workflows/codeql.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ on:
2323
branches: [ "main" ]
2424
pull_request:
2525
branches: [ "main" ]
26+
paths-ignore:
27+
- "docs/**"
28+
- "**.md"
29+
- ".github/ISSUE_TEMPLATE/**"
30+
- ".github/pull_request_template.md"
2631
schedule:
2732
- cron: '16 4 * * 1'
2833

.github/workflows/dependencies.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,57 @@ permissions:
3535
contents: read
3636

3737
jobs:
38+
detect-changes:
39+
name: Detect changes
40+
runs-on: ubuntu-latest
41+
outputs:
42+
has_code: ${{ steps.filter.outputs.has_code }}
43+
steps:
44+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
45+
with:
46+
fetch-depth: 0
47+
- id: filter
48+
env:
49+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
50+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
51+
# Skip code CI on PRs whose changed files all match one of these
52+
# globs (only dev.yml / docs*.yaml jobs run in that case).
53+
#
54+
# To add a new entry: append a line below with a glob pattern.
55+
# Syntax matches `pull_request: paths-ignore:` — `**` = any depth,
56+
# `*` = any chars within one path segment. Examples:
57+
# foo/bar.txt a single specific file
58+
# subdir/** everything under subdir/
59+
# **.png any .png file at any depth
60+
# **/CHANGELOG.md CHANGELOG.md in any directory
61+
IGNORE_CODE_CI_FOR_PATHS: |
62+
docs/**
63+
**.md
64+
.github/ISSUE_TEMPLATE/**
65+
.github/pull_request_template.md
66+
run: |
67+
# Fail-open: if anything goes wrong, default to running every job
68+
# rather than silently skipping (which would let broken CI merge).
69+
set +e
70+
if [ -z "$BASE_SHA" ]; then
71+
echo "has_code=true" >> "$GITHUB_OUTPUT"; exit 0
72+
fi
73+
excludes=()
74+
while IFS= read -r pattern; do
75+
[ -n "$pattern" ] && excludes+=( ":(exclude,glob)$pattern" )
76+
done <<< "$IGNORE_CODE_CI_FOR_PATHS"
77+
diff_output=$(git diff --name-only "$BASE_SHA..$HEAD_SHA" -- "${excludes[@]}")
78+
if [ -n "$diff_output" ]; then
79+
echo "has_code=true" >> "$GITHUB_OUTPUT"
80+
else
81+
echo "has_code=false" >> "$GITHUB_OUTPUT"
82+
fi
83+
exit 0
84+
3885
depcheck:
3986
name: Circular Dependency Check
87+
needs: detect-changes
88+
if: needs.detect-changes.outputs.has_code == 'true'
4089
runs-on: ubuntu-latest
4190
container:
4291
image: amd64/rust
@@ -56,6 +105,8 @@ jobs:
56105
57106
detect-unused-dependencies:
58107
name: Detect Unused Dependencies
108+
needs: detect-changes
109+
if: needs.detect-changes.outputs.has_code == 'true'
59110
runs-on: ubuntu-latest
60111
container:
61112
image: amd64/rust

.github/workflows/large_files.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ concurrency:
2323

2424
on:
2525
pull_request:
26+
paths-ignore:
27+
- "docs/**"
28+
- "**.md"
29+
- ".github/ISSUE_TEMPLATE/**"
30+
- ".github/pull_request_template.md"
2631
merge_group:
2732

2833
permissions:

.github/workflows/rust.yml

Lines changed: 100 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,65 @@ permissions:
4343
contents: read
4444

4545
jobs:
46+
# Detect whether the PR contains any non-doc changes; gate every other
47+
# job in this workflow so md-only PRs report all required checks as
48+
# `skipped` instead of leaving them in "Expected"/pending and blocking merge.
49+
detect-changes:
50+
name: Detect changes
51+
runs-on: ubuntu-latest
52+
outputs:
53+
has_code: ${{ steps.filter.outputs.has_code }}
54+
steps:
55+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
56+
with:
57+
fetch-depth: 0
58+
- id: filter
59+
env:
60+
BASE_SHA: ${{ github.event.pull_request.base.sha }}
61+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
62+
# Skip code CI on PRs whose changed files all match one of these
63+
# globs (only dev.yml / docs*.yaml jobs run in that case).
64+
#
65+
# To add a new entry: append a line below with a glob pattern.
66+
# Syntax matches `pull_request: paths-ignore:` — `**` = any depth,
67+
# `*` = any chars within one path segment. Examples:
68+
# foo/bar.txt a single specific file
69+
# subdir/** everything under subdir/
70+
# **.png any .png file at any depth
71+
# **/CHANGELOG.md CHANGELOG.md in any directory
72+
IGNORE_CODE_CI_FOR_PATHS: |
73+
docs/**
74+
**.md
75+
.github/ISSUE_TEMPLATE/**
76+
.github/pull_request_template.md
77+
run: |
78+
# Fail-open: if anything goes wrong, default to running every job
79+
# rather than silently skipping (which would let broken CI merge).
80+
set +e
81+
if [ -z "$BASE_SHA" ]; then
82+
echo "has_code=true" >> "$GITHUB_OUTPUT"; exit 0
83+
fi
84+
# Translate IGNORE_CODE_CI_FOR_PATHS (one glob per line) into git
85+
# pathspec excludes; `:(exclude,glob)` activates ** globbing.
86+
excludes=()
87+
while IFS= read -r pattern; do
88+
[ -n "$pattern" ] && excludes+=( ":(exclude,glob)$pattern" )
89+
done <<< "$IGNORE_CODE_CI_FOR_PATHS"
90+
# If anything remains after stripping ignored paths, the PR has
91+
# real code changes and code CI should run.
92+
diff_output=$(git diff --name-only "$BASE_SHA..$HEAD_SHA" -- "${excludes[@]}")
93+
if [ -n "$diff_output" ]; then
94+
echo "has_code=true" >> "$GITHUB_OUTPUT"
95+
else
96+
echo "has_code=false" >> "$GITHUB_OUTPUT"
97+
fi
98+
exit 0
99+
46100
# Check crate compiles and base cargo check passes
47101
linux-build-lib:
48102
name: linux build test
103+
needs: detect-changes
104+
if: needs.detect-changes.outputs.has_code == 'true'
49105
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=8,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
50106
container:
51107
image: amd64/rust
@@ -74,7 +130,8 @@ jobs:
74130
# subset of the features packages enabled.
75131
linux-datafusion-common-features:
76132
name: cargo check datafusion-common features
77-
needs: linux-build-lib
133+
needs: [linux-build-lib, detect-changes]
134+
if: needs.detect-changes.outputs.has_code == 'true'
78135
runs-on: ubuntu-latest
79136
container:
80137
image: amd64/rust
@@ -99,7 +156,8 @@ jobs:
99156
# subset of the features packages enabled.
100157
linux-datafusion-substrait-features:
101158
name: cargo check datafusion-substrait features
102-
needs: linux-build-lib
159+
needs: [linux-build-lib, detect-changes]
160+
if: needs.detect-changes.outputs.has_code == 'true'
103161
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
104162
container:
105163
image: amd64/rust
@@ -136,7 +194,8 @@ jobs:
136194
# subset of the features packages enabled.
137195
linux-datafusion-proto-features:
138196
name: cargo check datafusion-proto features
139-
needs: linux-build-lib
197+
needs: [linux-build-lib, detect-changes]
198+
if: needs.detect-changes.outputs.has_code == 'true'
140199
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
141200
container:
142201
image: amd64/rust
@@ -168,7 +227,8 @@ jobs:
168227
# subset of the features packages enabled.
169228
linux-cargo-check-datafusion:
170229
name: cargo check datafusion features
171-
needs: linux-build-lib
230+
needs: [linux-build-lib, detect-changes]
231+
if: needs.detect-changes.outputs.has_code == 'true'
172232
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
173233
container:
174234
image: amd64/rust
@@ -234,7 +294,8 @@ jobs:
234294
# subset of the features packages enabled.
235295
linux-cargo-check-datafusion-functions:
236296
name: cargo check datafusion-functions features
237-
needs: linux-build-lib
297+
needs: [linux-build-lib, detect-changes]
298+
if: needs.detect-changes.outputs.has_code == 'true'
238299
runs-on: ubuntu-latest
239300
container:
240301
image: amd64/rust
@@ -269,7 +330,8 @@ jobs:
269330
# Library and integration tests
270331
linux-test:
271332
name: cargo test (amd64)
272-
needs: linux-build-lib
333+
needs: [linux-build-lib, detect-changes]
334+
if: needs.detect-changes.outputs.has_code == 'true'
273335
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
274336
container:
275337
image: amd64/rust
@@ -319,7 +381,8 @@ jobs:
319381
# datafusion-cli tests
320382
linux-test-datafusion-cli:
321383
name: cargo test datafusion-cli (amd64)
322-
needs: linux-build-lib
384+
needs: [linux-build-lib, detect-changes]
385+
if: needs.detect-changes.outputs.has_code == 'true'
323386
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
324387
steps:
325388
- uses: runs-on/action@d141ef83eb66d096ce8afc767e09115a65c63b60 # v2.1.2
@@ -349,7 +412,8 @@ jobs:
349412

350413
linux-test-example:
351414
name: cargo examples (amd64)
352-
needs: linux-build-lib
415+
needs: [linux-build-lib, detect-changes]
416+
if: needs.detect-changes.outputs.has_code == 'true'
353417
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
354418
container:
355419
image: amd64/rust
@@ -380,7 +444,8 @@ jobs:
380444
# Run `cargo test doc` (test documentation examples)
381445
linux-test-doc:
382446
name: cargo test doc (amd64)
383-
needs: linux-build-lib
447+
needs: [linux-build-lib, detect-changes]
448+
if: needs.detect-changes.outputs.has_code == 'true'
384449
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
385450
container:
386451
image: amd64/rust
@@ -402,7 +467,8 @@ jobs:
402467
# Run `cargo doc` to ensure the rustdoc is clean
403468
linux-rustdoc:
404469
name: cargo doc
405-
needs: linux-build-lib
470+
needs: [linux-build-lib, detect-changes]
471+
if: needs.detect-changes.outputs.has_code == 'true'
406472
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
407473
container:
408474
image: amd64/rust
@@ -418,6 +484,8 @@ jobs:
418484

419485
linux-wasm-pack:
420486
name: build and run with wasm-pack
487+
needs: detect-changes
488+
if: needs.detect-changes.outputs.has_code == 'true'
421489
runs-on: ubuntu-24.04
422490
steps:
423491
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -443,7 +511,8 @@ jobs:
443511
# verify that the benchmark queries return the correct results
444512
verify-benchmark-results:
445513
name: verify benchmark results (amd64)
446-
needs: linux-build-lib
514+
needs: [linux-build-lib, detect-changes]
515+
if: needs.detect-changes.outputs.has_code == 'true'
447516
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
448517
container:
449518
image: amd64/rust
@@ -477,7 +546,8 @@ jobs:
477546

478547
sqllogictest-postgres:
479548
name: "Run sqllogictest with Postgres runner"
480-
needs: linux-build-lib
549+
needs: [linux-build-lib, detect-changes]
550+
if: needs.detect-changes.outputs.has_code == 'true'
481551
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
482552
container:
483553
image: amd64/rust
@@ -516,7 +586,8 @@ jobs:
516586

517587
sqllogictest-substrait:
518588
name: "Run sqllogictest in Substrait round-trip mode"
519-
needs: linux-build-lib
589+
needs: [linux-build-lib, detect-changes]
590+
if: needs.detect-changes.outputs.has_code == 'true'
520591
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
521592
container:
522593
image: amd64/rust
@@ -563,6 +634,8 @@ jobs:
563634
# flaky sqllogictest metrics.
564635
macos-aarch64:
565636
name: cargo test (macos-aarch64)
637+
needs: detect-changes
638+
if: needs.detect-changes.outputs.has_code == 'true'
566639
runs-on: macos-15
567640
steps:
568641
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
@@ -577,6 +650,8 @@ jobs:
577650

578651
vendor:
579652
name: Verify Vendored Code
653+
needs: detect-changes
654+
if: needs.detect-changes.outputs.has_code == 'true'
580655
runs-on: ubuntu-latest
581656
container:
582657
image: amd64/rust
@@ -594,6 +669,8 @@ jobs:
594669

595670
check-fmt:
596671
name: Check cargo fmt
672+
needs: detect-changes
673+
if: needs.detect-changes.outputs.has_code == 'true'
597674
runs-on: ubuntu-latest
598675
container:
599676
image: amd64/rust
@@ -651,7 +728,8 @@ jobs:
651728

652729
clippy:
653730
name: clippy
654-
needs: linux-build-lib
731+
needs: [linux-build-lib, detect-changes]
732+
if: needs.detect-changes.outputs.has_code == 'true'
655733
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
656734
container:
657735
image: amd64/rust
@@ -677,7 +755,8 @@ jobs:
677755

678756
cargo-toml-formatting-checks:
679757
name: check Cargo.toml formatting
680-
needs: linux-build-lib
758+
needs: [linux-build-lib, detect-changes]
759+
if: needs.detect-changes.outputs.has_code == 'true'
681760
runs-on: ubuntu-latest
682761
container:
683762
image: amd64/rust
@@ -698,7 +777,8 @@ jobs:
698777

699778
config-docs-check:
700779
name: check configs.md and ***_functions.md is up-to-date
701-
needs: linux-build-lib
780+
needs: [linux-build-lib, detect-changes]
781+
if: needs.detect-changes.outputs.has_code == 'true'
702782
runs-on: ${{ vars.USE_RUNS_ON == 'true' && format('runs-on={0},family=m8a+m7a+c8a,cpu=16,image=ubuntu24-full-x64,extras=s3-cache,disk=large,tag=datafusion', github.run_id) || 'ubuntu-latest' }}
703783
container:
704784
image: amd64/rust
@@ -733,7 +813,8 @@ jobs:
733813
# 3. Compares the result against the committed README.md and fails if out-of-date
734814
examples-docs-check:
735815
name: check example README is up-to-date
736-
needs: linux-build-lib
816+
needs: [linux-build-lib, detect-changes]
817+
if: needs.detect-changes.outputs.has_code == 'true'
737818
runs-on: ubuntu-latest
738819
container:
739820
image: amd64/rust
@@ -765,6 +846,8 @@ jobs:
765846
# - datafusion-cli
766847
msrv:
767848
name: Verify MSRV (Min Supported Rust Version)
849+
needs: detect-changes
850+
if: needs.detect-changes.outputs.has_code == 'true'
768851
runs-on: ubuntu-latest
769852
container:
770853
image: amd64/rust

0 commit comments

Comments
 (0)