Skip to content

Commit cf76046

Browse files
committed
ci: bound the native-build cache with gc-max + deps pin, drop concurrency
1 parent 7673e03 commit cf76046

3 files changed

Lines changed: 15 additions & 13 deletions

File tree

‎.github/actions/build-linux-native-package/action.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ runs:
2626
nix build .#ccusage-static --print-build-logs
2727
fi
2828
29+
# Root the deps so the cache-nix-action gc-max trim keeps them while
30+
# dropping stale paths. On PR runs (nix-github-token == 'false') the pin's
31+
# nix build / eval must disable access tokens too.
32+
- uses: ./.github/actions/pin-nix-deps
33+
env:
34+
NIX_CONFIG: ${{ inputs.nix-github-token == 'false' && 'access-tokens =' || '' }}
35+
with:
36+
attr: .#ccusage-static.cargoArtifacts
37+
2938
- name: Verify Linux binary is static
3039
shell: bash
3140
env:

‎.github/actions/setup-linux-nix-action-cache/action.yaml‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: Setup Linux Nix (action cache, macOS-style)
22
description: >
33
Install Nix and restore/save the store with cache-nix-action, mirroring the
4-
macOS setup. No gc-max-store-size: the Blacksmith cache backend is unlimited,
5-
so we never garbage-collect before saving — the whole store (including the
6-
unrooted crane deps) is cached, exactly like macOS where the small store keeps
7-
GC from running ("Not collecting garbage").
4+
macOS setup. cache-nix-action only caches non-substitutable paths (the crane
5+
deps, not the cache.nixos.org toolchain), so the cache stays small (~900MB).
6+
gc-max-store-size bounds it so old deps generations and stale build outputs do
7+
not accumulate across runs; the deps profile pin keeps the current deps rooted
8+
so the GC trims everything except what the next build reuses.
89
runs:
910
using: composite
1011
steps:
@@ -20,6 +21,7 @@ runs:
2021
with:
2122
primary-key: nix-buildnative-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.lock', 'flake.nix', 'package.nix', 'nix/**/*.nix', 'rust-toolchain.toml', 'rust/Cargo.lock') }}
2223
restore-prefixes-first-match: nix-buildnative-${{ runner.os }}-${{ runner.arch }}-
24+
gc-max-store-size-linux: 2000000000
2325
purge: true
2426
purge-prefixes: nix-buildnative-${{ runner.os }}-${{ runner.arch }}-
2527
purge-created: 172800

‎.github/workflows/ci.yaml‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,6 @@ jobs:
7979
needs: changes
8080
if: needs.changes.outputs.code-changed == 'true'
8181
name: ${{ matrix.name }}
82-
# Each native build shares one per-job, per-arch Blacksmith sticky disk
83-
# across every run. Overlapping runs clone the same snapshot and re-commit
84-
# wholesale, so a later run overwrites the deps another run just pinned and
85-
# both rebuild from scratch. Serialize runs of the same matrix entry (queue,
86-
# don't cancel) so the pinned deps survive and stay warm. The key is per
87-
# matrix.name because each entry already has its own disk.
88-
concurrency:
89-
group: build-native-${{ matrix.name }}
90-
cancel-in-progress: false
9182
permissions:
9283
actions: write
9384
contents: read

0 commit comments

Comments
 (0)