Skip to content

Commit 4703f89

Browse files
committed
ci: isolate concurrent E2E virtualenvs
1 parent eecf098 commit 4703f89

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/e2e-matrix.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ jobs:
4949
run: |
5050
base_python=/Volumes/external/sources/cppmega.mlx/.venv/bin/python
5151
test -x "$base_python"
52-
job_venv="$RUNNER_TEMP/cppmega-mlx-e2e-venv"
53-
rm -rf "$job_venv"
52+
job_venv="$(mktemp -d "$RUNNER_TEMP/cppmega-mlx-e2e-${GITHUB_RUN_ID}-${GITHUB_JOB}.XXXXXX")"
5453
"$base_python" -m venv --system-site-packages "$job_venv"
5554
echo "VBGUI_E2E_PYTHON=$job_venv/bin/python" >> "$GITHUB_ENV"
55+
echo "VBGUI_E2E_VENV=$job_venv" >> "$GITHUB_ENV"
5656
- name: Python deps
5757
run: |
5858
"$VBGUI_E2E_PYTHON" -m pip install --disable-pip-version-check \
@@ -89,6 +89,9 @@ jobs:
8989
vbgui/e2e/screenshots/
9090
vbgui/e2e/logs/
9191
retention-days: 3
92+
- name: Remove isolated MLX Python
93+
if: always()
94+
run: rm -rf "$VBGUI_E2E_VENV"
9295

9396
# Specialised + canvas smoke scenarios — run on every push (lightweight).
9497
specialised:
@@ -105,10 +108,10 @@ jobs:
105108
run: |
106109
base_python=/Volumes/external/sources/cppmega.mlx/.venv/bin/python
107110
test -x "$base_python"
108-
job_venv="$RUNNER_TEMP/cppmega-mlx-e2e-venv"
109-
rm -rf "$job_venv"
111+
job_venv="$(mktemp -d "$RUNNER_TEMP/cppmega-mlx-e2e-${GITHUB_RUN_ID}-${GITHUB_JOB}.XXXXXX")"
110112
"$base_python" -m venv --system-site-packages "$job_venv"
111113
echo "VBGUI_E2E_PYTHON=$job_venv/bin/python" >> "$GITHUB_ENV"
114+
echo "VBGUI_E2E_VENV=$job_venv" >> "$GITHUB_ENV"
112115
- run: |
113116
"$VBGUI_E2E_PYTHON" -m pip install --disable-pip-version-check \
114117
-e ".[gui,parquet,widget]"
@@ -139,6 +142,9 @@ jobs:
139142
vbgui/e2e/screenshots/
140143
vbgui/e2e/logs/
141144
retention-days: 3
145+
- name: Remove isolated MLX Python
146+
if: always()
147+
run: rm -rf "$VBGUI_E2E_VENV"
142148

143149
# Mini-train matrix (192 cells, real mlx) — macOS only, nightly.
144150
mini-train-matrix:
@@ -155,10 +161,10 @@ jobs:
155161
run: |
156162
base_python=/Volumes/external/sources/cppmega.mlx/.venv/bin/python
157163
test -x "$base_python"
158-
job_venv="$RUNNER_TEMP/cppmega-mlx-e2e-venv"
159-
rm -rf "$job_venv"
164+
job_venv="$(mktemp -d "$RUNNER_TEMP/cppmega-mlx-e2e-${GITHUB_RUN_ID}-${GITHUB_JOB}.XXXXXX")"
160165
"$base_python" -m venv --system-site-packages "$job_venv"
161166
echo "VBGUI_E2E_PYTHON=$job_venv/bin/python" >> "$GITHUB_ENV"
167+
echo "VBGUI_E2E_VENV=$job_venv" >> "$GITHUB_ENV"
162168
- run: |
163169
"$VBGUI_E2E_PYTHON" -m pip install --disable-pip-version-check \
164170
-e ".[gui,parquet,widget]"
@@ -185,6 +191,9 @@ jobs:
185191
vbgui/e2e/screenshots/
186192
vbgui/e2e/logs/
187193
retention-days: 7
194+
- name: Remove isolated MLX Python
195+
if: always()
196+
run: rm -rf "$VBGUI_E2E_VENV"
188197

189198
# Matrix report — aggregates shard artefacts into one Markdown
190199
# summary, posted as a build summary + uploaded as standalone artefact.

tests/test_workflow_runner_policy.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,13 @@ def test_macos_e2e_uses_an_isolated_job_venv() -> None:
8181
)
8282

8383
assert "pip install --upgrade pip" not in workflow
84+
assert 'job_venv="$RUNNER_TEMP/cppmega-mlx-e2e-venv"' not in workflow
85+
assert workflow.count('mktemp -d "$RUNNER_TEMP/cppmega-mlx-e2e-') == 3
8486
assert workflow.count("-m venv --system-site-packages") == 3
8587
assert "--no-build-isolation" not in workflow
8688
assert workflow.count('-e ".[gui,parquet,widget]"') == 3
8789
assert workflow.count('echo "VBGUI_E2E_PYTHON=$job_venv/bin/python"') == 3
90+
assert workflow.count('rm -rf "$VBGUI_E2E_VENV"') == 3
8891

8992

9093
def test_build_backend_declares_mlx_imported_by_setup_py() -> None:

0 commit comments

Comments
 (0)