Skip to content

CI: cache Electron native rebuild outputs in main workflow#23272

Merged
Sewer56 merged 3 commits into
Nexus-Mods:masterfrom
Sewer56:ci/opt-main-native-cache
May 28, 2026
Merged

CI: cache Electron native rebuild outputs in main workflow#23272
Sewer56 merged 3 commits into
Nexus-Mods:masterfrom
Sewer56:ci/opt-main-native-cache

Conversation

@Sewer56
Copy link
Copy Markdown
Member

@Sewer56 Sewer56 commented May 20, 2026

Part of LAZ-411

Depends on:

Merge that first.

Summary

Cache Electron native rebuild outputs in main.yml.

Change

main.yml now:

  1. installs dependencies with VORTEX_DEFER_ELECTRON_REBUILD=1
  2. restores/caches native build headers:
    • ~/.electron-gyp
    • ~/.cache/node-gyp
  3. restores/caches Electron native outputs under node_modules/.pnpm/...
  4. runs one explicit rebuild:
pnpm --filter @vortex/main exec electron-rebuild

Cached modules:

  • @nexusmods/fomod-installer-native
  • drivelist
  • leveldown
  • winapi-bindings
  • xxhash-addon
  • @parcel/watcher

Measurement

Baseline full-postinstall main runs:

Warmup/verification run:

Optimized warm-cache runs:

Results:

Platform Metric Baseline median Optimized median Delta
Ubuntu install + cache restore + rebuild 86s 32s -54s
Windows install + cache restore + rebuild 332s 260s -72s

All optimized warm-cache runs logged Electron native cache hit: true on Ubuntu and Windows.

@Sewer56 Sewer56 marked this pull request as ready for review May 20, 2026 21:53
@Sewer56 Sewer56 requested a review from a team as a code owner May 20, 2026 21:53
IDCs
IDCs previously approved these changes May 21, 2026
Comment thread .github/workflows/main.yml
Comment thread .github/workflows/main.yml Outdated
id: electron-native-cache
uses: actions/cache@v4
with:
path: |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How are we going to maintain this list of paths?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maintenance burden is low because:

  • Cache miss != breakage: an unlisted path just means that dep rebuilds every run (same as no cache, same as before). No risk.
  • Stale entries are harmless: a listed path that doesn't exist on disk is simply ignored. No error; only warning.
  • The list shrinks, not grows: we're actively removing native deps from Vortex, not adding them. We don't expect new entries anytime soon.
  • Could automate: a short script scanning node_modules could regenerate this list when deps change. Given the above however, not worth the effort right now.

Not worried about it at the moment; since we're only planning to be removing deps. If a dep is removed then warning will show, so we'll know immediately by opening a CI run.

Sewer56 added a commit to Sewer56/Vortex that referenced this pull request May 21, 2026
Sewer56 added 2 commits May 21, 2026 14:26
Defer @vortex/main electron-rebuild during pnpm install, restore cached native build outputs, then run one explicit electron-rebuild step before pnpm run build.

This branch is based on the separate Electron rebuild controls PR. This commit owns the behavior change from implicit postinstall rebuild to deferred explicit rebuild plus caches.

Cached outputs cover @nexusmods/fomod-installer-native, drivelist, leveldown, winapi-bindings, xxhash-addon, and @parcel/watcher build/bin directories under pnpm's virtual store. Header caches cover ~/.electron-gyp and ~/.cache/node-gyp.

Measurement on Sewer56/Vortex:

Baseline full-postinstall main runs:

- https://github.com/Sewer56/Vortex/actions/runs/26099098244
- https://github.com/Sewer56/Vortex/actions/runs/26099100086
- https://github.com/Sewer56/Vortex/actions/runs/26099101744

Warmup/verification run:

- https://github.com/Sewer56/Vortex/actions/runs/26099103356

Optimized warm-cache runs:

- https://github.com/Sewer56/Vortex/actions/runs/26099876762
- https://github.com/Sewer56/Vortex/actions/runs/26099878560
- https://github.com/Sewer56/Vortex/actions/runs/26099880447

All optimized warm-cache runs logged `Electron native cache hit: true` on both Ubuntu and Windows.

Ubuntu combined install + cache restore + rebuild median: 86s -> 32s (-54s). Rebuild step itself was 1s with cache.

Windows combined install + cache restore + rebuild median: 332s -> 260s (-72s). Rebuild step itself was 2s with cache.

Note: the first verification run had a Windows native-output cache miss and spent 67s in the explicit rebuild, confirming warm-cache measurements need a serialized warmup first.
@Sewer56 Sewer56 force-pushed the ci/opt-main-native-cache branch from 3eb7860 to 9e3864c Compare May 21, 2026 13:38
IDCs
IDCs previously approved these changes May 27, 2026
@Sewer56 Sewer56 dismissed IDCs’s stale review May 27, 2026 21:09

The merge-base changed after approval.

@IDCs
Copy link
Copy Markdown
Contributor

IDCs commented May 28, 2026

Same as #23274

@Sewer56 Sewer56 merged commit 47dacfa into Nexus-Mods:master May 28, 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.

3 participants