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.
This commit is contained in:
DanConwayDev
2026-08-17 10:51:07 +00:00
parent e672255f69
commit 9991ebc53f
+17
View File
@@ -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