Skip to content

Commit 5d8cb17

Browse files
committed
overhaul actions workflow
1 parent 54a2f75 commit 5d8cb17

File tree

1 file changed

+43
-32
lines changed

1 file changed

+43
-32
lines changed

.github/workflows/main.yml

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,101 +3,112 @@ name: 'Build NixOS WSL tarball'
33
on: [push, pull_request, release]
44

55
jobs:
6-
build:
6+
prepare:
7+
name: Prepare ⚙️
78
runs-on: ubuntu-latest
89
outputs:
910
tests: ${{ steps.tests.outputs.tests }}
1011
steps:
1112
- name: Checkout
1213
uses: actions/checkout@v3
1314
with:
14-
# Nix Flakes doesn't work on shallow clones
1515
fetch-depth: 0
1616

17-
- name: Find tests
17+
- name: Find tests 🔍
1818
id: tests
1919
run: |
2020
find tests -name '*.spec.ps1' -print0 | perl -pe 's|(.*?)\x0|"\1",|g;s|,$||;s|(.*)|tests=[\1]|' >> $GITHUB_OUTPUT
2121
22-
- name: Install nix
23-
uses: cachix/install-nix-action@v16
24-
25-
- name: Run checks
26-
run: |
27-
nix flake check
28-
29-
- name: Build tarball
30-
run: |
31-
nix build '.#nixosConfigurations.mysystem.config.system.build.tarball'
32-
33-
- name: Upload tarball
34-
uses: actions/upload-artifact@v3
22+
build:
23+
name: Build 🛠️
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v3
3528
with:
36-
name: rootfs
37-
path: result/tarball/nixos-wsl-x86_64-linux.tar.gz
29+
fetch-depth: 0
3830

39-
- name: Build installer
31+
- name: Install nix ❄️
32+
uses: cachix/install-nix-action@v18
33+
34+
- name: Build installer 🛠️
4035
run: |
4136
nix build '.#nixosConfigurations.mysystem.config.system.build.installer'
4237
43-
- name: Upload installer
38+
- name: Upload installer 📤
4439
uses: actions/upload-artifact@v3
4540
with:
4641
name: installer
4742
path: result/tarball/nixos-wsl-installer.tar.gz
4843

44+
checks:
45+
name: Run Flake Checks 📋
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v3
50+
with:
51+
fetch-depth: 0
52+
53+
- name: Install nix ❄️
54+
uses: cachix/install-nix-action@v18
55+
56+
- name: Run checks 📋
57+
run: |
58+
nix flake check
59+
4960
tests:
5061
needs:
62+
- prepare
5163
- build
5264
strategy:
5365
matrix:
5466
os:
5567
- ubuntu-latest
5668
# - windows-latest # doesn't work due to lack of nested virtualization on the runners, hopefully this will work one day
57-
test: ${{ fromJSON(needs.build.outputs.tests) }}
69+
test: ${{ fromJSON(needs.prepare.outputs.tests) }}
70+
name: Run Tests 🧪
5871
runs-on: ${{ matrix.os }}
5972
steps:
6073
- name: Checkout
6174
uses: actions/checkout@v3
6275

63-
- uses: actions/download-artifact@v3
76+
- name: Download installer 📥
77+
uses: actions/download-artifact@v3
6478
with:
6579
name: installer
6680

67-
- name: Execute test
81+
- name: Execute test 🧪
6882
run: |
6983
pwsh ${{ matrix.test }}
7084
7185
release:
7286
if: startsWith(github.ref, 'refs/tags/')
7387
needs:
88+
- checks
7489
- build
7590
- tests
91+
name: Create Release 📢
7692
runs-on: ubuntu-latest
7793
steps:
7894
- name: Checkout
7995
uses: actions/checkout@v3
8096

81-
- uses: actions/download-artifact@v3
82-
with:
83-
name: rootfs
84-
85-
- uses: actions/download-artifact@v3
97+
- name: Download installer 📥
98+
uses: actions/download-artifact@v3
8699
with:
87100
name: installer
88101

89-
- name: Generate checksums
102+
- name: Generate checksums 🔑
90103
run: |
91104
for x in *.tar.gz; do
92105
sha256sum $x > ${x}.sha256
93106
done
94107
95-
- name: Attach to release
108+
- name: Attach to release 📦
96109
uses: softprops/action-gh-release@v1
97110
with:
98111
files: |
99-
nixos-wsl-x86_64-linux.tar.gz
100-
nixos-wsl-x86_64-linux.tar.gz.sha256
101112
nixos-wsl-installer.tar.gz
102113
nixos-wsl-installer.tar.gz.sha256
103114
env:

0 commit comments

Comments
 (0)