ci(desktop): check the native driver on macOS and ship it in releases (ENG-1533)
Merged
KD
2d ago+200+200+012345678901234567890123456789-29-29-01234567890123456789
What
spec.ymlgets anativejob onblacksmith-6vcpu-macos-26:cargo fmt --check,cargo clippy -D warnings,cargo test, a release build of the desktop driver for both Mac architectures, and a load of the arm64 build, also through the engine's loader test. It is in thespec gate'sneeds, so it gates merges.release.ymlbuilds the driver on macOS and puts it into@e2e-dev/desktop-darwin-arm64and@e2e-dev/desktop-darwin-x64before the release and nightly jobs publish.pnpm run canaryalso builds the driver into both platform packages, so a canary needs a Mac with rustup.
Last of four PRs for ENG-1533 (#2322, #2323, #2324, #2325), based on the testbed in #2324. #2322 is merged; this PR merges after #2323 and #2324.
Why
Without this, nothing checks the Rust crate on a pull request, and a release would publish the platform packages with no driver in them. Their prepublishOnly refuses that, so the release would fail instead.
How it works
spec.yml,nativejob: sets up Node 26, installs rustup when the runner has none, and puts the pinned toolchain'scargofirst onPATH, so neither a rustup that put none there (Homebrew's) nor a standalonecargowithout both targets builds the driver.rust-toolchain.tomlpins the toolchain, and rustup installs it on first use. The job runs fmt, clippy, andcargo test, checks that each platform package'sTHIRD_PARTY_LICENSES.mdmatchesCargo.lock(native-licenses.ts --check), builds both addons withbuild-native.tsas the release does, checks each one's architecture withlipo -archs(only an Intel Mac could load the x64 one), and loads the arm64 addon in Node, so a build that does not load fails the pull request. It then installs the workspace, builds@e2e-dev/core, and runs the engine's loader test (tests/unit/driver.test.ts) on that addon withREQUIRE_DESKTOP_NATIVE=1, which fails the test where it would otherwise skip, soloadNativeDriverruns on a real build in CI.release.yml,nightly-duejob: a small Linux job that, on a scheduled run, checks whether main moved since the last nightly. It runs on every event, a push included, where the check is skipped: a skipped job would skipreleasetoo, since a job's implicitsuccess()covers every job above it. Thenativejob builds unless a scheduled run found nothing to ship, so a quiet night starts no macOS runner, andnightlyruns only when one is due.release.yml,nativejob: sets up Node 26, sincebuild-native.tsis TypeScript run directly, then builds both addons withscripts/build-native.ts, checks each one's architecture withlipo -archs, and uploads them as thedesktop-nativeartifact, kept one day. Thereleaseandnightlyjobs need it, and a comment there says why. The publishing job stays on a GitHub-hosted Linux runner, which npm Trusted Publishing requires, so the build cannot run there.releaseandnightlydownload the artifact to${{ runner.temp }}/desktop-native, outside the checkout, sochangesets/actioncannot stage the binaries into the version commit. Then they runpackages/desktop/scripts/place-native.ts. It copies each addon into its platform package as a new file (an addon overwritten in place gets the next process that loads it killed) and writes the.build.jsonstamp with that package's version, whichprepublishOnly(scripts/check-native.ts) checks. Innightlythis runs after the snapshot version step, so the stamp names the snapshot version.download-artifactis pinned by SHA (v8.0.2), as every action is.- The root
package.jsonaddsbuild:desktop-native, andcanaryruns it after the build.CONTRIBUTING.mdsays a canary needs rustup on a Mac, andAGENTS.mdlists thenativejob, the release step, and the canary's need.
Issue
Refs ENG-1533
Verified
Ran it locally: yes, the commands the jobs run. The workflows run only on GitHub: the native job in this PR's checks is its first run, and the release jobs run after merge.
- The commands the jobs run pass on a Mac:
cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo test --locked,node ../scripts/build-native.tsfor both targets, and the load step ({ accessibility: true, screenRecording: true }). check-native.tspasses on a package with a fresh build and stamp, and fails when the addon is missing.- The loader test with
REQUIRE_DESKTOP_NATIVE=1passes on a built addon and fails with the addon moved away; without the variable it is skipped.actionlintpasses onspec.ymlandrelease.yml, andlipo -archsreadsarm64andx86_64from the two builds here. build-native.tsrun twice in a row over the same output: the addon loads after each build (screenLocked()answers). The x64 addon is built in both jobs but loaded by none: no x64 Mac runner is in use.
Before the first release, a maintainer publishes both platform packages once by hand and adds a trusted publisher for each on npmjs, as for any new package.
š¤ Generated with Claude Code