ci: try to enable cache for nix store
Some checks failed
Flake checks / Check (pull_request) Failing after 24s
Some checks failed
Flake checks / Check (pull_request) Failing after 24s
using https://github.com/nix-community/cache-nix-action
This commit is contained in:
parent
766f1fa6a2
commit
2e639e9bd9
|
@ -3,19 +3,30 @@ on: [pull_request]
|
|||
|
||||
jobs:
|
||||
Check:
|
||||
runs-on: nix-flakes
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: https://github.com/nixbuild/nix-quick-install-action@v26
|
||||
with:
|
||||
nix_conf: |
|
||||
substituters = https://cache.nixos.org/ https://nix-community.cachix.org
|
||||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
|
||||
keep-outputs = true
|
||||
- name: Restore and cache Nix store
|
||||
uses: https://github.com/nix-community/cache-nix-action@v4
|
||||
with:
|
||||
key: cache-x86_64-linux-${{ hashFiles('**/*.nix') }}
|
||||
restore-keys: |
|
||||
cache-x86_64-linux-
|
||||
|
||||
gc-linux: true
|
||||
gc-max-store-size-linux: 10000000000
|
||||
|
||||
purge-caches: true
|
||||
purge-key: cache-x86_64-linux-
|
||||
purge-created: true
|
||||
purge-created-max-age: 42
|
||||
- name: Check out repository code
|
||||
uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- name: "Cache Nix store"
|
||||
uses: actions/cache@v3.3.2
|
||||
id: nix-cache
|
||||
with:
|
||||
path: /tmp/nixcache
|
||||
key: "cache-nix-store"
|
||||
- name: "Import Nix store cache"
|
||||
if: "steps.nix-cache.outputs.cache-hit == 'true'"
|
||||
run: "nix-store --import < /tmp/nixcache"
|
||||
- name: Prepare cachix
|
||||
uses: https://github.com/cachix/cachix-action@v12
|
||||
with:
|
||||
|
@ -24,6 +35,3 @@ jobs:
|
|||
- name: Run flake checks
|
||||
run: |
|
||||
nix --print-build-logs --verbose --accept-flake-config flake check
|
||||
- name: "Export Nix store cache"
|
||||
if: "steps.nix-cache.outputs.cache-hit != 'true'"
|
||||
run: "nix-store --export $(find /nix/store -maxdepth 1 -name '*-*') > /tmp/nixcache"
|
||||
|
|
Loading…
Reference in a new issue