Each CI job ran in its own `nix build`, and its output path came from a second `nix eval`. Every one of those evaluations paid ~15s and ~4 GiB to evaluate the flake before reaching its job, and import from derivation stalled each job in turn. The final `ciDrv` evaluation covered every job once more. Evaluate everything once with `nix-eval-jobs` instead: workers keep the shared evaluation for several jobs and wait on import from derivation in parallel, and the worker count and memory bound cap evaluation at 24 GiB of the 40 GiB `git` VM. Build every job in one `nix build --keep-going`, push the results in one copy, and build the profiled link farm from the known output paths, which makes `ciDrv` unnecessary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
58 lines
1.9 KiB
YAML
58 lines
1.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
|
|
# Only the newest commit is worth building and caching
|
|
concurrency:
|
|
group: ci
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
check:
|
|
name: Check, build and cache nixfiles
|
|
runs-on: ubuntu-26.04
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: DeterminateSystems/determinate-nix-action@v3
|
|
with:
|
|
# Gitea will supply a token in GITHUB_TOKEN, which this action passes to
|
|
# Nix (as access-tokens) when downloading from GitHub
|
|
github-token: ${{ secrets.GH_PULL_TOKEN }}
|
|
extra-conf: |
|
|
# Make sure we're using sandbox
|
|
sandbox-fallback = false
|
|
# Big C++ projects fill up memory...
|
|
cores = 6
|
|
|
|
# Determinate performance features
|
|
lazy-trees = true
|
|
eval-cores = 0
|
|
|
|
accept-flake-config = true
|
|
extra-substituters = https://nix-cache.nul.ie
|
|
extra-trusted-public-keys = nix-cache.nul.ie-1:BzH5yMfF4HbzY1C977XzOxoPhEc9Zbu39ftPkUbH+m4=
|
|
|
|
- name: Check flake
|
|
id: ifd
|
|
run: |
|
|
reasons="$(nix eval --option allow-import-from-derivation false --json .#ciIfdReasons.x86_64-linux)"
|
|
required="$(jq -r 'length > 0' <<< "$reasons")"
|
|
echo "required=$required" >> "$GITHUB_OUTPUT"
|
|
|
|
if [[ "$required" == true ]]; then
|
|
jq -r '.[] | "::warning::\(.). The flake check will run after the target builds."' <<< "$reasons"
|
|
else
|
|
nix flake check --no-build --option allow-import-from-derivation false
|
|
fi
|
|
|
|
- name: Build (and cache) the world
|
|
id: build
|
|
env:
|
|
HARMONIA_SSH_KEY: ${{ secrets.HARMONIA_SSH_KEY }}
|
|
CI_IFD_REQUIRED: ${{ steps.ifd.outputs.required }}
|
|
run: >-
|
|
nix shell .#nixpkgs.unstable.x86_64-linux.python3 .#nixpkgs.unstable.x86_64-linux.nix-eval-jobs
|
|
--command python3 ci/build-and-cache.py
|