Cache uv between CI runs

All jobs restore built wheels (e.g., `rpy2`) and the Python versions
instead of building or fetching them again.

Only the "lint" job saves the cache, pruned to what is expensive to rebuild,
and only when its key changed; so, five jobs do not compress the same archive
in parallel, and unchanged runs skip the 15s of packing.
This commit is contained in:
Alexander Hess 2026-12-03 00:19:16 +01:00
commit 53746966ac
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -70,6 +70,21 @@ jobs:
env:
SKIP: local-format,local-lint,local-test,local-test-docstrings,local-test-types,no-commit-to-branch
# Only this job saves the `uv` cache that ./.forgejo/actions/setup restores
# => Keep only what is expensive to rebuild, not wheels that are cheap to download
- name: Shrink the `uv` cache
if: env.UV_CACHE_HIT != 'true'
run: uv cache prune --ci
- name: Save the `uv` cache
if: env.UV_CACHE_HIT != 'true'
uses: actions/cache/save@v4
with:
path: |
~/.cache/uv
~/.local/share/uv/python
key: ${{ env.UV_CACHE_KEY }}
tests:
name: Tests (${{ matrix.session }})