@@ -11,6 +11,37 @@ concurrency:
1111 cancel-in-progress : true
1212
1313jobs :
14+ changes :
15+ name : Detect changed paths
16+ runs-on : ubuntu-latest
17+ outputs :
18+ rust : ${{ steps.filter.outputs.rust }}
19+ python : ${{ steps.filter.outputs.python }}
20+ steps :
21+ - name : Check out repository
22+ uses : actions/checkout@v6
23+
24+ - name : Filter paths
25+ id : filter
26+ uses : dorny/paths-filter@v3
27+ with :
28+ filters : |
29+ rust:
30+ - 'crates/**'
31+ - 'Cargo.toml'
32+ - 'Cargo.lock'
33+ - 'rust-toolchain.toml'
34+ - '.github/workflows/ci.yml'
35+ python:
36+ - 'py_src/**'
37+ - 'tests/python/**'
38+ - 'pyproject.toml'
39+ - 'uv.lock'
40+ - 'crates/**'
41+ - 'Cargo.toml'
42+ - 'Cargo.lock'
43+ - '.github/workflows/ci.yml'
44+
1445 lint :
1546 name : Lint & Static Analysis
1647 runs-on : ubuntu-latest
5788
5889 rust-test :
5990 name : Rust Tests (SQLite)
91+ needs : changes
92+ if : needs.changes.outputs.rust == 'true' || github.event_name == 'push'
6093 runs-on : ubuntu-latest
6194 steps :
6295 - name : Check out repository
85118
86119 rust-test-postgres :
87120 name : Rust Tests (PostgreSQL)
121+ needs : changes
122+ if : needs.changes.outputs.rust == 'true' || github.event_name == 'push'
88123 runs-on : ubuntu-latest
89124 services :
90125 postgres :
@@ -125,6 +160,8 @@ jobs:
125160
126161 rust-test-redis :
127162 name : Rust Tests (Redis)
163+ needs : changes
164+ if : needs.changes.outputs.rust == 'true' || github.event_name == 'push'
128165 runs-on : ubuntu-latest
129166 services :
130167 redis :
@@ -161,7 +198,8 @@ jobs:
161198
162199 test :
163200 name : Python Tests (${{ matrix.os }} / Python ${{ matrix.python-version }})
164- needs : lint
201+ needs : [lint, changes]
202+ if : needs.changes.outputs.python == 'true' || github.event_name == 'push'
165203 runs-on : ${{ matrix.os }}
166204 strategy :
167205 matrix :
@@ -229,3 +267,24 @@ jobs:
229267 fi
230268 exit $PYTEST_EXIT
231269 shell : bash
270+
271+ ci-status :
272+ name : CI status
273+ if : always()
274+ needs : [lint, rust-test, rust-test-postgres, rust-test-redis, test]
275+ runs-on : ubuntu-latest
276+ steps :
277+ - name : Check that no required job failed
278+ run : |
279+ results='${{ toJson(needs) }}'
280+ echo "$results"
281+ fail=$(echo "$results" | python3 -c "
282+ import json, sys
283+ data = json.load(sys.stdin)
284+ bad = [k for k, v in data.items() if v['result'] not in ('success', 'skipped')]
285+ print(','.join(bad))
286+ ")
287+ if [ -n "$fail" ]; then
288+ echo "::error::Failing or cancelled jobs: $fail"
289+ exit 1
290+ fi
0 commit comments