Skip to content

Commit 2fbf7e3

Browse files
committed
ci: batch nix workflow targets
1 parent 8971743 commit 2fbf7e3

2 files changed

Lines changed: 73 additions & 69 deletions

File tree

.github/actions/setup-nix/action.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: Setup Nix
2-
description: Install Nix, configure Cachix, and build a flake target.
1+
name: Nix Build
2+
description: Install Nix, configure Cachix, and build flake targets.
33

44
inputs:
55
build:
@@ -8,8 +8,8 @@ inputs:
88
system:
99
description: Nix system to build for.
1010
required: true
11-
target:
12-
description: Package or check target to build.
11+
targets:
12+
description: Newline-separated package or check targets to build.
1313
required: true
1414
cachix_auth_token:
1515
description: Cachix write token.
@@ -31,6 +31,17 @@ runs:
3131
authToken: ${{ inputs.cachix_auth_token }}
3232
skipAddingSubstituter: true
3333

34-
- name: Build target
34+
- name: Build targets
3535
shell: bash
36-
run: nix build ".#${{ inputs.build }}.${{ inputs.system }}.${{ inputs.target }}" --no-link --no-update-lock-file
36+
env:
37+
BUILD: ${{ inputs.build }}
38+
SYSTEM: ${{ inputs.system }}
39+
TARGETS: ${{ inputs.targets }}
40+
run: |
41+
attrs=()
42+
while IFS= read -r target; do
43+
[ -n "$target" ] || continue
44+
attrs+=(".#${BUILD}.${SYSTEM}.${target}")
45+
done <<< "$TARGETS"
46+
47+
nix build "${attrs[@]}" --no-link --no-update-lock-file

.github/workflows/nix-ci.yml

Lines changed: 56 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ defaults:
2323

2424
jobs:
2525
build:
26-
name: Build ${{ matrix.package }} (${{ matrix.target.system }})
26+
name: Build (${{ matrix.target.system }})
2727
runs-on: ${{ matrix.target.runner }}
2828
strategy:
2929
fail-fast: false
@@ -33,26 +33,25 @@ jobs:
3333
runner: linux-amd64-cpu8
3434
- system: aarch64-linux
3535
runner: linux-arm64-cpu8
36-
package:
37-
- openshell
38-
- openshell-gateway
39-
- openshell-sandbox
40-
- openshell-driver-kubernetes
41-
- openshell-driver-podman
42-
- openshell-driver-vm
4336
steps:
4437
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
4538

46-
- name: Build package
39+
- name: Build packages
4740
uses: ./.github/actions/setup-nix
4841
with:
4942
build: packages
5043
system: ${{ matrix.target.system }}
51-
target: ${{ matrix.package }}
44+
targets: |
45+
openshell
46+
openshell-gateway
47+
openshell-sandbox
48+
openshell-driver-kubernetes
49+
openshell-driver-podman
50+
openshell-driver-vm
5251
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
5352

5453
images:
55-
name: Build Image ${{ matrix.image }} (${{ matrix.target.system }})
54+
name: Build Images (${{ matrix.target.system }})
5655
needs: build
5756
runs-on: ${{ matrix.target.runner }}
5857
strategy:
@@ -63,22 +62,21 @@ jobs:
6362
runner: linux-amd64-cpu8
6463
- system: aarch64-linux
6564
runner: linux-arm64-cpu8
66-
image:
67-
- openshell-gateway-image
68-
- openshell-supervisor-image
6965
steps:
7066
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
7167

72-
- name: Build image
68+
- name: Build images
7369
uses: ./.github/actions/setup-nix
7470
with:
7571
build: packages
7672
system: ${{ matrix.target.system }}
77-
target: ${{ matrix.image }}
73+
targets: |
74+
openshell-gateway-image
75+
openshell-supervisor-image
7876
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
7977

