fix(ci): create the profile dir so macOS nix prune keeps the toolchain warm
The prune step's profile path $HOME/.cache/rdbms-ci/toolchain had no
parent dir, so `nix develop --profile` errored ("cannot read directory")
and — swallowed by `|| true` — never created the profile/gc-root. With
nothing rooting the toolchain, nix-collect-garbage deleted the whole
closure every run (~3.8 GiB re-downloaded each dispatch; confirmed in the
run-74 log). Add `mkdir -p` for the parent and drop the `|| true` on the
profile realization so a future breakage fails loudly. The VM stays
bounded as before, but the toolchain now persists across runs.
release-macos.yaml is workflow_dispatch (runs from main's definition), so
this takes effect on the next dispatch — the already-published v0.2.0
macOS binaries are unaffected.
This commit is contained in:
@@ -84,12 +84,21 @@ jobs:
|
|||||||
# The runner wipes the workspace each run, so cargo target/ never
|
# The runner wipes the workspace each run, so cargo target/ never
|
||||||
# accumulates. Bound the persistent nix store by generation: record the
|
# accumulates. Bound the persistent nix store by generation: record the
|
||||||
# current devShell as a generation of a persistent profile (in $HOME),
|
# current devShell as a generation of a persistent profile (in $HOME),
|
||||||
# keep the 2 newest, reclaim what older ones referenced.
|
# keep the 2 newest, reclaim what older ones referenced — so the
|
||||||
|
# toolchain stays *warm* across runs and only stale generations are GC'd.
|
||||||
|
#
|
||||||
|
# The profile's parent dir MUST exist first, or `nix develop --profile`
|
||||||
|
# errors ("cannot read directory …") and the profile/gc-root is never
|
||||||
|
# created — which made `nix-collect-garbage` delete the whole toolchain
|
||||||
|
# closure every run (re-downloaded ~3.8 GiB each time; the retention was
|
||||||
|
# silently broken by the swallowed `|| true`). No `|| true` on the
|
||||||
|
# profile realization now: a future breakage should fail loudly.
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
echo "--- disk before ---"; df -h / | tail -1
|
echo "--- disk before ---"; df -h / | tail -1
|
||||||
P="$HOME/.cache/rdbms-ci/toolchain"
|
P="$HOME/.cache/rdbms-ci/toolchain"
|
||||||
nix develop --profile "$P" -c true || true
|
mkdir -p "$(dirname "$P")"
|
||||||
|
nix develop --profile "$P" -c true
|
||||||
nix-env -p "$P" --delete-generations +2 || true
|
nix-env -p "$P" --delete-generations +2 || true
|
||||||
nix-collect-garbage || true
|
nix-collect-garbage || true
|
||||||
echo "--- disk after ---"; df -h / | tail -1
|
echo "--- disk after ---"; df -h / | tail -1
|
||||||
|
|||||||
Reference in New Issue
Block a user