Skip to content

Rebuild aarch64 natively when publish finds no artifact - #681

Merged
maralcbr merged 1 commit into
masterfrom
mac/109-publish-arm64-rebuild
Sep 27, 2026
Merged

maralcbr merged 1 commit into
masterfrom
mac/109-publish-arm64-rebuild

Conversation

@maralcbr

Copy link
Copy Markdown
Member

Why

#671 moved aarch64 PR builds to GitHub's ubuntu-24.04-arm runners, but publish.yml still built a merged aarch64 tree on the x86 droplet, under QEMU, whenever it had no PR artifact: a PR merged more than 7 days after its last build, or a workflow_dispatch. omarchy-mac-boot takes ~167 of the job's 240 minutes that way (its check() runs omarchy-mac's kill -9 interruption matrices, ~15x slower emulated), and the figure grows with every test added upstream.

What changed

  • The changes job now decides, per package and architecture, whether a build artifact exists for the merged tree, and logs the decision (reuse the build artifact (run N, expires …), rebuild natively on ubuntu-24.04-arm, or build in the publish job on the self-hosted builder). The same table goes into the run summary.
  • A new rebuild job builds each aarch64 entry without an artifact on ubuntu-24.04-arm, with the same checkout, builder image and bin/build --mirror edge call as build-pr.yml's aarch64 path. It makes the same "already published at master's version" check the publish job makes, and uploads under the usual <pkg>-<arch>-<tree hash> label. It has no secrets and a read-only token.
  • The publish job waits for it. Collect finds that artifact the way it finds a PR artifact, and says which one it took (artifact from this run's native aarch64 rebuild / reusing the build artifact from run N). It never builds aarch64 under emulation any more: an aarch64 tree without an artifact is recorded as native-build-failed, and the job stops before anything is signed or uploaded, as a failed build did before. The report shows "rebuilt natively on arm64".
  • Unchanged: x86_64 (still built inline on the droplet when it has no artifact), signing, repo-add and upload on the self-hosted builder, the publish environment and its secrets, the run-level publish concurrency group (one writer). result now also fails when changes fails; before, a failed plan skipped publish and result passed.

Tested

Fork run on maralcbr/omarchy-pkgs, branch proof/109-publish-native: this commit plus a harness commit that triggers on that branch, runs the publish job on a hosted runner without the publish environment, skips the Publish step and drops the report job. Nothing was signed or uploaded. omarchy-mac-boot and tzupdate had pkgrel bumped to 99 plus a marker line, so no tree matches a published one.

Four pushes (runs on maralcbr/omarchy-pkgs):

  • Rebuild (run 36349009718): the plan logged omarchy-mac-boot-aarch64-64ba2af…: no build artifact: rebuild natively on ubuntu-24.04-arm, and the same for tzupdate aarch64, while tzupdate x86_64 got build in the publish job on the self-hosted builder. omarchy-mac-boot 20260927-99 took 10m44s natively, with check() at 9m22s and all 277 ok (it was ~167 min under QEMU). Collect logged artifact from this run's native aarch64 rebuild for both aarch64 packages and built tzupdate x86_64 inline, as before.
  • Reuse (run 36349093775): omarchy-mac-boot's tree was changed and then restored. The plan logged reuse the build artifact (run 36349009718, expires …), the rebuild job was skipped, and Collect logged reusing the build artifact from run 36349009718.
  • Native build fails (run 36349846685): tzupdate was made to fail on aarch64 only. The rebuild job went red. Collect logged no artifact from the native rebuild; not building aarch64 under emulation and wrote the record with native-build-failed, with no slots and nothing emulated. result went red.
  • Already published (run 36350371969): tzupdate went back to master's tree. The rebuild job logged already published at master's version, nothing to build and uploaded nothing, and Collect skipped both architectures.

actionlint reports nothing new (same 5 pre-existing shellcheck notes as master).

Alternatives rejected

  • Raise the timeout. The job already has 240 minutes; boot needs ~167 and grows with each test. A longer limit keeps a 32-vCPU droplet busy for 3+ hours per boot rebuild and holds the serialized publish group, so every later merge waits behind it. It hides the cost rather than removing it.
  • Sample interruption steps under emulation (env var in omarchy-mac). It needs an omarchy-mac change, a recipe pin and a publish, a way for check() to know it is emulated (qemu-user reports aarch64, so bin/build would have to pass a flag through), and it makes a package's test coverage depend on which host built it. With aarch64 now native in both build-pr and publish, no CI path runs these tests emulated.

Separate proposal (not implemented)

If an emulated aarch64 build ever comes back (say, a host-side bin/build --arch aarch64 on an x86 box), sampling is cheap and safe as belt-and-braces. omarchy-mac's own CI (tests.yml) runs boot/test/all in full, natively, on every PR, so it would lose nothing. The shape: OMARCHY_TEST_INTERRUPT_SAMPLE=<n> makes the interrupt after|during|mid loops in mac-migrate-mx-test.sh, mac-migrate-legacy-test.sh and mac-migrate-test.sh run every n-th step, plus always the first and last. Only bin/build sets it, and only when the build arch differs from the host arch. Unset keeps today's full matrix. It needs the omarchy-mac owner's agreement, so it isn't in this PR.

Notes

  • Pre-existing, not changed here: the publish concurrency group replaces a pending run when a newer merge arrives (only the running one is protected), and each run plans only its own push's diff, so three quick merges can skip the middle one's packages. The fork proof shows this happening. Artifact reuse also trusts the label, not the producing workflow.
  • A failed native rebuild leaves the run red with the native-build-failed record, and nothing is published. Re-run all jobs after fixing the cause.
  • Second review: merge-safe, with no blocking findings. Its note about the untested already-published path was then exercised (run 4 above). A design debate found no blocker and asked for a read-only token on the rebuild job, which is done; its other points are pre-existing and listed above.

A merged aarch64 tree without a PR build artifact (expired after 7 days,
or a dispatch) was rebuilt on the x86 droplet under QEMU: omarchy-mac-boot
took ~167 of the 240 minutes. A new job builds it on ubuntu-24.04-arm the
way build-pr.yml does and uploads it under the same label, so the publish
job signs and uploads it on the droplet like a PR artifact. The plan logs
reuse or rebuild for every package; x86_64, signing and the publish
concurrency are unchanged.
@maralcbr
maralcbr merged commit d41fb09 into master Sep 27, 2026
6 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