build: ship cgo-enabled xurl chat in release binaries#90
Merged
Conversation
Release binaries were built with CGO_ENABLED=0 on a Linux runner, so the
npm/Homebrew/GitHub-release binaries always shipped the xurl chat stub.
Cut Release now runs GoReleaser on a macOS arm64 runner with three build
groups: native cgo builds for darwin/arm64 and darwin/amd64 (ad-hoc signed),
a zig-cross-compiled musl-static cgo build for linux/amd64 (runs on both
glibc and musl distros), and CGO_ENABLED=0 stubs for windows/* and
linux/{arm64,386} where chat-xdk has no library. Asset names, the Homebrew
cask, the npm launcher, and the release.yml dispatch dedup are unchanged.
CI gains a release-build job that compiles all release targets and asserts
the darwin binary carries the real chat client, plus stub cross-compile
checks on the ubuntu job.
Collaborator
Author
v1.3.1 release-cut validation (real published artifacts)Cut Release run: https://github.com/xdevplatform/xurl/actions/runs/29862081307 (one GoReleaser run; the dispatched Release run published npm — no duplicate/racing runs). All 9 assets published under the existing names;
Non-chat functionality spot-check: Signing determination confirmed on the released artifacts: npm's programmatic download sets no quarantine attribute and the binary runs directly; the Homebrew cask post-install strips quarantine. No notarization required; no Apple credentials involved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Release binaries are built with
CGO_ENABLED=0in a single Linux cross-compile, so every distributed binary (npm@xdevplatform/xurl, Homebrew cask, GitHub release tarballs) ships the build-taggedxurl chatstub — even on macOS and linux/amd64 where chat is fully supported.Approach: one GoReleaser run on a macOS arm64 runner
Rather than a multi-runner build matrix with an artifact-assembly job (GoReleaser OSS has no split/merge), the whole release still comes from one GoReleaser invocation —
cut-release.ymljust moves fromubuntu-latesttomacos-latest:-arch x86_64), ad-hoc signedzig cc -target x86_64-linux-musl,-static -lunwind,-tags muslCGO_ENABLED=0CGO_ENABLED=0This preserves every existing property with a small diff: one release, no duplicate/racing GoReleaser runs (release.yml stays npm-only, dispatch-only), Homebrew cask updated by the same run, identical asset names — so
npm/install.jsneeds no changes.Why zig/musl for linux/amd64: chat-xdk ships a
linux_amd64_muslstatic lib selected by amuslbuild tag. Linking it statically with zig's bundled musl + LLVM libunwind yields a dependency-free static ELF, verified to run (real chat client, no stub string) on both Debian bookworm (glibc) and Alpine (musl) amd64 containers. This answers the "musl variant" question: the singlexurl_Linux_x86_64.tar.gzasset is the musl-static build and covers both libc families — no new asset name or npm slot needed. (-lunwindis required because the Rust-built archive references_Unwind_*symbols.)Build-tag verification:
cli/chat.gois gated oncgo && ((darwin && (amd64 || arm64)) || (linux && amd64));CGO_ENABLED=1+ a working C toolchain for the target is sufficient to flip it, and each cgo target links the matchinglibs/<os>_<arch>archive (checked in the module cache for chat-xdk v0.4.1: darwin_amd64, darwin_arm64, linux_amd64, linux_amd64_musl — nothing for windows or linux/arm64, so those remain stubs by necessity).Signing determination (empirical)
https.getdownload sets nocom.apple.quarantine(onlycom.apple.provenance); the v1.3.0 npm binary runs directly on macOS arm64. Gatekeeper never triggers, so no notarization is needed.codesign -s - --forcepost-build hook ad-hoc signs both darwin binaries. No Apple credentials required or added.Changes
.goreleaser.yaml: three build groups (darwin-cgo / linux-cgo / stub) replacing the single CGO=0 build; archives/cask/release config untouched; stale comment rewritten..github/workflows/cut-release.yml:runs-on: macos-latest+ pinnedmlugg/setup-zig@v2(zig 0.16.0).go test ./...now also exercises the real chat code path (cgo on macOS)..github/workflows/go.yml: newrelease-buildjob compiles all 8 release targets viagoreleaser build --snapshoton macOS and fails if the darwin binary prints the stub; the ubuntu job now also cross-compiles the CGO=0 stub targets.cli/chat_unsupported.go: stub message updated — it now only ships on platforms chat can never support, so it no longer suggests that a release binary is missing something a source build would fix.Validation
make build,make test,go vet ./...,gofmt -l, and CGO=0 stub cross-builds (GOOS=windows,GOOS=linux GOARCH=arm64) all pass.goreleaser build --snapshot --cleanon macOS arm64 builds all 8 targets; each binary checked by hand: real chat client on darwin/arm64 (native), darwin/amd64 (under Rosetta), linux/amd64 (Debian + Alpine amd64 containers); stub verified on linux/arm64 (Alpine arm64 container).