Skip to content

ci: test and run the binary on arm64; arm64-first builds - #2

Merged
alfaha merged 2 commits into
masterfrom
alfaha/arm64-builds
Oct 15, 2026
Merged

alfaha merged 2 commits into
masterfrom
alfaha/arm64-builds

Conversation

@alfaha

@alfaha alfaha commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

The arm64 half of #1; the JSON half went upstream as theazz#69.

release.go already builds darwin/arm64 and linux/arm64, but CI and the release gates ran on ubuntu-latest only. The arm64 binaries were cross-compiled and never executed, and the tests never ran on arm64.

  • An arm64 job in ci.yml and release.yml. It runs on GitHub's free hosted runners: ubuntu-24.04-arm (Linux arm64) and macos-latest (Apple Silicon). It runs go test ./... -race, then builds and runs the binary. In release.yml the publishing job needs it, so nothing ships until arm64 has passed. The other gates (gofmt, vet, generate, govulncheck, actionlint) don't depend on the architecture and still run once on ubuntu-latest.
  • make build defaults to GOARCH=arm64. It can be overridden with make build GOARCH=amd64. It is unexported, so generate and test still run on the host.
  • arm64 comes first in release.go and in the README's install section.
  • Homebrew needed no change. The tap formula picks the arm64 archive under on_arm and the amd64 one under on_intel, on macOS and Linux. update_homebrew_formula.py only rewrites the version and checksum per URL.
  • No container image yet. When the MCP server adds one, it gets a multi-arch buildx build, both architectures or neither.

An earlier version of this PR routed jobs to a self-hosted Mac. That was dropped: hosted runners give the same arm64 coverage with no machine to trust and no org setup. Nothing here depends on the fork, so this could also go upstream.

release.go has built darwin/arm64 and linux/arm64 for a while, but CI and the
release gates ran on ubuntu-latest only, so the arm64 binaries were cross-compiled
and never executed, and the tests never ran on arm64. (#1)

- ci.yml and release.yml get an arm64 job on GitHub's free hosted runners,
  ubuntu-24.04-arm and macos-latest (Apple Silicon): go test -race, then build and
  run the binary. The release is published only after it passes. The other gates
  are architecture-independent and still run once, on ubuntu-latest.
- make build defaults to GOARCH=arm64, overridable, and unexported so that generate
  and test run on the host. release.go and the README's install section list arm64
  first.

The Homebrew formula already picks the arm64 archive under on_arm and the amd64 one
under on_intel, for macOS and Linux; nothing to change there.
@alfaha
alfaha force-pushed the alfaha/arm64-builds branch from 250bed5 to 42b09b2 Compare October 14, 2026 07:41
@alfaha alfaha changed the title ci: run on the Apple Silicon Mac when it is online; arm64-first builds ci: test and run the binary on arm64; arm64-first builds Oct 14, 2026

@alfaha alfaha left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went through the diff and the CI run. Looks good to me. The arm64 jobs really do run natively: the logs show linux/arm64 on Linux aarch64 and darwin/arm64 on Darwin arm64, and both pass with -race. I also checked locally that unexport GOARCH keeps make test / make generate on the host arch when you override GOARCH.

A few notes inline, nothing blocking. The CHANGELOG one is the only one we'll actually have to deal with.

Comment thread Makefile
# Override for anything else, e.g. `make build GOARCH=amd64`, or with GOARCH in the
# environment. Only the binary is cross-built: make would otherwise export GOARCH to
# every recipe, and generate and test have to run on the host.
GOARCH ?= arm64

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to be aware of: on an amd64 machine make build now produces an arm64 binary, and running it just gives exec format error. The only clue is the echo line. That's what #1 asked for, and the README says how to override it, so I'm fine leaving it. Just flagging it in case someone on an Intel box hits it.

Comment thread .github/workflows/ci.yml
# public repositories: ubuntu-24.04-arm is Linux on arm64, macos-latest Apple
# Silicon. Only what depends on the architecture runs here; the other gates are
# the same everywhere and run once, in build.
arm64:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This job is the same block as the one in release.yml, copy for copy. It's short, so OK for now, but the two will drift (someone bumps setup-go or adds a step in one and forgets the other). If we touch it again, a small reusable workflow would fix that.

release:
# arm64 artefacts are published only once their tests and binary have run on
# arm64.
needs: arm64

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, nothing gets published before arm64 passes. Side effect: a release now waits on macos-latest, which was the slowest job in the PR run (~7 min vs ~3.5 for build). Fine for releases, I think.

Comment thread CHANGELOG.md
@@ -1,5 +1,14 @@
# Changelog

## Unreleased

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theazz#69 also adds an ## Unreleased section at the top, so these two will conflict. I ran a trial merge of both branches: CHANGELOG.md conflicts, README merges cleanly. Whichever lands second needs the two Unreleased sections combined by hand. Easy, just expect it when we sync from upstream.

@alfaha
alfaha merged commit 69f6034 into master Oct 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant