-
Notifications
You must be signed in to change notification settings - Fork 1
109 lines (90 loc) · 3.3 KB
/
ci.yaml
File metadata and controls
109 lines (90 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: CI
on:
pull_request:
push:
branches:
- main
schedule:
- cron: "27 2 */3 * *" # run every three days at 2:27 am
permissions:
contents: read
id-token: write
jobs:
nixfmt:
name: nixfmt
runs-on: ubuntu-24.04
steps:
- uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
- uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
with:
use-flakehub: false
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: nixfmt
run: nix run nixpkgs#nixfmt-rfc-style -- --check .
deadnix:
name: deadnix
runs-on: ubuntu-24.04
steps:
- uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
- uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
with:
use-flakehub: false
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: deadnix
run: nix run nixpkgs#deadnix -- --fail .
show:
name: nix flake show
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
- uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
with:
use-flakehub: false
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Show flake structure
run: nix flake show 2> /dev/null
- name: Generate test matrix
id: generate-matrix
run: |
matrix=$(nix flake show --json | jq -r '.checks["x86_64-linux"] | keys | tojson')
echo "matrix=${matrix}" >> $GITHUB_OUTPUT
check:
name: nix flake check
runs-on: ubuntu-24.04
steps:
- uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
- uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
with:
use-flakehub: false
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Check flake
run: nix -L flake check --no-build
test:
name: "nix build .#${{ matrix.name }}"
needs: [ show, check ]
runs-on: ubuntu-24.04
strategy:
matrix:
name: ${{ fromJson(needs.show.outputs.matrix) }}
steps:
- name: Maximize build space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
- uses: DeterminateSystems/nix-installer-action@c5a866b6ab867e88becbed4467b93592bce69f8a # v21
- uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
with:
use-flakehub: false
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Run integration test
run: nix -L build .#checks.x86_64-linux.${{ matrix.name }}