Skip to content

Commit bf8973a

Browse files
committed
ci(release): decouple slow NetBSD build from publishing
The release job used `needs: [build, build-bsd]`, and the build-bsd matrix only completes when both BSD legs finish — so the slow NetBSD leg blocked the whole release. NetBSD stalls provisioning Rust because `pkgin` fetches the full pkg_summary and rebuilds its DB over the slow ftp.NetBSD.org mirror before pulling the large Rust/LLVM tree. - Split build-bsd into separate build-freebsd and build-netbsd jobs. - release now needs [build, build-freebsd] only, so it publishes without ever waiting for NetBSD. - build-netbsd installs Rust via `pkg_add` from the fast cdn.NetBSD.org mirror (no pkgin summary/DB rebuild), is time-boxed to 60 min, and is continue-on-error so it can't turn the run red. - New release-netbsd job attaches the NetBSD tarball to the already-published release once it's ready, and skips cleanly if NetBSD didn't build.
1 parent 720eedb commit bf8973a

1 file changed

Lines changed: 111 additions & 27 deletions

File tree

.github/workflows/release.yml

Lines changed: 111 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -155,26 +155,11 @@ jobs:
155155
dist/*.rpm*
156156
if-no-files-found: error
157157

158-
build-bsd:
159-
name: ${{ matrix.label }}
158+
# FreeBSD builds quickly and reliably (`pkg install` from a fast CDN), so it
159+
# stays on the release's critical path.
160+
build-freebsd:
161+
name: freebsd-amd64
160162
runs-on: ubuntu-latest
161-
strategy:
162-
fail-fast: false
163-
matrix:
164-
include:
165-
# squeezed is pure Rust with no C dependencies — the base system's
166-
# Rust toolchain is all that's needed.
167-
- label: freebsd-amd64
168-
os: freebsd
169-
os_version: "14.3"
170-
arch: x86-64
171-
install_deps: sudo env ASSUME_ALWAYS_YES=YES pkg install -y rust
172-
- label: netbsd-amd64
173-
os: netbsd
174-
os_version: "10.1"
175-
arch: x86-64
176-
install_deps: sudo pkgin -y update && sudo pkgin -y install rust
177-
178163
steps:
179164
- name: Checkout
180165
uses: actions/checkout@v4
@@ -183,12 +168,12 @@ jobs:
183168
# the workflow was dispatched from.
184169
ref: ${{ inputs.tag || github.ref }}
185170

186-
- name: Start ${{ matrix.os }} ${{ matrix.arch }} VM
171+
- name: Start freebsd x86-64 VM
187172
uses: cross-platform-actions/action@v1.3.0
188173
with:
189-
operating_system: ${{ matrix.os }}
190-
version: ${{ matrix.os_version }}
191-
architecture: ${{ matrix.arch }}
174+
operating_system: freebsd
175+
version: "14.3"
176+
architecture: x86-64
192177
shell: bash
193178
memory: 8G
194179
cpu_count: 4
@@ -197,7 +182,7 @@ jobs:
197182
shell: cpa.sh {0}
198183
run: |
199184
set -euo pipefail
200-
${{ matrix.install_deps }}
185+
sudo env ASSUME_ALWAYS_YES=YES pkg install -y rust
201186
# Keep target/ outside the workspace so it isn't synced back
202187
export CARGO_TARGET_DIR="$HOME/build"
203188
cargo build --release --locked --bin squeezed
@@ -213,7 +198,7 @@ jobs:
213198
else
214199
version="${GITHUB_REF_NAME}"
215200
fi
216-
name="squeezed-${version}-${{ matrix.label }}"
201+
name="squeezed-${version}-freebsd-amd64"
217202
mkdir -p dist/staging
218203
install -m 0755 dist/squeezed dist/staging/squeezed
219204
cp README.md LICENSE squeezed.example.toml dist/staging/
@@ -224,13 +209,81 @@ jobs:
224209
- name: Upload artifact
225210
uses: actions/upload-artifact@v4
226211
with:
227-
name: ${{ matrix.label }}
212+
name: freebsd-amd64
213+
path: dist/*.tar.gz*
214+
if-no-files-found: error
215+
216+
# NetBSD is slow to provision (large Rust/LLVM toolchain over pkgsrc), so it
217+
# is fully decoupled: it never gates the release (see the `release` job's
218+
# `needs`), it is time-boxed so it can't hang the run, and its asset is
219+
# attached to the already-published release by `release-netbsd`.
220+
build-netbsd:
221+
name: netbsd-amd64
222+
runs-on: ubuntu-latest
223+
timeout-minutes: 60
224+
# A NetBSD failure/timeout must not turn the whole release run red — the
225+
# release is already published independently.
226+
continue-on-error: true
227+
steps:
228+
- name: Checkout
229+
uses: actions/checkout@v4
230+
with:
231+
ref: ${{ inputs.tag || github.ref }}
232+
233+
- name: Start netbsd x86-64 VM
234+
uses: cross-platform-actions/action@v1.3.0
235+
with:
236+
operating_system: netbsd
237+
version: "10.1"
238+
architecture: x86-64
239+
shell: bash
240+
memory: 8G
241+
cpu_count: 4
242+
243+
- name: Build in VM
244+
shell: cpa.sh {0}
245+
run: |
246+
set -euo pipefail
247+
# Install Rust with pkg_add straight from the CDN mirror. This avoids
248+
# pkgin's slow `ftp.NetBSD.org` summary fetch + local DB rebuild that
249+
# would otherwise stall for a very long time.
250+
export PKG_PATH="https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/10.1/All/"
251+
sudo -E pkg_add -v rust
252+
# Keep target/ outside the workspace so it isn't synced back
253+
export CARGO_TARGET_DIR="$HOME/build"
254+
cargo build --release --locked --bin squeezed
255+
mkdir -p dist
256+
cp "$CARGO_TARGET_DIR/release/squeezed" dist/squeezed
257+
258+
- name: Package tarball
259+
shell: bash
260+
run: |
261+
set -euo pipefail
262+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
263+
version="${{ inputs.tag }}"
264+
else
265+
version="${GITHUB_REF_NAME}"
266+
fi
267+
name="squeezed-${version}-netbsd-amd64"
268+
mkdir -p dist/staging
269+
install -m 0755 dist/squeezed dist/staging/squeezed
270+
cp README.md LICENSE squeezed.example.toml dist/staging/
271+
tar -C dist/staging -czf "dist/${name}.tar.gz" .
272+
(cd dist && shasum -a 256 "${name}.tar.gz" > "${name}.tar.gz.sha256")
273+
ls -lh dist
274+
275+
- name: Upload artifact
276+
uses: actions/upload-artifact@v4
277+
with:
278+
name: netbsd-amd64
228279
path: dist/*.tar.gz*
229280
if-no-files-found: error
230281

231282
release:
232283
name: Publish GitHub release
233-
needs: [build, build-bsd]
284+
# Deliberately does NOT depend on build-netbsd — the slow NetBSD build must
285+
# never block publishing. Its asset is added afterward by release-netbsd.
286+
needs: [build, build-freebsd]
234287
runs-on: ubuntu-latest
235288
steps:
236289
- name: Download all artifacts
@@ -279,3 +332,34 @@ jobs:
279332
"https://${FURY_TOKEN}@push.fury.io/${FURY_ACCOUNT}/"
280333
echo
281334
done
335+
336+
# Attach the NetBSD tarball to the already-published release once it's ready.
337+
# Depends on `release` (so the release exists) but `release` never waits on
338+
# NetBSD — if build-netbsd is slow, fails, or times out, this job simply skips
339+
# and the rest of the release is unaffected.
340+
release-netbsd:
341+
name: Attach NetBSD asset
342+
needs: [build-netbsd, release]
343+
# Only when NetBSD actually built and the release exists; otherwise skip
344+
# cleanly (never fail the run over the optional NetBSD asset).
345+
if: ${{ always() && needs.release.result == 'success' && needs.build-netbsd.result == 'success' }}
346+
runs-on: ubuntu-latest
347+
steps:
348+
- name: Download NetBSD artifact
349+
uses: actions/download-artifact@v4
350+
with:
351+
name: netbsd-amd64
352+
path: dist
353+
354+
- name: Show artifacts
355+
run: ls -lh dist
356+
357+
- name: Upload to release
358+
uses: softprops/action-gh-release@v2
359+
with:
360+
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
361+
files: dist/*.tar.gz*
362+
# The release already exists with its notes — just add this asset.
363+
generate_release_notes: false
364+
draft: false
365+
prerelease: false

0 commit comments

Comments
 (0)