Skip to content

Commit fa31566

Browse files
committed
ci: run build, test, lint and format as nix flake checks
Adopt kradalby/flake-checks: flake.nix exposes build, gotest, golangci-lint and formatting checks over one shared, fileset-filtered source set, and nix-checks.yml gates each with nix build .#checks.<system>.<name>. Drop test.yml and lint.yml — gotestsum, golangci-lint and prettier are now those checks. golangci-lint runs full-tree; Go formatting stays in it while formatting adds prettier. hscontrol/servertest is too slow and timing-sensitive for the sandboxed gotest check, so servertest.yml runs it in the devShell instead.
1 parent 7c87c7f commit fa31566

6 files changed

Lines changed: 232 additions & 124 deletions

File tree

.github/workflows/lint.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

.github/workflows/nix-checks.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Nix Flake Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
# Each job only runs `nix build .#checks.<system>.<name>`; the check logic lives
16+
# in flake.nix via the flake-checks library. The fileset-filtered checks hit the
17+
# hestia cache when their inputs are unchanged, so no changed-files gating.
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
26+
- uses: NixOS/nix-installer-action@6b8548fe06acfb0155a50ab5d561accb215764cc # main
27+
- uses: Mic92/hestia/action@ff07bb902a9968ac0c3d0e51d90a606662a375d8 # main
28+
- name: build
29+
run: nix build -L .#checks.x86_64-linux.build
30+
31+
gotest:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
35+
- uses: NixOS/nix-installer-action@6b8548fe06acfb0155a50ab5d561accb215764cc # main
36+
- uses: Mic92/hestia/action@ff07bb902a9968ac0c3d0e51d90a606662a375d8 # main
37+
- name: gotest
38+
run: nix build -L .#checks.x86_64-linux.gotest
39+
40+
golangci-lint:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
44+
- uses: NixOS/nix-installer-action@6b8548fe06acfb0155a50ab5d561accb215764cc # main
45+
- uses: Mic92/hestia/action@ff07bb902a9968ac0c3d0e51d90a606662a375d8 # main
46+
- name: golangci-lint
47+
run: nix build -L .#checks.x86_64-linux.golangci-lint
48+
49+
formatting:
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
53+
- uses: NixOS/nix-installer-action@6b8548fe06acfb0155a50ab5d561accb215764cc # main
54+
- uses: Mic92/hestia/action@ff07bb902a9968ac0c3d0e51d90a606662a375d8 # main
55+
- name: formatting
56+
run: nix build -L .#checks.x86_64-linux.formatting

.github/workflows/servertest.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Server Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
# hscontrol/servertest is excluded from the sandboxed gotest flake check: it is
16+
# slow (10s+ convergence cases) and timing-sensitive (race/stress/HA property
17+
# tests), so it runs here in the devShell with a generous timeout instead.
18+
defaults:
19+
run:
20+
shell: nix develop --fallback --command bash -e {0}
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
servertest:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
30+
- uses: NixOS/nix-installer-action@6b8548fe06acfb0155a50ab5d561accb215764cc # main
31+
- uses: Mic92/hestia/action@ff07bb902a9968ac0c3d0e51d90a606662a375d8 # main
32+
33+
- name: go test ./hscontrol/servertest
34+
env:
35+
CGO_ENABLED: "0"
36+
run: go test -timeout=20m ./hscontrol/servertest/...

.github/workflows/test.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

flake.lock

Lines changed: 78 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)