Skip to content

Commit 2421627

Browse files
committed
only test core-deps-from-source
1 parent 274f7ac commit 2421627

1 file changed

Lines changed: 15 additions & 149 deletions

File tree

.github/workflows/experiment.yaml

Lines changed: 15 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI Unit
1+
name: CI Timeout Stress Test (Core Deps)
22
on:
33
pull_request:
44
branches: [ main, preview ]
@@ -18,7 +18,7 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v4
2020
with:
21-
fetch-depth: 2 # Required to avoid 'no merge base' errors
21+
fetch-depth: 2
2222

2323
- name: Detect Changed Packages
2424
id: changes
@@ -33,14 +33,13 @@ jobs:
3333
id: generate-matrix
3434
env:
3535
CHANGED_DIRS: ${{ steps.changes.outputs.all_changed_files }}
36-
# Multiplier 8 = (6 standard Pythons + 1 Prerelease + 1 Core Deps)
37-
run: python .github/scripts/matrix_generator.py --matrix-multiplier 8 --max-vms 20
38-
36+
# We use a multiplier of 1 because we are only running a single Python version
37+
run: python .github/scripts/gha_matrix_balancer.py --matrix-multiplier 1 --max-vms 20
3938

4039
# ==========================================
41-
# 2. STANDARD UNIT TESTS
40+
# 2. CORE DEPS TEST (Py 3.14)
4241
# ==========================================
43-
unit-tests:
42+
test-core-deps:
4443
needs: discover
4544
if: ${{ needs.discover.outputs.buckets != '[]' }}
4645
runs-on: ubuntu-latest
@@ -49,171 +48,38 @@ jobs:
4948
max-parallel: 60
5049
matrix:
5150
chunk: ${{ fromJSON(needs.discover.outputs.buckets) }}
52-
python: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
5351

54-
name: Unit (Py ${{ matrix.python }} - ${{ matrix.chunk.id }})
52+
name: core-deps (${{ matrix.chunk.id }})
5553
steps:
5654
- uses: actions/checkout@v4
5755
with:
5856
fetch-depth: 2
5957

60-
- uses: astral-sh/setup-uv@v5
61-
with:
62-
python-version: ${{ matrix.python }}
63-
enable-cache: true
64-
65-
- name: Optimize Core Dependencies
66-
run: git config --global url."${GITHUB_WORKSPACE}".insteadOf "https://github.com/googleapis/google-cloud-python"
67-
68-
- name: Execute Chunk
69-
run: |
70-
# The Engine: uv handles virtualenvs, nox delegates to uv
71-
export NOX_DEFAULT_VENV_BACKEND=uv
72-
73-
# The Fix: Forces uv to install `pip` in the venv so legacy `pip freeze` commands don't crash
74-
export UV_VENV_SEED=1
75-
76-
# Speed optimization: Pre-compile python bytecode
77-
export UV_COMPILE_BYTECODE=1
78-
79-
FAILED=0
80-
81-
for pkg in ${{ matrix.chunk.packages }}; do
82-
echo "=========================================================="
83-
echo "🚀 TESTING: $pkg (Python ${{ matrix.python }})"
84-
echo "=========================================================="
85-
cd "$pkg"
86-
87-
if uvx --with 'nox[uv]' nox -l | grep -q "unit-${{ matrix.python }}"; then
88-
uvx --with 'nox[uv]' nox -s "unit-${{ matrix.python }}" || FAILED=1
89-
else
90-
echo "⏭️ Session 'unit-${{ matrix.python }}' not defined for $pkg. Safely skipping."
91-
fi
92-
93-
cd "$GITHUB_WORKSPACE"
94-
done
95-
exit $FAILED
96-
97-
98-
# ==========================================
99-
# 3. PRERELEASE TESTS (Py 3.14)
100-
# ==========================================
101-
unit-prerelease:
102-
needs: discover
103-
if: ${{ needs.discover.outputs.buckets != '[]' }}
104-
runs-on: ubuntu-latest
105-
strategy:
106-
fail-fast: false
107-
max-parallel: 60
108-
matrix:
109-
chunk: ${{ fromJSON(needs.discover.outputs.buckets) }}
110-
111-
name: Prerelease (Py 3.14 - ${{ matrix.chunk.id }})
112-
steps:
113-
- uses: actions/checkout@v4
114-
with:
115-
fetch-depth: 2
116-
117-
- uses: astral-sh/setup-uv@v5
58+
- uses: actions/setup-python@v5
11859
with:
11960
python-version: "3.14"
120-
enable-cache: true
12161