8078
test:
81-
name: Test ${{ matrix.check }} (${{ matrix.target.system }})
79+
name: Test (${{ matrix.target.system }})
8280
needs: build
8381
runs-on: ${{ matrix.target.runner }}
8482
strategy:
@@ -89,68 +87,63 @@ jobs:
8987
runner: linux-amd64-cpu8
9088
- system: aarch64-linux
9189
runner: linux-arm64-cpu8
92-
check:
93-
- openshell-bootstrap-test
94-
- openshell-cli-test
95-
- openshell-core-test
96-
- openshell-driver-docker-test
97-
- openshell-driver-kubernetes-test
98-
- openshell-driver-podman-test
99-
- openshell-driver-vm-test
100-
- openshell-ocsf-test
101-
- openshell-policy-test
102-
- openshell-prover-test
103-
- openshell-providers-test
104-
- openshell-router-test
105-
- openshell-sandbox-test
106-
- openshell-server-macros-test
107-
- openshell-server-test
108-
- openshell-tui-test
109-
- openshell-vfio-test
11090
steps:
11191
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
11292

113-
- name: Run test
93+
- name: Run tests
11494
uses: ./.github/actions/setup-nix
11595
with:
11696
build: checks
11797
system: ${{ matrix.target.system }}
118-
target: ${{ matrix.check }}
98+
targets: |
99+
openshell-bootstrap-test
100+
openshell-cli-test
101+
openshell-core-test
102+
openshell-driver-docker-test
103+
openshell-driver-kubernetes-test
104+
openshell-driver-podman-test
105+
openshell-driver-vm-test
106+
openshell-ocsf-test
107+
openshell-policy-test
108+
openshell-prover-test
109+
openshell-providers-test
110+
openshell-router-test
111+
openshell-sandbox-test
112+
openshell-server-macros-test
113+
openshell-server-test
114+
openshell-tui-test
115+
openshell-vfio-test
119116
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
120117

121118
lint:
122-
name: Lint ${{ matrix.lint }}
119+
name: Lint
123120
runs-on: linux-amd64-cpu8
124-
strategy:
125-
fail-fast: false
126-
matrix:
127-
lint:
128-
- rustfmt
129-
- spdx-headers
130-
- openshell-bootstrap-clippy
131-
- openshell-cli-clippy
132-
- openshell-core-clippy
133-
- openshell-driver-docker-clippy
134-
- openshell-driver-kubernetes-clippy
135-
- openshell-driver-podman-clippy
136-
- openshell-driver-vm-clippy
137-
- openshell-ocsf-clippy
138-
- openshell-policy-clippy
139-
- openshell-prover-clippy
140-
- openshell-providers-clippy
141-
- openshell-router-clippy
142-
- openshell-sandbox-clippy
143-
- openshell-server-macros-clippy
144-
- openshell-server-clippy
145-
- openshell-tui-clippy
146-
- openshell-vfio-clippy
147121
steps:
148122
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
149123

150-
- name: Run lint
124+
- name: Run lints
151125
uses: ./.github/actions/setup-nix
152126
with:
153127
build: checks
154128
system: x86_64-linux
155-
target: ${{ matrix.lint }}
129+
targets: |
130+
rustfmt
131+
spdx-headers
132+
openshell-bootstrap-clippy
133+
openshell-cli-clippy
134+
openshell-core-clippy
135+
openshell-driver-docker-clippy
136+
openshell-driver-kubernetes-clippy
137+
openshell-driver-podman-clippy
138+
openshell-driver-vm-clippy
139+
openshell-ocsf-clippy
140+
openshell-policy-clippy
141+
openshell-prover-clippy
142+
openshell-providers-clippy
143+
openshell-router-clippy
144+
openshell-sandbox-clippy
145+
openshell-server-macros-clippy
146+
openshell-server-clippy
147+
openshell-tui-clippy
148+
openshell-vfio-clippy
156149
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}

0 commit comments

Comments
 (0)