Skip to content

Commit 691b1ea

Browse files
committed
speed up ci by splitting off eval and build
- This speeds up macOS builds from 30 minutes to 11 minutes (3x faster). - Also improve error reporting e.g. printing out what actually failed to build. - As a result we also no longer need swap.
1 parent 7bd8ece commit 691b1ea

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ on:
77
permissions: read-all
88

99
jobs:
10+
eval:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- uses: cachix/install-nix-action@v30
17+
- run: nix --experimental-features 'nix-command flakes' flake show --all-systems --json
1018

1119
tests:
1220
needs: [check_secrets]
@@ -33,25 +41,7 @@ jobs:
3341
name: '${{ env.CACHIX_NAME }}'
3442
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
3543
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
36-
- if: matrix.os == 'ubuntu-latest'
37-
run: |
38-
free -h
39-
swapon --show
40-
swap=$(swapon --show --noheadings | head -n 1 | awk '{print $1}')
41-
echo "Found swap: $swap"
42-
sudo swapoff $swap
43-
# resize it (fallocate)
44-
sudo fallocate -l 10G $swap
45-
sudo mkswap $swap
46-
sudo swapon $swap
47-
free -h
48-
(
49-
while sleep 60; do
50-
free -h
51-
done
52-
) &
53-
- run: nix --experimental-features 'nix-command flakes' flake check -L
54-
- run: nix --experimental-features 'nix-command flakes' flake show --all-systems --json
44+
- run: scripts/build-checks
5545

5646
# Steps to test CI automation in your own fork.
5747
# Cachix:

scripts/build-checks

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
system=$(nix eval --raw --impure --expr builtins.currentSystem)
4+
nix eval --json ".#checks.$system" --apply builtins.attrNames | \
5+
jq -r '.[]' | \
6+
xargs -P0 -I '{}' sh -c "nix build -L .#checks.$system.{} || { echo 'FAILED: \033[0;31mnix build -L .#checks.$system.{}\\033[0m'; kill 0; }"

0 commit comments

Comments
 (0)