122-
- name: Optimize Core Dependencies
123-
run: git config --global url."${GITHUB_WORKSPACE}".insteadOf "https://github.com/googleapis/google-cloud-python"
62+
- name: Install standard Nox
63+
run: python -m pip install nox
12464

12565
- name: Execute Chunk
12666
run: |
127-
export NOX_DEFAULT_VENV_BACKEND=uv
128-
export UV_VENV_SEED=1
129-
export UV_COMPILE_BYTECODE=1
13067
FAILED=0
131-
132-
# Use the exact session name Nox expects
133-
SESSION="prerelease_deps-3.14"
68+
SESSION="core_deps_from_source-3.14"
13469
13570
for pkg in ${{ matrix.chunk.packages }}; do
13671
echo "=========================================================="
137-
echo "🚀 TESTING PRERELEASE: $pkg (Python 3.14)"
72+
echo "🚀 TESTING CORE DEPS: $pkg"
13873
echo "=========================================================="
13974
cd "$pkg"
14075
141-
# NO_COLOR=1 prevents ANSI codes from breaking the regex
142-
# ^\s*(\*|-) ensures we only match the actual session name column
143-
if NO_COLOR=1 uvx --with 'nox[uv]' nox -l | grep -qE "^\s*(\*|-)\s+${SESSION}\b"; then
144-
uvx --with 'nox[uv]' nox -s "${SESSION}" || FAILED=1
76+
# NO_COLOR=1 and anchored regex prevents the docstring bug
77+
if NO_COLOR=1 python -m nox -l | grep -qE "^\s*(\*|-)\s+${SESSION}\b"; then
78+
python -m nox -s "${SESSION}" || FAILED=1
14579
else
14680
echo "⏭️ Session '${SESSION}' not defined for $pkg. Safely skipping."
14781
fi
14882
14983
cd "$GITHUB_WORKSPACE"
15084
done
15185
exit $FAILED
152-
153-
154-
# ==========================================
155-
# 4. CORE DEPS FROM SOURCE (Py 3.14)
156-
# ==========================================
157-
unit-core-deps-from-source:
158-
needs: discover
159-
if: ${{ needs.discover.outputs.buckets != '[]' }}
160-
runs-on: ubuntu-latest
161-
strategy:
162-
fail-fast: false
163-
max-parallel: 60
164-
matrix:
165-
chunk: ${{ fromJSON(needs.discover.outputs.buckets) }}
166-
167-
name: Core Deps (Py 3.14 - ${{ matrix.chunk.id }})
168-
steps:
169-
- uses: actions/checkout@v4
170-
with:
171-
fetch-depth: 2
172-
173-
- uses: astral-sh/setup-uv@v5
174-
with:
175-
python-version: "3.14"
176-
enable-cache: true
177-
178-
- name: Optimize Core Dependencies
179-
run: git config --global url."${GITHUB_WORKSPACE}".insteadOf "https://github.com/googleapis/google-cloud-python"
180-
181-
- name: Execute Chunk
182-
run: |
183-
export NOX_DEFAULT_VENV_BACKEND=uv
184-
export UV_VENV_SEED=1
185-
export UV_COMPILE_BYTECODE=1
186-
FAILED=0
187-
188-
for pkg in ${{ matrix.chunk.packages }}; do
189-
echo "=========================================================="
190-
echo "🚀 TESTING CORE DEPS: $pkg (Python 3.14)"
191-
echo "=========================================================="
192-
cd "$pkg"
193-
194-
if uvx --with 'nox[uv]' nox -l | grep -q "core_deps_from_source-3.14"; then
195-
uvx --with 'nox[uv]' nox -s "core_deps_from_source-3.14" || FAILED=1
196-
else
197-
echo "⏭️ Session 'core_deps_from_source-3.14' not defined for $pkg. Safely skipping."
198-
fi
199-
200-
cd "$GITHUB_WORKSPACE"
201-
done
202-
exit $FAILED
203-
204-
205-
# ==========================================
206-
# 5. GATEKEEPER
207-
# ==========================================
208-
presubmit-passed:
209-
if: always()
210-
needs: [discover, unit-tests, unit-prerelease, unit-core-deps-from-source]
211-
runs-on: ubuntu-latest
212-
steps:
213-
- name: Evaluate Pipeline Status
214-
run: |
215-
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
216-
echo "::error::One or more required CI jobs failed or were cancelled."
217-
exit 1
218-
fi
219-
echo "All dynamically generated CI jobs completed successfully."

0 commit comments

Comments
 (0)