ci: enable parallel building

Use `nix build --print-build-logs` to prefix the build output with the
name of its derivation.
This helps to distinguish build outputs when output is interleaved in
parallel builds.
This commit is contained in:
Erik Arvstedt 2025-06-02 11:52:19 +02:00
parent a52bf46031
commit fb56684999
No known key found for this signature in database
GPG key ID: 33312B944DD97846
2 changed files with 7 additions and 6 deletions

View file

@ -29,7 +29,7 @@ task:
- scenario: netnsRegtest
# This script is run as root
build_script:
- echo "sandbox = true" >> /etc/nix/nix.conf
- printf '%s\n' 'sandbox = true' 'max-jobs = auto' >> /etc/nix/nix.conf
- nix shell --inputs-from . nixpkgs#{bash,coreutils,cachix} -c ./test/ci/build.sh $scenario
- name: flake

View file

@ -17,9 +17,10 @@ trap 'rm -rf $tmpDir' EXIT
## Instantiate
time nix-instantiate "$@" --add-root "$tmpDir/drv" --indirect > /dev/null
printf "instantiated "; realpath "$tmpDir/drv"
drv=$(realpath "$tmpDir/drv")
echo "instantiated $drv"
outPath=$(nix-store --query "$tmpDir/drv")
outPath=$(nix-store --query "$drv")
if nix path-info --store "https://${cachixCache}.cachix.org" "$outPath" &>/dev/null; then
echo "$outPath has already been built successfully."
exit 0
@ -33,12 +34,12 @@ fi
if [[ $CACHIX_SIGNING_KEY ]]; then
# Speed up task by uploading store paths as soon as they are created
buildCmd="cachix watch-exec $cachixCache nix-build --"
buildCmd="cachix watch-exec $cachixCache nix -- build"
else
buildCmd=nix-build
buildCmd="nix build"
fi
$buildCmd --out-link "$tmpDir/result" "$tmpDir/drv" >/dev/null
$buildCmd --out-link "$tmpDir/result" --print-build-logs "$drv^*"
if [[ $CACHIX_SIGNING_KEY ]]; then
cachix push "$cachixCache" "$outPath"