@@ -79,18 +79,14 @@ jobs:
7979 with :
8080 ref : ${{ github.event.inputs.ref }}
8181
82- - name : Install Nix
83- uses : DeterminateSystems/nix-installer-action@main
84-
85- - name : Cache Nix store
86- uses : nix-community/cache -nix-action@v6
82+ # Install Nix natively + cache the /nix/store. The flake check builds
83+ # nothing, so it gets its own smaller cache (distinct prefix + gc cap) so
84+ # it doesn't share an entry with the large image builds.
85+ - name : Set up Nix
86+ uses : ./.github/actions/setup -nix
8787 with :
88- # Key on the lockfile + all Nix sources; restore the most recent
89- # arch-matching cache otherwise. Cap the saved store so a run can't
90- # blow past the repo's GitHub Actions cache budget.
91- primary-key : nix-flake-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.lock', '**/*.nix') }}
92- restore-prefixes-first-match : nix-flake-${{ runner.os }}-${{ runner.arch }}-
93- gc-max-store-size-linux : 5G
88+ cache-key-prefix : nix-flake
89+ gc-max-store-size : 5G
9490
9591 - name : Flake check
9692 run : make check
@@ -146,22 +142,19 @@ jobs:
146142 name : Build ${{ needs.plan.outputs.kinds }} (${{ matrix.system }})
147143 runs-on : ${{ matrix.runner }}
148144 env :
149- # Resolved per-kind plan from the `plan` job. Steps below branch on these.
145+ # Resolved per-kind plan from the `plan` job. Steps below (the build-plan
146+ # summary + the per-kind build/upload gating) branch on these. The
147+ # build-iso action instead receives the plan per kind via its `full` input.
148+ #
149+ # PR title/number + branch are passed straight to the build-iso action's
150+ # inputs (pr-title / pr-number / branch): the title + number are woven into
151+ # the image's pretty version name (coderBox.prTitle / coderBox.prNumber),
152+ # and the branch feeds the boot-screen "<short-sha>@<branch>" stamp
153+ # (github.head_ref is the real source branch on PRs — a PR checkout is a
154+ # detached HEAD — and empty otherwise so the Makefile falls back to the
155+ # local branch name; tag/main builds keep their plain names).
150156 INSTALLER_FULL : ${{ needs.plan.outputs.installer_full }}
151157 APPLIANCE_FULL : ${{ needs.plan.outputs.appliance_full }}
152- # PR title + number woven into the image's pretty version name (boot-menu
153- # label + ISO file name) via coderBox.prTitle / coderBox.prNumber. Set
154- # through `env:` (not inlined into a run script) so an arbitrary title
155- # can't break the shell, and empty for non-PR events so tag/main builds
156- # keep their plain names.
157- CODER_BOX_PR_TITLE : ${{ github.event.pull_request.title }}
158- CODER_BOX_PR_NUMBER : ${{ github.event.pull_request.number }}
159- # Branch name for the boot-screen label's "<short-sha>@<branch>" stamp. A
160- # PR checkout is a detached HEAD (so the Makefile's `git rev-parse
161- # --abbrev-ref HEAD` would say "HEAD"); github.head_ref is the real source
162- # branch on pull_request events and empty otherwise (the Makefile then
163- # falls back to the local branch name).
164- CODER_BOX_BRANCH : ${{ github.head_ref }}
165158 strategy :
166159 fail-fast : false
167160 matrix :
@@ -178,62 +171,55 @@ jobs:
178171 # dispatch to build an arbitrary commit.
179172 ref : ${{ github.event.inputs.ref }}
180173
181- - name : Install Nix
182- uses : DeterminateSystems/nix-installer-action@main
183-
184- - name : Cache Nix store
185- uses : nix-community/cache-nix-action@v6
186- with :
187- # ISO closures are large; cap the saved store so a build can't blow
188- # past the repo's GitHub Actions cache budget (10G total).
189- primary-key : nix-images-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('flake.lock', '**/*.nix') }}
190- restore-prefixes-first-match : nix-images-${{ runner.os }}-${{ runner.arch }}-
191- gc-max-store-size-linux : 8G
174+ # Install Nix natively + cache the /nix/store (shared with the release
175+ # workflow so both build images the exact same way).
176+ - name : Set up Nix
177+ uses : ./.github/actions/setup-nix
192178
193- # Per-kind plan (full ISO vs drv only) is in the job name; the run summary
194- # below also records it. INSTALLER_FULL / APPLIANCE_FULL come from the
195- # job-level env above.
196- - name : Build images
179+ # Record the per-kind plan (full ISO vs drv only, in the job name too) in
180+ # the run summary, and stage one dist dir that both kinds' builds collect
181+ # into so the size/upload steps below have a single place to look.
182+ # INSTALLER_FULL / APPLIANCE_FULL come from the job-level env above.
183+ - name : Build plan
197184 id : build
198- env :
199- # These are verification images, not shipped artifacts, so trade ISO
200- # size for build speed: a low squashfs compression level is far faster
201- # than the nixpkgs default (zstd level 19), which otherwise dominates
202- # the build — and the rev baked into /etc forces that recompress on
203- # every commit regardless of caching. Releases keep the slow default.
204- ISO_COMPRESSION : zstd -Xcompression-level 3
205185 run : |
206- # Record the per-kind plan in the run summary for quick scanning.
207186 plan() { [ "$1" = "true" ] && echo "full ISO" || echo "derivation only"; }
208187 {
209188 echo "### Build plan (${{ matrix.system }})"
210189 echo "- installer: $(plan "$INSTALLER_FULL")"
211190 echo "- appliance: $(plan "$APPLIANCE_FULL")"
212191 } >>"$GITHUB_STEP_SUMMARY"
192+ echo "dist=$(mktemp -d)" >>"$GITHUB_OUTPUT"
213193
214- # Nix is on the host now, so make/git (preinstalled on the runner)
215- # build straight into the host /nix/store — no container. A full build
216- # → make <kind>/iso, then dereference the image + its .sha256 sidecar
217- # (colocated in out/<kind>-iso/iso) into a real dir for upload; a
218- # drv-only kind just instantiates. Bare target → native currentSystem.
219- dist="$(mktemp -d)"
220- echo "dist=$dist" >>"$GITHUB_OUTPUT"
221- # Nix is on the host (make/git preinstalled on the runner) so the
222- # build goes straight into the host /nix/store — no container. The
223- # job-level CODER_BOX_PR_TITLE / CODER_BOX_PR_NUMBER env is inherited
224- # by make directly (read under --impure for the pretty version name).
225- build_kind() {
226- kind="$1"; full="$2"
227- if [ "$full" = "true" ]; then
228- make "$kind/iso"
229- cp -L "out/$kind-iso/iso"/* "$dist/"
230- else
231- make "$kind/drv"
232- fi
233- }
234- build_kind installer "$INSTALLER_FULL"
235- build_kind appliance "$APPLIANCE_FULL"
236- ls -lh "$dist"
194+ # Build each kind through the shared action (same as the release workflow).
195+ # These are verification images, not shipped artifacts, so trade ISO size
196+ # for build speed via ISO_COMPRESSION: a low squashfs compression level is
197+ # far faster than the nixpkgs default (zstd level 19), which otherwise
198+ # dominates the build — and the rev baked into /etc forces that recompress
199+ # on every commit regardless of caching. Releases keep the slow default.
200+ # Both kinds collect into the one staged dist dir; a drv-only kind
201+ # (full=false) instantiates without adding an ISO.
202+ - name : Build installer
203+ uses : ./.github/actions/build-iso
204+ with :
205+ target : installer
206+ full : ${{ env.INSTALLER_FULL }}
207+ dist : ${{ steps.build.outputs.dist }}
208+ iso-compression : zstd -Xcompression-level 3
209+ pr-title : ${{ github.event.pull_request.title }}
210+ pr-number : ${{ github.event.pull_request.number }}
211+ branch : ${{ github.head_ref }}
212+
213+ - name : Build appliance
214+ uses : ./.github/actions/build-iso
215+ with :
216+ target : appliance
217+ full : ${{ env.APPLIANCE_FULL }}
218+ dist : ${{ steps.build.outputs.dist }}
219+ iso-compression : zstd -Xcompression-level 3
220+ pr-title : ${{ github.event.pull_request.title }}
221+ pr-number : ${{ github.event.pull_request.number }}
222+ branch : ${{ github.head_ref }}
237223
238224 # Record the exact byte size of every ISO this arch actually built, one
239225 # TSV row per ISO (system, filename, bytes). The iso-table job downloads
0 commit comments