Skip to content

Commit 730570e

Browse files
authored
fix(ci): cache save and restore must share one path — every save was invisible (#79)
actions/cache versions an entry by its path spec; saving /var/tmp/abgen-nixcache-out while restoring /var/tmp/abgen-nixcache means no restore since the v3 redesign has ever seen a saved entry: every 'warm' run was cold, and every run re-saved a duplicate (~8 GB of orphans, now purged). Pack fresh, then swap into the restore path.
1 parent 939e81f commit 730570e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/actions/nix-store-cache/save/action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,18 @@ runs:
3030
nix copy --to 'file:///var/tmp/abgen-nixcache-out?compression=zstd'
3131
echo "cache: $(wc -l < /var/tmp/abgen-nix-delta.txt) paths," \
3232
"$(du -sh /var/tmp/abgen-nixcache-out | cut -f1)"
33+
# actions/cache versions an entry by its path: saving a different
34+
# directory than the restore looks up makes every save invisible to
35+
# every restore. Pack fresh for hygiene, then swap into the restore
36+
# path so both sides share one cache version. The fresh dir is a
37+
# superset of everything this run substituted, so the substituter
38+
# keeps working for the rest of the job.
39+
rm -rf /var/tmp/abgen-nixcache
40+
mv /var/tmp/abgen-nixcache-out /var/tmp/abgen-nixcache
3341
echo "publish=true" >> "$GITHUB_OUTPUT"
3442
3543
- uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
3644
if: steps.pack.outputs.publish == 'true'
3745
with:
38-
path: /var/tmp/abgen-nixcache-out
46+
path: /var/tmp/abgen-nixcache
3947
key: ${{ env.ABGEN_NIXCACHE_KEY }}

0 commit comments

Comments
 (0)