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:
parent
a52bf46031
commit
fb56684999
2 changed files with 7 additions and 6 deletions
|
|
@ -29,7 +29,7 @@ task:
|
||||||
- scenario: netnsRegtest
|
- scenario: netnsRegtest
|
||||||
# This script is run as root
|
# This script is run as root
|
||||||
build_script:
|
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
|
- nix shell --inputs-from . nixpkgs#{bash,coreutils,cachix} -c ./test/ci/build.sh $scenario
|
||||||
|
|
||||||
- name: flake
|
- name: flake
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,10 @@ trap 'rm -rf $tmpDir' EXIT
|
||||||
## Instantiate
|
## Instantiate
|
||||||
|
|
||||||
time nix-instantiate "$@" --add-root "$tmpDir/drv" --indirect > /dev/null
|
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
|
if nix path-info --store "https://${cachixCache}.cachix.org" "$outPath" &>/dev/null; then
|
||||||
echo "$outPath has already been built successfully."
|
echo "$outPath has already been built successfully."
|
||||||
exit 0
|
exit 0
|
||||||
|
|
@ -33,12 +34,12 @@ fi
|
||||||
|
|
||||||
if [[ $CACHIX_SIGNING_KEY ]]; then
|
if [[ $CACHIX_SIGNING_KEY ]]; then
|
||||||
# Speed up task by uploading store paths as soon as they are created
|
# 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
|
else
|
||||||
buildCmd=nix-build
|
buildCmd="nix build"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$buildCmd --out-link "$tmpDir/result" "$tmpDir/drv" >/dev/null
|
$buildCmd --out-link "$tmpDir/result" --print-build-logs "$drv^*"
|
||||||
|
|
||||||
if [[ $CACHIX_SIGNING_KEY ]]; then
|
if [[ $CACHIX_SIGNING_KEY ]]; then
|
||||||
cachix push "$cachixCache" "$outPath"
|
cachix push "$cachixCache" "$outPath"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue