ci: reduce evaluation memory #16

merged
opened by a.starrysky.fyi targeting main from private/minion/push-xuwsvklxosst

So, we've done some things here...

  • We're no longer evaluating homes - which was basically a double-eval anyway until we get MacOS/etc. up
  • We're splitting system evals apart from each other, which will take longer over all but reduces the peak memory usage from >10GB to ~3GB
    • 10GB was unsustainable for midnight ... we were constantly OOMing when we accidentally triggered CI twice

    • ~3GB is very sustainable for midnight :)
Changed files
+43 -63
.tangled
+43 -63
.tangled/workflows/packetmix-build.yml
··· 42 set +e 43 set -o pipefail 44 45 - eval_out=$(nix eval \ 46 - -f ./packetmix/ci.nix packages.allNixOSSystems.result.x86_64-linux.drvPath \ 47 - --show-trace --raw \ 48 - 2>&1 >/tmp/systems-drv-path | tee /dev/stderr) 49 - eval_status=$? 50 - 51 - if [ $eval_status -ne 0 ]; then 52 - echo "Evaluating your configuration failed with exit code $eval_status" 53 - echo "Please fix this and squash into your existing commits" 54 - exit $eval_status 55 - fi 56 - 57 - eval_warns=$(echo "$eval_out" | grep "evaluation warning:" || true) 58 - 59 - if [ -n "$eval_warns" ]; then 60 - echo "There were some warnings while evaluating your systems:" 61 - echo "$eval_warns" 62 - echo "Please fix these and squash into your existing commits" 63 - exit 1 64 - fi 65 - - name: Evaluate all homes 66 - command: | 67 - set +e 68 - set -o pipefail 69 70 - eval_out=$(nix eval \ 71 - -f ./packetmix/ci.nix packages.allHomes.result.x86_64-linux.drvPath \ 72 - --show-trace --raw \ 73 - 2>&1 >/tmp/homes-drv-path | tee /dev/stderr) 74 - eval_status=$? 75 - 76 - if [ $eval_status -ne 0 ]; then 77 - echo "Evaluating your configuration failed with exit code $eval_status" 78 - echo "Please fix this and squash into your existing commits" 79 - exit $eval_status 80 - fi 81 - 82 - eval_warns=$(echo "$eval_out" | grep "evaluation warning:" || true) 83 - 84 - if [ -n "$eval_warns" ]; then 85 - echo "There were some warnings while evaluating your homes:" 86 - echo "$eval_warns" 87 - echo "Please fix these and squash into your existing commits" 88 - exit 1 89 - fi 90 - name: Build all systems 91 command: | 92 set -e 93 - nix-copy-closure \ 94 - --to 'midnight' \ 95 - "$(cat /tmp/systems-drv-path)" 96 - nix build \ 97 - "$(cat /tmp/systems-drv-path)"'^*' \ 98 - --store 'ssh-ng://remoteBuilds@midnight?ssh-key=/tmp/key-ssh-remote-build' \ 99 - --eval-store auto \ 100 - --show-trace --print-out-paths 101 - - name: Build all homes 102 - command: | 103 - set -e 104 - nix-copy-closure \ 105 - --to 'midnight' \ 106 - "$(cat /tmp/homes-drv-path)" 107 - nix build \ 108 - "$(cat /tmp/homes-drv-path)"'^*' \ 109 - --store 'ssh-ng://remoteBuilds@midnight?ssh-key=/tmp/key-ssh-remote-build' \ 110 - --eval-store auto \ 111 - --show-trace --print-out-paths
··· 42 set +e 43 set -o pipefail 44 45 + mkdir -p /tmp/systems-drv-paths 46 + 47 + systems=$(nix eval \ 48 + --expr 'builtins.concatStringsSep "\n" (builtins.attrNames (import ./packetmix/ci.nix).systems.nixos)' \ 49 + --impure \ 50 + --show-trace --raw) 51 + 52 + for system in $systems; do 53 + echo "Evaluating system $system" 54 + 55 + eval_out=$(nix eval \ 56 + -f ./packetmix/ci.nix "systems.nixos.$system.result.config.build.toplevel.drvPath" \ 57 + --show-trace --raw \ 58 + 2>&1 >"/tmp/systems-drv-paths/$system" | tee /dev/stderr) 59 + eval_status=$? 60 61 + if [ $eval_status -ne 0 ]; then 62 + echo "Evaluating the system '$system' failed with exit code $eval_status" 63 + echo "Please fix this and squash into your existing commits" 64 + exit $eval_status 65 + fi 66 + 67 + eval_warns=$(echo "$eval_out" | grep "evaluation warning:" || true) 68 + 69 + if [ -n "$eval_warns" ]; then 70 + echo "There were some warnings while evaluating the system '$system':" 71 + echo "$eval_warns" 72 + echo "Please fix these and squash into your existing commits" 73 + exit 1 74 + fi 75 + done 76 - name: Build all systems 77 command: | 78 set -e 79 + 80 + for derivation_path in /tmp/systems-drv-paths/*; do 81 + echo "Building system $(basename $derivation_path)" 82 + 83 + nix-copy-closure \ 84 + --to 'midnight' \ 85 + "$(cat $derivation_path)" 86 + nix build \ 87 + "$(cat $derivation_path)"'^*' \ 88 + --store 'ssh-ng://remoteBuilds@midnight?ssh-key=/tmp/key-ssh-remote-build' \ 89 + --eval-store auto \ 90 + --show-trace --print-out-paths 91 + done