From 01964bce5c5f85e33f2e58c07aeec40083dc78ea Mon Sep 17 00:00:00 2001 From: Jose Storopoli Date: Tue, 19 Mar 2024 06:55:16 -0300 Subject: [PATCH] ci: simplify CI (#61) * ci: simplify CI * ci: need moar disk space * ci: fix nix install errors * ci: another try at /nix permissions --- .github/workflows/Nix.yml | 87 +++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 32 deletions(-) diff --git a/.github/workflows/Nix.yml b/.github/workflows/Nix.yml index f737cd0..bb78bf1 100644 --- a/.github/workflows/Nix.yml +++ b/.github/workflows/Nix.yml @@ -18,47 +18,70 @@ jobs: with: fail-mode: true - nixos-test: - name: "NixOS Nix Test" - runs-on: ubuntu-latest + config-tests: + name: "${{ matrix.os-name }} Nix Test" + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + os-name: "Linux x86" + flake-attr: nixosConfigurations.framework.config.system.build.toplevel + - os: macos-latest + os-name: "macOS x86" + flake-attr: darwinConfigurations.macbook_x86.config.system.build.toplevel + - os: macos-14 + os-name: "macOS Apple Silicon" + flake-attr: darwinConfigurations.macbook.config.system.build.toplevel steps: - - uses: actions/checkout@v4 + - name: "Checkout Repo" + uses: actions/checkout@v4 - - name: "Install Nix ❄️" - uses: DeterminateSystems/nix-installer-action@v10 - - - name: "Nix Cache" - uses: DeterminateSystems/magic-nix-cache-action@v4 - - - name: "Build NixOS config ❄️" - run: nix build --dry-run -L '.#nixosConfigurations.framework.config.system.build.toplevel' --show-trace - - macos-x86-test: - name: "macOS Intel Nix Test" - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 + - name: Free Disk Space (Ubuntu) + if: matrix.os == 'ubuntu-latest' + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # when set to "true" but frees about 6 GB + tool-cache: true - - name: "Install Nix ❄️" - uses: DeterminateSystems/nix-installer-action@v10 + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + swap-storage: true - - name: "Nix Cache" - uses: DeterminateSystems/magic-nix-cache-action@v4 + - name: "Create dir for mounting moar disk Space" + if: matrix.os == 'ubuntu-latest' + run: | + sudo mkdir /nix - - name: "Build NixOS config ❄️" - run: nix run nix-darwin -- check --flake .#macbook_x86 + - name: "Maximize Disk Space" + if: matrix.os == 'ubuntu-latest' + uses: easimon/maximize-build-space@v8 + with: + build-mount-path: /nix + remove-dotnet: "true" + remove-android: "true" + remove-haskell: "true" + temp-reserve-mb: "100" + swap-size-mb: "4096" + root-reserve-mb: "1024" - macos-arm-test: - name: "macOS Apple Silicon Nix Test" - runs-on: macos-14 - steps: - - uses: actions/checkout@v4 + - name: "Adjust permissions for /nix" + if: matrix.os == 'ubuntu-latest' + run: | + sudo chown -R root:root /nix + sudo chmod -R 755 /nix - - name: "Install Nix ❄️" + - name: "Install Nix" uses: DeterminateSystems/nix-installer-action@v10 - name: "Nix Cache" uses: DeterminateSystems/magic-nix-cache-action@v4 - - name: "Build NixOS config ❄️" - run: nix run nix-darwin -- check --flake .#macbook + - name: "Test Nix config" + run: nix build -L '.#${{ matrix.flake-attr }}' +