1- name : Next-Gen CI Prototype
1+ name : Next-Gen CI Pipeline
22
33on :
44 pull_request :
5- branches : [ main ]
5+ branches : [ main, preview ]
6+ # Native Merge Queue support for O(1) batching
7+ merge_group :
8+ types : [checks_requested]
69
7- # 1. CONCURRENCY: Stop burning money on abandoned commits
10+ # Stop burning money on abandoned iterative commits
811concurrency :
912 group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1013 cancel-in-progress : true
1114
1215jobs :
16+ # ==========================================
17+ # 1. DISCOVERY ENGINE (The Router)
18+ # ==========================================
1319 discover :
1420 runs-on : ubuntu-latest
1521 outputs :
@@ -23,45 +29,142 @@ jobs:
2329 id : changes
2430 uses : tj-actions/changed-files@v44
2531 with :
26- files : packages/** # Only watch the packages directory
27- dir_names : true # Return folder names, not files
28- dir_names_max_depth : 2 # Output format: "packages/google-cloud-storage"
29- json : true # Output a perfect JSON array for the matrix
32+ files : packages/**
33+ dir_names : true
34+ dir_names_max_depth : 2
35+ json : true
3036 escape_json : false
3137
32- # 3. EXECUTION: Native Fan-out Matrix
33- unit-test :
38+ # ==========================================
39+ # 2. STATIC ANALYSIS (Grouped for Speed)
40+ # ==========================================
41+ static-checks :
3442 needs : discover
3543 if : ${{ needs.discover.outputs.packages != '[]' }}
3644 runs-on : ubuntu-latest
3745 strategy :
38- fail-fast : false # Don't kill the whole matrix if one package fails
46+ fail-fast : false
3947 matrix :
4048 package : ${{ fromJSON(needs.discover.outputs.packages) }}
41- # Risk-Tiering: Smoke test on presubmit to save money
42- python : ["3.11"]
43-
4449 steps :
4550 - uses : actions/checkout@v4
51+ - uses : astral-sh/setup-uv@v5
52+ with :
53+ python-version : " 3.14"
54+ enable-cache : true
55+ cache-dependency-glob : " ${{ matrix.package }}/setup.py"
56+
57+ - name : Run Lint and MyPy
58+ run : |
59+ cd ${{ matrix.package }}
60+ export NOX_DEFAULT_VENV_BACKEND=uv
61+ # Chaining sessions executes them in a single fast VM
62+ uvx --with 'nox[uv]' nox -s lint mypy lint_setup_py
4663
47- # 4. THE ENGINE SWAP: Rust-based uv instead of setup-python + pip
48- - name : Install uv and Python
49- uses : astral-sh/setup-uv@v5
64+ # ==========================================
65+ # 3. DOCUMENTATION BUILD
66+ # ==========================================
67+ docs-build :
68+ needs : discover
69+ if : ${{ needs.discover.outputs.packages != '[]' }}
70+ runs-on : ubuntu-latest
71+ strategy :
72+ fail-fast : false
73+ matrix :
74+ package : ${{ fromJSON(needs.discover.outputs.packages) }}
75+ steps :
76+ - uses : actions/checkout@v4
77+ - uses : astral-sh/setup-uv@v5
78+ with :
79+ python-version : " 3.10"
80+ enable-cache : true
81+ cache-dependency-glob : " ${{ matrix.package }}/setup.py"
82+
83+ - name : Build Docs and DocFX
84+ run : |
85+ cd ${{ matrix.package }}
86+ export NOX_DEFAULT_VENV_BACKEND=uv
87+ uvx --with 'nox[uv]' nox -s docs docfx
88+
89+ # ==========================================
90+ # 4. UNIT TESTS (The 2D Multiplier Matrix)
91+ # ==========================================
92+ unit-tests :
93+ needs : discover
94+ if : ${{ needs.discover.outputs.packages != '[]' }}
95+ runs-on : ubuntu-latest
96+ strategy :
97+ fail-fast : false
98+ matrix :
99+ package : ${{ fromJSON(needs.discover.outputs.packages) }}
100+ python : ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
101+ steps :
102+ - uses : actions/checkout@v4
103+ - uses : astral-sh/setup-uv@v5
50104 with :
51105 python-version : ${{ matrix.python }}
52106 enable-cache : true
53- # Rely on the full path provided by tj-actions
54107 cache-dependency-glob : " ${{ matrix.package }}/setup.py"
55108
56- - name : Execute Tests (High-Density)
109+ - name : Execute Unit Tests
57110 run : |
58- # Step into the exact directory output by the matrix
59111 cd ${{ matrix.package }}
60-
61- # Force Nox to natively use uv instead of the legacy virtualenv module
62112 export NOX_DEFAULT_VENV_BACKEND=uv
113+ uvx --with 'nox[uv]' nox -s unit-${{ matrix.python }}
114+
115+ # ==========================================
116+ # 5. SYSTEM TESTS
117+ # ==========================================
118+ system-tests :
119+ needs : discover
120+ if : ${{ needs.discover.outputs.packages != '[]' }}
121+ runs-on : ubuntu-latest
122+ strategy :
123+ fail-fast : false
124+ matrix :
125+ package : ${{ fromJSON(needs.discover.outputs.packages) }}
126+ python : ["3.11"]
127+ steps :
128+ - uses : actions/checkout@v4
129+ - uses : astral-sh/setup-uv@v5
130+ with :
131+ python-version : ${{ matrix.python }}
132+ enable-cache : true
133+ cache-dependency-glob : " ${{ matrix.package }}/setup.py"
134+
135+ - name : Execute System Tests
136+ env :
137+ RUN_SYSTEM_TESTS : " true"
138+ run : |
139+ cd ${{ matrix.package }}
140+ export NOX_DEFAULT_VENV_BACKEND=uv
141+ uvx --with 'nox[uv]' nox -s system
142+
143+ # ==========================================
144+ # 6. THE GATEKEEPER (Status Check Rollup)
145+ # ==========================================
146+ presubmit-passed :
147+ # Always runs so GitHub can definitively mark the PR as passed/failed
148+ if : always()
149+ needs :
150+ - discover
151+ - static-checks
152+ - docs-build
153+ - unit-tests
154+ - system-tests
155+ runs-on : ubuntu-latest
156+ steps :
157+ - name : Evaluate Pipeline Status
158+ run : |
159+ if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
160+ echo "::error::One or more required CI jobs failed or were cancelled."
161+ exit 1
162+ fi
63163
64- echo "Running targeted tests for ${{ matrix.package }} on Python ${{ matrix.python }}"
164+ # If the router output was empty, it means no Python code changed.
165+ if [[ "${{ needs.discover.outputs.packages }}" == "[]" ]]; then
166+ echo "No Python packages changed. Safely bypassing execution."
167+ exit 0
168+ fi
65169
66- # Use uvx to run nox (with the uv plugin injected to guarantee compatibility)
67- uvx --with 'nox[uv]' nox -s unit-${{ matrix.python }}
170+ echo "All dynamically generated CI jobs completed successfully."
0 commit comments