You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci: move prek to fingerprinted uv-cache artifacts (#560)
- Replace prebuilt-image bootstrap with uv-cache release-asset workflow and fingerprint gating.
- Use compute/build helpers (`compute_uv_fingerprint.py`, `build_and_push_uv_cache.sh`) and document cache refresh in CONTRIBUTING.
- Store full uv cache as fingerprinted chunked release assets (`.tar.zst.part-###`) so CI reuses wheel/build payloads without GH single-asset size limits.
- Download cache parts with parallelism 8 in CI restore path, then reassemble in deterministic order.
- Keep immutable cache retention policy (latest 4 fingerprints).
if ! RELEASE_JSON="${release_json}" PART_PREFIX="${part_prefix}" python3 -c "import json, os, re, sys; payload=json.loads(os.environ['RELEASE_JSON']); part_prefix=os.environ['PART_PREFIX']; pattern=re.compile(r'^' + re.escape(part_prefix) + r'(\\d{3})$'); parts=[]; [parts.append((int(m.group(1)), int(a.get('id')), a.get('name'))) for a in payload.get('assets', []) for m in [pattern.match(a.get('name', ''))] if m and a.get('id') is not None]; parts.sort(key=lambda x: x[0]); indices=[p[0] for p in parts]; expected=list(range(len(parts))); print('\\n'.join(f'{asset_id} {name}' for _, asset_id, name in parts)) if parts and indices == expected else (_ for _ in ()).throw(SystemExit(2 if not parts else 3))" > "${part_selection_file}"; then
73
+
echo "::error::No complete uv cache part set found for prefix '${part_prefix}'."
74
+
echo "::error::Build and upload cache with: bash scripts/ci/build_and_push_uv_cache.sh"
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,36 @@ uv run prek run pytest
37
37
38
38
These checks are automatically run in CI for all pull requests. If your PR fails these checks, re-run the corresponding `prek` hook locally and commit any fixes.
39
39
40
+
### CI uv Cache Refresh
41
+
42
+
The PR `prek` workflow uses a prebuilt full `uv` cache (stored as a GitHub release asset) to avoid rebuilding heavy dependencies on every run.
43
+
44
+
To refresh the cache after dependency changes, run:
45
+
46
+
```bash
47
+
bash scripts/ci/build_and_push_uv_cache.sh
48
+
```
49
+
50
+
This command builds a full cache archive locally (using `uv sync --frozen --all-extras --group dev --no-install-project`) and uploads a fingerprinted part set:
51
+
52
+
-`prek-uv-cache-<fingerprint>.tar.zst.part-000`
53
+
-`prek-uv-cache-<fingerprint>.tar.zst.part-001`
54
+
- ...
55
+
56
+
The script also prunes old immutable cache assets (keeps newest 4 by default).
57
+
It requires GitHub CLI authentication (`gh auth login`) and should be run in an environment compatible with CI (same base CUDA image/toolchain).
58
+
59
+
You can override native-build parallelism while preparing cache:
By default, `--build-jobs auto` is used and resolves from available CPU and memory.
66
+
By default, cache parts are split at `1900 MiB`; override with `--part-size-mb <n>` if needed.
67
+
68
+
CI computes the expected cache fingerprint from `pyproject.toml`, `uv.lock`, base image, Python version, and cache asset layout contract. If no matching cache part set exists, CI fails fast and tells you to refresh cache with the script above.
0 commit comments