Skip to content

ci(release): skip throwaway native rebuild and typecheck in packaging#540

Merged
h4yfans merged 1 commit into
mainfrom
ci-release-faster-mac
Jun 12, 2026
Merged

ci(release): skip throwaway native rebuild and typecheck in packaging#540
h4yfans merged 1 commit into
mainfrom
ci-release-faster-mac

Conversation

@h4yfans

@h4yfans h4yfans commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Problem

macOS release jobs are the long pole (last green release: x64 33 min, arm64 22 min, Windows 12, Linux 6). The macOS x64 "Build signed macOS artifacts" step alone is ~28 min. Step-log timing showed ~3.6 min of native rebuild + ~2 min of typecheck inside the build that are pure waste.

Why it's wasted

  • pnpm --filter @memry/desktop build fires the prebuild hook → ensure-native.sh electron rebuilds better-sqlite3/keytar in the source node_modules. The package never uses them — build-packaged-app.js rebuilds natives in the staged copy.
  • ensure-native.sh ignores SKIP_ELECTRON_REBUILD, so setting that flag alone just shifts the rebuild from postinstall to prebuild.
  • typecheck is already gated by desktop-ci on every push.

Change

  • New build:release script: repair:links && electron-vite build. A different script name means npm never runs the prebuild hook → no native rebuild, no typecheck. Keeps repair:links for workspace-symlink safety.
  • Switch macOS / Windows / Linux release jobs to build:release.
  • SKIP_ELECTRON_REBUILD: 1 at the workflow env level drops the residual rebuild that pnpm's deps-status preflight triggers via postinstall.

Both changes are needed and complementary. Shipped binaries are identical — the real native rebuild still runs on the staged copy via @electron/rebuild's CLI directly (bypasses the postinstall guard).

Expected impact

~5–6 min off each platform build job (macOS step ~28 → ~22 min). The two big immovable chunks remain: notarization (~8.6 min, Apple-side wait) and DMG/zip compression (~6.9 min).

Verification

Rests on npm lifecycle semantics (pre<name> only fires for the exact name) + build:release's electron-vite build is the same bundling that already ships under build. A full local package needs CI-injected .env.production, so the clean proof is a dry_run workflow_dispatch — it builds artifacts without uploading/publishing. Recommend running one to confirm timing before the next real release.

The release build steps ran `pnpm --filter @memry/desktop build`, whose
`prebuild` hook rebuilds native modules via ensure-native.sh (~3.6 min)
and runs typecheck (~2 min) — both wasted: build-packaged-app.js rebuilds
natives in the staged copy, and CI already gates typecheck. ensure-native.sh
ignores SKIP_ELECTRON_REBUILD, so that flag alone only shifts the rebuild
from postinstall to prebuild.

Add a `build:release` script (different name ⇒ no prebuild hook ⇒ no native
rebuild, no typecheck; keeps repair:links) and switch the macOS/Windows/Linux
release jobs to it. Set SKIP_ELECTRON_REBUILD=1 at the workflow env level to
also drop the rebuild pnpm's deps-status preflight triggers via postinstall.

Trims ~5-6 min off each platform build job; shipped binaries unchanged (the
staged-copy rebuild still runs via @electron/rebuild's CLI directly).
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

React Doctor

React Doctor found 1 issue in 1 file.

Score Issues Errors Warnings Affected Files Scope
49 / 100 (Critical) 1 1 0 1 2 files changed on ci-release-faster-mac vs. main

Top Findings

Rule Severity Category Count
socket/low-supply-chain-score error Security 1

View workflow run

Generated by React Doctor. Questions? Contact founders@million.dev.

@h4yfans h4yfans marked this pull request as ready for review June 12, 2026 17:15
@h4yfans h4yfans merged commit 751020c into main Jun 12, 2026
12 of 15 checks passed
@h4yfans h4yfans deleted the ci-release-faster-mac branch June 12, 2026 17:15
@h4yfans h4yfans added the docs:not-needed Docs update not needed for this PR label Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies docs:not-needed Docs update not needed for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant