This repository has no description
2.4 kB
80 lines
1name: CI
2
3on:
4 push:
5 pull_request:
6 # update-pkgs runs it on its PR branches: pushes and PRs made with
7 # GITHUB_TOKEN don't trigger workflows, and master requires the ci check.
8 workflow_dispatch:
9
10# nix flake check evaluates every host in one process (~19 GB peak), more than
11# the 16 GB RAM of ubuntu-latest. One job per check keeps the peak at the
12# largest single host and shows failing hosts in the run overview.
13jobs:
14 list:
15 runs-on: ubuntu-latest
16 outputs:
17 checks: ${{ steps.list.outputs.checks }}
18 steps:
19 - uses: actions/checkout@v4
20 with:
21 # Fetch all history for git-based operations
22 fetch-depth: 0
23
24 - uses: cachix/install-nix-action@v31
25
26 - id: list
27 run: |
28 checks=$(nix eval --json .#checks.x86_64-linux --apply builtins.attrNames)
29 echo "checks=$checks" >> "$GITHUB_OUTPUT"
30
31 check:
32 needs: list
33 name: ${{ matrix.check }}
34 runs-on: ubuntu-latest
35 strategy:
36 fail-fast: false
37 matrix:
38 check: ${{ fromJSON(needs.list.outputs.checks) }}
39 steps:
40 - uses: actions/checkout@v4
41 with:
42 # Fetch all history for git-based operations
43 fetch-depth: 0
44
45 - uses: cachix/install-nix-action@v31
46
47 - run: nix build -L --no-link '.#checks.x86_64-linux.${{ matrix.check }}'
48
49 outputs:
50 name: packages and devShells
51 runs-on: ubuntu-latest
52 steps:
53 - uses: actions/checkout@v4
54 with:
55 # Fetch all history for git-based operations
56 fetch-depth: 0
57
58 - uses: cachix/install-nix-action@v31
59
60 - run: |
61 for output in packages devShells; do
62 echo "$output:"
63 # shellcheck disable=SC2016 # ${...} is Nix interpolation
64 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"'
65 done
66
67 # Fixed-name summary of the jobs above, the required status check for
68 # merging into master (the matrix job names change with the hosts).
69 ci:
70 needs: [list, check, outputs]
71 if: always()
72 runs-on: ubuntu-latest
73 steps:
74 - env:
75 RESULTS: ${{ join(needs.*.result, ' ') }}
76 run: |
77 echo "results: $RESULTS"
78 for r in $RESULTS; do
79 [ "$r" = success ] || exit 1
80 done