ci: macOS smoke-test — run tests + nix-store generation pruning
- Add `cargo test` before the darwin builds (gate is Linux-only; the macOS leg is test-then-build) — a full dry-run of release-macos bar the upload. - Add an `if: always()` prune step. The runner wipes the workspace each run, so cargo target/ never accumulates (no sweep). The persistent cache is the nix store: record the current toolchain in a persistent profile, keep the 2 newest generations (nix-env --delete-generations +2), reclaim the rest (nix-collect-garbage). Pairs with min-free/max-free in the runner nix.conf.
This commit is contained in:
@@ -25,6 +25,8 @@ jobs:
|
|||||||
NIX_CONFIG: "experimental-features = nix-command flakes"
|
NIX_CONFIG: "experimental-features = nix-command flakes"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
- name: test (macOS — the gate only covers Linux)
|
||||||
|
run: nix develop -c cargo test --no-fail-fast
|
||||||
- name: build, de-nix, sign, verify both darwin targets
|
- name: build, de-nix, sign, verify both darwin targets
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
@@ -58,3 +60,22 @@ jobs:
|
|||||||
echo "OK: $t portable"
|
echo "OK: $t portable"
|
||||||
done
|
done
|
||||||
echo "=== both darwin targets built, de-nixed, signed, verified ==="
|
echo "=== both darwin targets built, de-nixed, signed, verified ==="
|
||||||
|
|
||||||
|
- name: prune nix store — keep the last 2 toolchain generations
|
||||||
|
# The runner wipes the whole workspace before each run, so cargo target/
|
||||||
|
# never accumulates (no sweep needed). The persistent caches are the nix
|
||||||
|
# store (/nix) and ~/.cargo (in $HOME). Bound the nix store by generation:
|
||||||
|
# record the current devShell closure as a generation of a persistent
|
||||||
|
# profile (lives in $HOME, survives the workspace wipe), keep the 2 newest
|
||||||
|
# (current + previous), reclaim what the older ones referenced. No time
|
||||||
|
# window — never more than two toolchains regardless of flake.lock churn.
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
echo "--- disk before ---"; df -h / | tail -1
|
||||||
|
P="$HOME/.cache/rdbms-ci/toolchain"
|
||||||
|
nix develop --profile "$P" -c true || true
|
||||||
|
nix-env -p "$P" --delete-generations +2 || true
|
||||||
|
nix-collect-garbage || true
|
||||||
|
echo "--- disk after ---"; df -h / | tail -1
|
||||||
|
# ~/.cargo/registry also persists but grows only on Cargo.lock bumps;
|
||||||
|
# bound it later with `cargo-cache --autoclean` if it ever matters.
|
||||||
|
|||||||
Reference in New Issue
Block a user