-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (65 loc) · 2.42 KB
/
build-systems.yaml
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
name: "Build system config"
on:
pull_request:
workflow_dispatch:
push:
branches: [ main ]
schedule:
# Build twice a week to ensure that the cache is always primed
- cron: '42 23 * * 1,5'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v2
- name: nix flake check
run: |
nix flake check --no-build
echo "## \`nix flake check\` succeeded" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
- name: Discover nixosConfigurations
run: |
echo Discovered the following system configs
nix flake show . --json | jq ".nixosConfigurations|keys[]" -r
- name: Build systems
id: build
run: |
echo "## Building" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| | Host | Out path |" >> $GITHUB_STEP_SUMMARY
echo "| --- | ---- | -------- |" >> $GITHUB_STEP_SUMMARY
any_failed=false
for host in $(nix flake show . --json | jq ".nixosConfigurations|keys[]" -r); do
echo "::group::Building ${host}"
drv=".#nixosConfigurations.$host.config.system.build.toplevel"
build_cmd="nix build ${drv}"
failed=false
$build_cmd --show-trace || { failed=true; any_failed=true; }
echo "::endgroup::"
if ! $failed; then
symbol="✅"
out_path=$($build_cmd --print-out-paths)
out_path="\`${out_path}\`"
echo -e "\x1b[32;1mSuccessfully built .#nixosConfigurations.${host}\x1b[0m"
else
symbol="❌"
out_path="_build failed_"
echo -e "\x1b[31;1mFailed to build .#nixosConfigurations.${host}\x1b[0m"
fi
echo "| $symbol | ${host} | ${out_path} |" >> $GITHUB_STEP_SUMMARY
done
# Set return-code to 1 if any failed
! $any_failed
- name: Diff closures
# Still would like to see the changes for the non-failing hosts
if: ${{ success() }} || ${{ failure() }}
run: ./.github/scripts/diff-hosts.sh
- name: Colmena build
# This should not cause additional builds. But try to run this command to avoid problems with out colmena configuration
run: nix run .#colmena build