fix(ci): fresh checkout of the event ref every run; robust tkinter skip #34
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/ci-fresh-checkout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the persistent CI failures on the 3.12/3.14 legs (failing since run 119, even on docs-only commits, while local runs were green). Two compounding root causes:
1. Stale workspace pinning CI to old code (workflow issue)
The workflow cloned only when
pyproject.tomlwas missing. The self-hosted runner reuses a persistent workspace directory, so once a leg holds a leftover (stale/partial) checkout it is silently reused forever:pyproject.tomlexists -> no clone -> git not even installed -> never heals. Evidence: failures on docs-only commits, the first attempt at fixing the skip still failing (run 130 - its workspace never received the new code), and contaminated workspaces containing unrelated junk (src/main/.../zte_dummy_legacy/,demo.txt).Fix: wipe the workspace and clone the event ref fresh on every run -
GITHUB_HEAD_REFfor pull_request events,GITHUB_REF_NAMEfor push,refs/pull/N/headfetch fallback, hardcodedFORGE_URL/REPO_SLUGfallbacks for runners that do not export theGITHUB_*context.2.
pytest.importorskip("tkinter")broke under pytest 9.1 (code/test issue)Since pytest 9.1,
importorskiponly catchesModuleNotFoundErrorby default and re-raises plain ImportErrors at collection time. The python-slim CI images ship thetkinter/package but notlibtk8.6.so, soimport tkinterraisesImportError(notModuleNotFoundError) -> collection errorlibtk8.6.so: cannot open shared object fileinterrupting the whole run. (The 3.9 image lacks the package entirely ->ModuleNotFoundError-> skipped -> explains its green leg; CIpip installpulled pytest 9.x between runs 118 and 119, which is when the failures started.)Fix: guard the tkinter import with
try/except ImportErrorand skip via agui_skipmarker helper (tkinter is None or not HAS_DISPLAY). No behavior change when tkinter works.Also
Verification
pytest: 198 passed, 4 skipped (headless);ruffclean.Two compounding CI problems (3.12/3.14 legs failing since run 119 on docs-only commits while local runs were green): 1. Stale workspace pinning CI to old code. The workflow cloned only when pyproject.toml was missing, so a leftover workspace on the self-hosted runner was silently reused forever (pyproject.toml present -> no clone -> no git needed -> never heals). This workspace was even contaminated with unrelated junk (src/main/..., demo.txt). Fix: wipe the workspace and clone the event ref fresh on every run (GITHUB_HEAD_REF for pull_request, GITHUB_REF_NAME for push, with hardcoded fallbacks for runners that do not export the context). 2. pytest 9.1 changed importorskip: by default it only catches ModuleNotFoundError and re-raises plain ImportErrors at collection time. On images where the tkinter package exists but _tkinter cannot load (python slim images ship tkinter/ but not libtk8.6.so), pytest.importorskip("tkinter") failed collection with ImportError: libtk8.6.so instead of skipping. Fix: guard the import with try/except ImportError and skip via a gui_skip marker helper. README: drop the hardcoded test count (drifts every increment). pytest: 198 passed, 4 skipped (headless); ruff clean.