Repository navigation
ci: cache poetry venv keyed on lockfile and cython sources - #675
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #675 +/- ##
=======================================
Coverage 89.90% 89.90%
=======================================
Files 29 29
Lines 3527 3527
Branches 606 606
=======================================
Hits 3171 3171
Misses 211 211
Partials 145 145 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
14efdb4 to
de13f9e
Compare
|
Rebased onto current main + tightened the cache key for cython safety. Two concrete risks I wanted to close:
Changes on this revision:
Failure mode if a bad cached |
de13f9e to
7e4eed5
Compare
|
Correction to my earlier safety comment: I made too much of the Cython-drift risk. Walking through it more carefully — A cache hit requires both source AND Closed #678 (the build-system pin) for the same reason: it'd restrict downstream sdist builds without buying us anything the existing key doesn't already give us. The The other safety bits on this revision ( |
What
Caches the poetry-managed
.venvplus the built Cython artefacts (src/dbus_fast/**/*.so,src/dbus_fast/**/*.c) for both thetestmatrix andbenchmarkjobs, keyed on:hashFiles('poetry.lock', 'pyproject.toml', 'build_ext.py')— dependency / build sethashFiles('src/dbus_fast/**/*.py', 'src/dbus_fast/**/*.pxd')— Cython sourcesOn a cache hit the
Install Dependenciesstep is skipped viaif: steps.cache-venv.outputs.cache-hit != 'true'. Pure-Python and Cython source changes both invalidate the cache, so we never run tests against stale.sofiles.POETRY_VIRTUALENVS_IN_PROJECT: "true"is set at the job level so poetry creates.venvinside the repo rather than under~/.cache/pypoetry/virtualenvs/, which makes it cacheable as a single path.Why
actions/setup-pythonwithcache: "poetry"only caches poetry's download cache, not the venv. On the last green run that leftpoetry install --only=main,devtaking ~22s per matrix cell (mostly Cython compile inuse_cythonmode), running 13× across the test matrix + benchmark.With this in place, runs where neither
poetry.locknor any Cythonized source has changed will reuse the prebuilt venv +.sofiles and skip the install step entirely. PRs that touch only tests, glib code, or docs will get this hit; PRs that changesrc/dbus_fast/**/*.pyor.pxdinvalidate the cython-source half of the key and rebuild as today.Notes
pyproject.tomlandbuild_ext.pyso changes toTO_CYTHONIZE, extension flags, or runtime deps bust the cache.cache: "poetry"onsetup-pythonis left in place — it still helps on the cold-cache path because poetry can install from the cached wheel store.