Prune the uv cache at the end of every CI job
CI / Sync project version with tag (push) Has been skipped
CI / Format (ruff format) (pull_request) Successful in 40s
CI / Type check (ty) (pull_request) Successful in 39s
CI / Sync project version with tag (pull_request) Has been skipped
CI / Lint (ruff check) (pull_request) Successful in 2m13s
CI / Type check (ty) (push) Successful in 2m18s
CI / Lint (ruff check) (push) Successful in 2m17s
CI / Format (ruff format) (push) Successful in 2m18s
CI / Tests (push) Successful in 7m50s
CI / Tests (pull_request) Successful in 7m57s
CI / Bump version, tag, and update changelog on merge to master (push) Has been skipped
CI / Bump version, tag, and update changelog on merge to master (pull_request) Has been skipped

The uv cache lives on a persistent volume shared by every job on the
runner (/srv/act-runner-cache/uv), so nothing trimmed it and it grew
without bound. `uv cache prune --ci` drops the entries that are not worth
keeping between runs (pre-built wheels for local sources) while leaving
the downloaded-wheel cache that makes `uv sync` fast.

In bump-version the step carries the same is_merge guard as the rest of
that job, since uv is only set up on a merge push.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-26 13:08:26 +02:00
parent 96aad375c8
commit 331f10fb07
+11
View File
@@ -28,6 +28,9 @@ jobs:
echo "UV_LINK_MODE=copy" >> "$GITHUB_ENV"
- run: uv sync --extra cpu --extra dev
- run: uv run ruff check .
# The uv cache is a persistent volume shared by every job on this
# runner, so each job trims what it no longer needs before exiting.
- run: uv cache prune --ci
ruff-format:
name: Format (ruff format)
@@ -46,6 +49,7 @@ jobs:
echo "UV_LINK_MODE=copy" >> "$GITHUB_ENV"
- run: uv sync --extra cpu --extra dev
- run: uv run ruff format --check .
- run: uv cache prune --ci
type-check:
name: Type check (ty)
@@ -64,6 +68,7 @@ jobs:
echo "UV_LINK_MODE=copy" >> "$GITHUB_ENV"
- run: uv sync --extra cpu --extra dev
- run: uv run ty check .
- run: uv cache prune --ci
test:
name: Tests
@@ -87,6 +92,7 @@ jobs:
with:
name: coverage-report
path: coverage.xml
- run: uv cache prune --ci
bump-version:
name: Bump version, tag, and update changelog on merge to master
@@ -173,6 +179,10 @@ jobs:
git tag -a "$TAG" -m "$TAG"
git push origin "refs/tags/$TAG"
fi
# Same guard as every other step here: on a non-merge push uv was never
# set up, so there is nothing to prune.
- run: uv cache prune --ci
if: steps.merge_check.outputs.is_merge == 'true'
sync-version-on-tag:
name: Sync project version with tag
@@ -201,3 +211,4 @@ jobs:
else
echo "Tag version matches project version ($CURRENT_VERSION)"
fi
- run: uv cache prune --ci