diff --git a/.github/workflows/build-then-cache.yaml b/.github/workflows/build-then-cache.yaml index e504e29..2c19999 100644 --- a/.github/workflows/build-then-cache.yaml +++ b/.github/workflows/build-then-cache.yaml @@ -10,6 +10,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@v16 + with: + extra-conf: | + keep-going = true + fallback = true - uses: DeterminateSystems/flake-checker-action@v9 - uses: ryanccn/attic-action@v0 with: @@ -19,26 +23,34 @@ jobs: # free useless disk space - run: 'bash ci/util_free_space_extreme.sh' # TODO: figure out how to use flake checks and use those to build it - - run: 'nix develop .#ci --command nix-fast-build --eval-workers 1 --no-nom --skip-cache -f .#nixosConfigurations.rpi4.config.system.build.toplevel' + - run: 'nix develop .#ci --command bash ci/run_builds.sh' build_x86-64_packages: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@v16 + with: + extra-conf: | + keep-going = true + fallback = true - uses: DeterminateSystems/flake-checker-action@v9 - uses: ryanccn/attic-action@v0 with: endpoint: ${{ secrets.ATTIC_ENDPOINT }} cache: ${{ secrets.ATTIC_CACHE }} token: ${{ secrets.ATTIC_TOKEN }} - - run: 'nix develop .#ci --command nix-fast-build --eval-workers 1 --no-nom --skip-cache -f .#packages.x86_64-linux.redlib' + - run: 'nix develop .#ci --command bash ci/run_builds.sh packages' build_x86-64: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@v16 + with: + extra-conf: | + keep-going = true + fallback = true - uses: DeterminateSystems/flake-checker-action@v9 - uses: ryanccn/attic-action@v0 with: @@ -48,6 +60,4 @@ jobs: # free useless disk space - run: 'bash ci/util_free_space_extreme.sh' # TODO: figure out how to use flake checks and use those to build it - - run: 'nix develop .#ci --command nix-fast-build --eval-workers 1 --no-nom --skip-cache -f .#nixosConfigurations.slab.config.system.build.toplevel' - - run: 'nix develop .#ci --command nix-fast-build --eval-workers 1 --no-nom --skip-cache -f .#nixosConfigurations.nullbox.config.system.build.toplevel' - - run: 'nix develop .#ci --command nix-fast-build --eval-workers 1 --no-nom --skip-cache -f .#nixosConfigurations.nixos-wsl.config.system.build.toplevel' + - run: 'nix develop .#ci --command bash ci/run_builds.sh config' diff --git a/.github/workflows/proactive-update.yaml b/.github/workflows/proactive-update.yaml index 9fe68d4..99065a0 100644 --- a/.github/workflows/proactive-update.yaml +++ b/.github/workflows/proactive-update.yaml @@ -13,6 +13,10 @@ jobs: steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@v16 + with: + extra-conf: | + keep-going = true + fallback = true - uses: DeterminateSystems/flake-checker-action@v9 - uses: ryanccn/attic-action@v0 with: @@ -22,13 +26,17 @@ jobs: # free useless disk space - run: 'bash ci/util_free_space_extreme.sh' - run: 'nix flake update' - - run: 'nix develop .#ci --command nix-fast-build --eval-workers 1 --no-nom --skip-cache -f .#nixosConfigurations.rpi4.config.system.build.toplevel' + - run: 'nix develop .#ci --command bash ci/run_builds.sh' build_x86: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@v16 + with: + extra-conf: | + keep-going = true + fallback = true - uses: DeterminateSystems/flake-checker-action@v9 - uses: ryanccn/attic-action@v0 with: @@ -38,6 +46,4 @@ jobs: # free useless disk space - run: 'bash ci/util_free_space_extreme.sh' - run: 'nix flake update' - - run: 'nix develop .#ci --command nix-fast-build --eval-workers 1 --no-nom --skip-cache -f .#nixosConfigurations.nullbox.config.system.build.toplevel' - - run: 'nix develop .#ci --command nix-fast-build --eval-workers 1 --no-nom --skip-cache -f .#nixosConfigurations.slab.config.system.build.toplevel' - - run: 'nix develop .#ci --command nix-fast-build --eval-workers 1 --no-nom --skip-cache -f .#nixosConfigurations.nixos-wsl.config.system.build.toplevel' + - run: 'nix develop .#ci --command bash ci/run_builds.sh' diff --git a/ci/run_builds.sh b/ci/run_builds.sh new file mode 100755 index 0000000..691c5c9 --- /dev/null +++ b/ci/run_builds.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +set -Exo pipefail + +err=0 + +set_error () { + err=1 +} + +trap set_error ERR + +system="$(nix eval --impure --raw --expr 'builtins.currentSystem')" + + +run_builds () { + for i in "$@" ; do + nix-fast-build --eval-workers 1 --no-nom --skip-cache --attic-cache main -f "$i" + done +} + +build_systems () { + case "$system" in + x86_64-linux) run_builds \ + .\#nixosConfigurations.nullbox.config.system.build.toplevel \ + .\#nixosConfigurations.slab.config.system.build.toplevel \ + .\#nixosConfigurations.nixos-wsl.config.system.build.toplevel \ + ;; + + aarch64-linux) run_builds \ + .\#nixosConfigurations.rpi4.config.system.build.toplevel \ + ;; + esac +} + +build_packages () { + run_builds .\#packages."${system}".redlib +} + + +if [[ "$#" -ne 0 ]] ; then + until [[ "$#" -le 0 ]]; do + case "$1" in + pkgs|packages) DO_PACKAGES=1;; + config) DO_CONFIG=1;; + esac + shift + done +else + DO_PACKAGES=1 + DO_CONFIG=1 +fi + +if [[ -n "${DO_CONFIG:+x}" ]] ; then build_systems; fi +if [[ -n "${DO_PACKAGES:+x}" ]] ; then build_packages; fi + +exit $err