Skip to content

Commit

Permalink
speed up ci by splitting off eval and build
Browse files Browse the repository at this point in the history
also improve error reporting e.g. printing out what actually failed to
build.
  • Loading branch information
Mic92 committed Dec 14, 2024
1 parent 7bd8ece commit d3a6458
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ on:
permissions: read-all

jobs:
eval:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v30
- if: matrix.os == 'ubuntu-latest'
run: |
(
while sleep 10; do
free -h
done
) &
- run: nix --experimental-features 'nix-command flakes' flake show --all-systems --json

tests:
needs: [check_secrets]
Expand All @@ -33,25 +48,12 @@ jobs:
name: '${{ env.CACHIX_NAME }}'
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- if: matrix.os == 'ubuntu-latest'
run: |
free -h
swapon --show
swap=$(swapon --show --noheadings | head -n 1 | awk '{print $1}')
echo "Found swap: $swap"
sudo swapoff $swap
# resize it (fallocate)
sudo fallocate -l 10G $swap
sudo mkswap $swap
sudo swapon $swap
free -h
(
while sleep 60; do
free -h
done
) &
- run: nix --experimental-features 'nix-command flakes' flake check -L
- run: nix --experimental-features 'nix-command flakes' flake show --all-systems --json
- run:
system=$(nix eval --raw --impure --expr builtins.currentSystem)
echo $PATH
nix eval --json ".#checks.$system" --apply builtins.attrNames | \
jq -r '.[]' | \
xargs -P0 -I '{}' sh -c "nix build -L .#checks.$system.{} || { echo -e '\033[0;31mnix build -L .#checks.$system.{} failed\\033[0m'; kill 0; }"

# Steps to test CI automation in your own fork.
# Cachix:
Expand Down

0 comments on commit d3a6458

Please sign in to comment.