fix(ci): improve ccache persistence across builds #128
Reference in New Issue
Block a user
Delete Branch "fix/ci-cache-strategy"
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?
Problem
Builds take ~65 minutes with 0% ccache hit rate despite restoring a cached ccache directory. CI logs confirm:
Root Cause 1:
compiler_check = mtime(critical)The default ccache
compiler_checkmode hashes the compiler binary's modification time. Since pixi installs a fresh conda environment with fresh compiler binaries on every CI run, the compiler mtime changes every time, invalidating the entire cache.Root Cause 2: Cache never re-saved after first save
The save step used
if: cache-hit != 'true', so once a cache key was restored, subsequent builds never saved their new ccache objects. Every compilation after the first build was thrown away.Changes
All workflows (
build.yml,release.yml,build.sh)CCACHE_COMPILERCHECK=content— Hash compiler binary content instead of mtime. Same compiler version = same content = cache hits, regardless of when the binary was installed.Both CI workflows
github.run_idinstead of date — every build saves its cachealways()instead ofcache-hit != 'true'Compute cache date keystep (no longer needed)Release workflow
ccache-build-main-to restore-keys fallback chainExpected Impact
With these fixes, incremental builds should see high ccache hit rates (~90%+ for small changes), reducing build times from ~65 minutes to potentially ~10-15 minutes.
7fca71318dtodfc32cabd6