Skip to content

Commit 3ed105e

Browse files
committed
ci/check: init
Adds a "check" CI workflow to replace buildbot. Uses nix-community/nix-github-actions to generate a job matrix as a `githubActions.matrix` flake output. This allows more customisation than simply building _all_ `checks`.
1 parent 2f610f9 commit 3ed105e

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed

.github/workflows/check.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Check
2+
3+
on:
4+
workflow_dispatch: # can be triggered manually
5+
pull_request:
6+
types:
7+
- opened
8+
- reopened
9+
- synchronize
10+
push:
11+
branches-ignore:
12+
- update/*
13+
paths-ignore:
14+
- "LICENSE"
15+
16+
jobs:
17+
flake-checker:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
- name: Install nix
23+
uses: cachix/install-nix-action@v31
24+
- name: Run flake checker
25+
uses: DeterminateSystems/flake-checker-action@main
26+
27+
build-matrix:
28+
runs-on: ubuntu-latest
29+
outputs:
30+
matrix: ${{ steps.set-matrix.outputs.matrix }}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Install nix
35+
uses: cachix/install-nix-action@v31
36+
- name: Generate Nix Matrix
37+
id: set-matrix
38+
run: |
39+
set -Eeu
40+
matrix="$(nix eval --json .#githubActions.matrix)"
41+
echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
42+
43+
build:
44+
name: ${{ matrix.name }} (${{ matrix.system }})
45+
needs:
46+
- build-matrix
47+
runs-on: ${{ matrix.os }}
48+
strategy:
49+
matrix: ${{ fromJSON(needs.build-matrix.outputs.matrix) }}
50+
steps:
51+
- name: Free disk space
52+
uses: wimpysworld/nothing-but-nix@main
53+
with:
54+
# Options: holster, carve, cleave (default), rampage
55+
hatchet-protocol: rampage
56+
root-safe-haven: "1024" # Default 2048MB
57+
mnt-safe-haven: "512" # Default 1024MB
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
- name: Install nix
61+
uses: cachix/install-nix-action@v31
62+
- name: Setup nix cache
63+
uses: cachix/cachix-action@v16
64+
with:
65+
name: nix-community
66+
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
67+
- name: Build ${{ matrix.attr }}
68+
env:
69+
attr: ${{ matrix.attr }}
70+
run: |
71+
nix build ".#$attr" \
72+
--abort-on-warn \
73+
--print-build-logs \
74+
--log-format raw

flake/dev/flake.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake/dev/flake.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
inputs.nixpkgs.follows = "dev-nixpkgs";
3333
};
3434

35+
nix-github-actions = {
36+
url = "github:nix-community/nix-github-actions";
37+
inputs.nixpkgs.follows = "dev-nixpkgs";
38+
};
39+
3540
treefmt-nix = {
3641
url = "github:numtide/treefmt-nix";
3742
inputs.nixpkgs.follows = "dev-nixpkgs";

flake/dev/tests.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
self,
3+
inputs,
34
helpers,
45
...
56
}:
@@ -11,4 +12,9 @@
1112
inherit helpers self;
1213
};
1314
};
15+
16+
# Output a build matrix for CI
17+
flake.githubActions = inputs.nix-github-actions.lib.mkGithubMatrix {
18+
inherit (self) checks;
19+
};
1420
}

0 commit comments

Comments
 (0)