Skip to content

Commit af2cf96

Browse files
committed
use caching strategy for nix
1 parent e337aad commit af2cf96

File tree

2 files changed

+44
-15
lines changed

2 files changed

+44
-15
lines changed

.github/workflows/checks.yml

-15
This file was deleted.

.github/workflows/ci.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Nix CI/CD
2+
on:
3+
push:
4+
# don't run on tags, run on commits
5+
# https://github.com/orgs/community/discussions/25615
6+
tags-ignore:
7+
- "**"
8+
branches:
9+
- main
10+
pull_request:
11+
workflow_dispatch:
12+
13+
env:
14+
# required for gh
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
17+
# We want the cache to be as full as possible, so we instruct nix to keep derivations
18+
# and other related outputs around in its cache
19+
nix_conf: |
20+
keep-env-derivations = true
21+
keep-outputs = true
22+
23+
jobs:
24+
check:
25+
name: Check formatting / lints / clippy
26+
runs-on: ubuntu-24.04
27+
permissions:
28+
actions: write
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: nixbuild/nix-quick-install-action@v30
32+
with:
33+
nix_conf: ${{ env.nix_conf }}
34+
- name: Restore and save Nix store
35+
uses: nix-community/cache-nix-action@v6
36+
with:
37+
primary-key: build-${{ runner.os }}-${{ hashFiles('Cargo.lock', '**/Cargo.toml', 'flake.nix', 'flake.lock') }}
38+
purge: true
39+
purge-prefixes: build-${{ runner.os }}-
40+
purge-created: 0
41+
purge-primary-key: never
42+
gc-max-store-size: 1G
43+
- name: Run checks
44+
run: nix flake check

0 commit comments

Comments
 (0)