Skip to content

Commit

Permalink
Try matrix jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
joinemm committed Jun 17, 2024
1 parent d5938f9 commit aefdcb6
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@ on:
- master

jobs:
build:

define-matrix:
runs-on: ubuntu-latest
outputs:
hosts: $

steps:
- uses: jlumbroso/free-disk-space@main
with:
large-packages: false
- uses: actions/checkout@v4

- name: Define hosts
run: |
hosts=[$(nix flake show --json | jq '.nixosConfigurations | keys[]' | paste -sd, -)]
echo "hosts=$hosts" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: define-matrix
strategy:
matrix:
host: ${{ fromJSON(needs.define-matrix.outputs.hosts) }}

steps:
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v27
Expand All @@ -27,13 +42,9 @@ jobs:
with:
name: joinemm
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: build all hosts

- name: Build ${{ matrix.host }}
env:
host: ${{ matrix.host }}
run: |
set -e
for host in `nix flake show --json | jq '.nixosConfigurations | keys[]'`; do
echo "--- Building configuration for \"$host\" ---"
nix build .#nixosConfigurations.$host.config.system.build.toplevel --no-link
nix-collect-garbage
done
nix build .#nixosConfigurations.$host.config.system.build.toplevel

0 comments on commit aefdcb6

Please sign in to comment.