forked from
lass.pds.lassul.us/superconfig
This repository has no description
3.0 kB
100 lines
1name: CI
2
3on:
4 push:
5 branches: [master]
6 pull_request:
7 # update-pkgs runs it on its PR branches: pushes and PRs made with
8 # GITHUB_TOKEN don't trigger workflows, and master requires the ci check.
9 workflow_dispatch:
10
11# A newer run for the same ref replaces a running one, its farm included.
12# Runs for different refs queue for the farm, see the farm job.
13concurrency:
14 group: ci-${{ github.ref }}
15 cancel-in-progress: true
16
17# One job per check shows failing checks in the run overview. The NixOS
18# machines are built by the farm, one job per machine.
19jobs:
20 list:
21 runs-on: ubuntu-latest
22 outputs:
23 checks: ${{ steps.list.outputs.checks }}
24 steps:
25 - uses: actions/checkout@v4
26 with:
27 # Fetch all history for git-based operations
28 fetch-depth: 0
29
30 - uses: cachix/install-nix-action@v31
31
32 - id: list
33 run: |
34 checks=$(nix eval --json .#checks.x86_64-linux --apply builtins.attrNames)
35 echo "checks=$checks" >> "$GITHUB_OUTPUT"
36
37 check:
38 needs: list
39 name: ${{ matrix.check }}
40 runs-on: ubuntu-latest
41 strategy:
42 fail-fast: false
43 matrix:
44 check: ${{ fromJSON(needs.list.outputs.checks) }}
45 steps:
46 - uses: actions/checkout@v4
47 with:
48 # Fetch all history for git-based operations
49 fetch-depth: 0
50
51 - uses: cachix/install-nix-action@v31
52
53 - run: nix build -L --no-link '.#checks.x86_64-linux.${{ matrix.check }}'
54
55 outputs:
56 name: packages and devShells
57 runs-on: ubuntu-latest
58 steps:
59 - uses: actions/checkout@v4
60 with:
61 # Fetch all history for git-based operations
62 fetch-depth: 0
63
64 - uses: cachix/install-nix-action@v31
65
66 - run: |
67 for output in packages devShells; do
68 echo "$output:"
69 # shellcheck disable=SC2016 # ${...} is Nix interpolation
70 nix eval --raw ".#$output.x86_64-linux" --apply 'xs: builtins.deepSeq (builtins.mapAttrs (_: x: x.drvPath) xs) "${toString (builtins.length (builtins.attrNames xs))} evaluated\n"'
71 done
72
73 # Builds all NixOS machines (farm.yml). Its iroh endpoints are fixed, so one
74 # farm at a time across all runs; the others wait FIFO. Without `queue: max`
75 # GitHub keeps one pending run per group and cancels the one before.
76 farm:
77 uses: ./.github/workflows/farm.yml
78 secrets: inherit
79 permissions:
80 contents: read
81 id-token: write # niks3 push
82 actions: read # the jobs watch each other
83 concurrency:
84 group: farm
85 queue: max
86
87 # Fixed-name summary of the jobs above, the required status check for
88 # merging into master (the matrix job names change with the hosts).
89 ci:
90 needs: [list, check, outputs, farm]
91 if: always()
92 runs-on: ubuntu-latest
93 steps:
94 - env:
95 RESULTS: ${{ join(needs.*.result, ' ') }}
96 run: |
97 echo "results: $RESULTS"
98 for r in $RESULTS; do
99 [ "$r" = success ] || exit 1
100 done