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