Skip to content

Commit d76a862

Browse files
committed
Split flake checks into matrix job
1 parent 2c8f69b commit d76a862

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

.github/workflows/main.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@ jobs:
1919
run: |
2020
find tests -name '*.spec.ps1' -print0 | perl -pe 's|(.*?)\x0|"\1",|g;s|,$||;s|(.*)|tests=[\1]|' >> $GITHUB_OUTPUT
2121
22+
find-checks:
23+
name: Find Flake Checks 🔍
24+
runs-on: ubuntu-latest
25+
outputs:
26+
checks: ${{ steps.checks.outputs.checks }}
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Install nix ❄️
34+
uses: cachix/install-nix-action@v18
35+
36+
- name: Find checks 🔍
37+
id: checks
38+
run: |
39+
nix-instantiate --json --eval --strict -E 'with builtins; attrNames (getFlake (toString ./.)).checks.${currentSystem}' | perl -pe 's|(.*)|checks=\1|' >>$GITHUB_OUTPUT
40+
2241
build:
2342
name: Build 🛠️
2443
runs-on: ubuntu-latest
@@ -42,7 +61,13 @@ jobs:
4261
path: result/tarball/nixos-wsl-installer.tar.gz
4362

4463
checks:
45-
name: Run Flake Checks 📋
64+
name: Flake Checks 📋
65+
needs:
66+
- find-checks
67+
strategy:
68+
fail-fast: false
69+
matrix:
70+
check: ${{ fromJSON(needs.find-checks.outputs.checks) }}
4671
runs-on: ubuntu-latest
4772
steps:
4873
- name: Checkout
@@ -53,11 +78,12 @@ jobs:
5378
- name: Install nix ❄️
5479
uses: cachix/install-nix-action@v18
5580

56-
- name: Run checks 📋
81+
- name: Run check 📋
5782
run: |
58-
nix flake check -L
83+
nix build -L --expr "with builtins; (getFlake (toString ./.)).checks.\${currentSystem}.${{ matrix.check }}"
5984
6085
tests:
86+
name: Test 🧪
6187
needs:
6288
- find-tests
6389
- build
@@ -68,7 +94,6 @@ jobs:
6894
- ubuntu-latest
6995
# - windows-latest # doesn't work due to lack of nested virtualization on the runners, hopefully this will work one day
7096
test: ${{ fromJSON(needs.find-tests.outputs.tests) }}
71-
name: Test 🧪
7297
runs-on: ${{ matrix.os }}
7398
steps:
7499
- name: Checkout

0 commit comments

Comments
 (0)