Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
ci: simplify CI (#61)
Browse files Browse the repository at this point in the history
* ci: simplify CI

* ci: need moar disk space

* ci: fix nix install errors

* ci: another try at /nix permissions
  • Loading branch information
storopoli authored Mar 19, 2024
1 parent ab635af commit 01964bc
Showing 1 changed file with 55 additions and 32 deletions.
87 changes: 55 additions & 32 deletions .github/workflows/Nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}'

0 comments on commit 01964bc

Please sign in to comment.