ci(release): skip throwaway native rebuild and typecheck in packaging#540
Merged
Conversation
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).
|
React Doctor found 1 issue in 1 file.
Top Findings
Generated by React Doctor. Questions? Contact founders@million.dev. |
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
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 buildfires theprebuildhook →ensure-native.sh electronrebuilds better-sqlite3/keytar in the sourcenode_modules. The package never uses them —build-packaged-app.jsrebuilds natives in the staged copy.ensure-native.shignoresSKIP_ELECTRON_REBUILD, so setting that flag alone just shifts the rebuild frompostinstalltoprebuild.desktop-cion every push.Change
build:releasescript:repair:links && electron-vite build. A different script name means npm never runs theprebuildhook → no native rebuild, no typecheck. Keepsrepair:linksfor workspace-symlink safety.build:release.SKIP_ELECTRON_REBUILD: 1at the workflow env level drops the residual rebuild that pnpm's deps-status preflight triggers viapostinstall.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 thepostinstallguard).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'selectron-vite buildis the same bundling that already ships underbuild. A full local package needs CI-injected.env.production, so the clean proof is adry_runworkflow_dispatch — it builds artifacts without uploading/publishing. Recommend running one to confirm timing before the next real release.