1- name : CI Unit
1+ name : CI Unit (A-M)
22on : [pull_request]
33
44concurrency :
55 group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
66 cancel-in-progress : true
77
88jobs :
9- # =========================================================
10- # 1. DISCOVERY (Outputs up to 256 packages globally)
11- # =========================================================
129 discover :
1310 runs-on : ubuntu-latest
1411 outputs :
@@ -18,21 +15,20 @@ jobs:
1815 - id : changes
1916 uses : tj-actions/changed-files@v44
2017 with :
21- files : packages/**
18+ # NATIVE SHARDING: Only grab the first half of the alphabet.
19+ # Note: Adjust the prefix if all packages start with "google-cloud-"
20+ files : packages/google-cloud-[a-m]*/**
2221 dir_names : true
2322 dir_names_max_depth : 2
2423 matrix : true
2524
26- # =========================================================
27- # 2. EXECUTION (1 Job = 1 Package)
28- # =========================================================
2925 unit :
3026 needs : discover
3127 if : ${{ needs.discover.outputs.packages != '[]' && needs.discover.outputs.packages != '' }}
3228 runs-on : ubuntu-latest
3329 strategy :
3430 fail-fast : false
35- max-parallel : 40 # Org limit protection
31+ max-parallel : 20 # Protects the org limit
3632 matrix :
3733 package : ${{ fromJSON(needs.discover.outputs.packages) }}
3834
@@ -42,26 +38,14 @@ jobs:
4238 - uses : astral-sh/setup-uv@v5
4339 with :
4440 enable-cache : true
45- - name : Run Python Versions Sequentially
41+
42+ - name : Run Unit Tests
4643 run : |
4744 cd ${{ matrix.package }}
45+ if [ ! -f "noxfile.py" ]; then
46+ echo "::notice::No noxfile found in ${{ matrix.package }}. Skipping."
47+ exit 0
48+ fi
49+
4850 export NOX_DEFAULT_VENV_BACKEND=uv
49- export UV_PRERELEASE=allow
5051 uvx --with 'nox[uv]' nox -s "unit-3.9" "unit-3.10" "unit-3.11" "unit-3.12" "unit-3.14"
51-
52- # =========================================================
53- # 3. AGGREGATOR (Branch Protection Target)
54- # =========================================================
55- ci-unit-success :
56- name : Unit Tests Success
57- needs : [unit]
58- if : always()
59- runs-on : ubuntu-latest
60- steps :
61- - name : Verify matrix passed
62- run : |
63- if [ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" = "true" ]; then
64- echo "::error::One or more unit tests failed."
65- exit 1
66- fi
67- echo "All unit tests passed!"
0 commit comments