From 9991ebc53f0f3420a0398b1be62bf5f4dd659405 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 17 Aug 2026 10:51:07 +0000 Subject: [PATCH] ci: cache Nix and Rust build inputs Reuse Nix store paths, Cargo sources, and Rust target artifacts across ngit-ci runs. Keys track the flake, toolchain, and Cargo dependency inputs while prefix restores preserve useful overlap after updates. Cache restore and save remain non-fatal optimizations, and the existing formatting, lint, and test commands are unchanged. Validated by listing the workflow with act and checking the resulting diff. --- .ngit/act/workflows/rust_ci.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.ngit/act/workflows/rust_ci.yaml b/.ngit/act/workflows/rust_ci.yaml index 5f9100a..e4974e1 100644 --- a/.ngit/act/workflows/rust_ci.yaml +++ b/.ngit/act/workflows/rust_ci.yaml @@ -22,6 +22,23 @@ jobs: - uses: cachix/install-nix-action@v31 with: nix_path: nixpkgs=channel:nixos-unstable + - name: Restore Nix store cache + continue-on-error: true + uses: nix-community/cache-nix-action@v7 + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', 'flake.lock') }} + restore-prefixes-first-match: nix-${{ runner.os }}- + - name: Restore Rust build cache + continue-on-error: true + uses: actions/cache@v4 + with: + path: | + ~/.cargo/git + ~/.cargo/registry + target + key: rust-${{ runner.os }}-${{ hashFiles('**/Cargo.toml', 'Cargo.lock', 'flake.lock') }} + restore-keys: | + rust-${{ runner.os }}- # The suite must be hermetic with respect to ambient git configuration, # so CI always runs it under a deliberately hostile global config: a # failing pre-commit hook delivered via both core.hooksPath and