Skip to content

Commit ca6f9e1

Browse files
committed
ci(netbsd): install Rust via pkgin from the CDN; add manual dispatch workflow
The pkg_add approach failed with a dependency conflict — the CDN's rust package requires a newer curl than the NetBSD 10.1 base image ships, and bare pkg_add won't upgrade an already-installed dependency. Switch back to pkgin (which resolves and upgrades deps) but point its repositories.conf at the fast HTTPS cdn.NetBSD.org mirror instead of the slow default ftp.NetBSD.org — fixing both the original slowness and the curl conflict. Also add .github/workflows/netbsd.yml: a standalone workflow_dispatch build that takes a release tag, builds NetBSD from it, and attaches the asset to that tag's release — so NetBSD can be built/retried independently of the main release run.
1 parent bf8973a commit ca6f9e1

2 files changed

Lines changed: 91 additions & 5 deletions

File tree

.github/workflows/netbsd.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: NetBSD build
2+
3+
# Standalone, manually-triggered NetBSD build. The main release workflow runs
4+
# NetBSD automatically but decoupled (it never blocks publishing); use this to
5+
# build and attach the NetBSD asset on demand — e.g. to retry after a failed or
6+
# slow run, or to add it to a release that already published without it.
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
description: "Release tag to build and attach the NetBSD asset to (e.g. v0.1.0)"
13+
required: true
14+
type: string
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
netbsd:
21+
name: netbsd-amd64
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 60
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
ref: ${{ inputs.tag }}
29+
30+
- name: Start netbsd x86-64 VM
31+
uses: cross-platform-actions/action@v1.3.0
32+
with:
33+
operating_system: netbsd
34+
version: "10.1"
35+
architecture: x86-64
36+
shell: bash
37+
memory: 8G
38+
cpu_count: 4
39+
40+
- name: Build in VM
41+
shell: cpa.sh {0}
42+
run: |
43+
set -euo pipefail
44+
# Point pkgin at the fast HTTPS CDN instead of the default (painfully
45+
# slow) ftp.NetBSD.org mirror, then let pkgin install Rust — it
46+
# resolves the dependency graph and upgrades already-installed deps.
47+
sudo sh -c 'echo "https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/10.1/All" > /usr/pkg/etc/pkgin/repositories.conf'
48+
sudo pkgin -y update
49+
sudo pkgin -y install rust
50+
# Keep target/ outside the workspace so it isn't synced back
51+
export CARGO_TARGET_DIR="$HOME/build"
52+
cargo build --release --locked --bin squeezed
53+
mkdir -p dist
54+
cp "$CARGO_TARGET_DIR/release/squeezed" dist/squeezed
55+
56+
- name: Package tarball
57+
shell: bash
58+
run: |
59+
set -euo pipefail
60+
version="${{ inputs.tag }}"
61+
name="squeezed-${version}-netbsd-amd64"
62+
mkdir -p dist/staging
63+
install -m 0755 dist/squeezed dist/staging/squeezed
64+
cp README.md LICENSE squeezed.example.toml dist/staging/
65+
tar -C dist/staging -czf "dist/${name}.tar.gz" .
66+
(cd dist && shasum -a 256 "${name}.tar.gz" > "${name}.tar.gz.sha256")
67+
ls -lh dist
68+
69+
- name: Upload artifact
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: netbsd-amd64
73+
path: dist/*.tar.gz*
74+
if-no-files-found: error
75+
76+
- name: Attach to release
77+
uses: softprops/action-gh-release@v2
78+
with:
79+
tag_name: ${{ inputs.tag }}
80+
files: dist/*.tar.gz*
81+
generate_release_notes: false
82+
draft: false
83+
prerelease: false

.github/workflows/release.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,14 @@ jobs:
244244
shell: cpa.sh {0}
245245
run: |
246246
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
247+
# Point pkgin at the fast HTTPS CDN instead of the default (painfully
248+
# slow) ftp.NetBSD.org mirror, then let pkgin install Rust. Unlike
249+
# bare `pkg_add`, pkgin resolves the full dependency graph and upgrades
250+
# already-installed deps (e.g. the base curl 8.19.0 -> the newer curl
251+
# the current Rust package requires), which is what failed before.
252+
sudo sh -c 'echo "https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/amd64/10.1/All" > /usr/pkg/etc/pkgin/repositories.conf'
253+
sudo pkgin -y update
254+
sudo pkgin -y install rust
252255
# Keep target/ outside the workspace so it isn't synced back
253256
export CARGO_TARGET_DIR="$HOME/build"
254257
cargo build --release --locked --bin squeezed

0 commit comments

Comments
 (0)