Compare commits

...

3 Commits

Author SHA1 Message Date
Jordan Bentley
0a7b24e62a
Merge branch 'main' into optimize-crystal-perf-1 2025-10-10 17:45:09 -04:00
Jordan Bentley
21e482ae45
Merge branch 'main' into optimize-crystal-perf-1 2025-10-10 17:29:04 -04:00
Jordan Bentley
542e521d31
Fix architecture compatibility for macOS builds
Resolves #194 - Fixes "Javascript error when launching app" caused by
better-sqlite3 being compiled for only arm64 architecture.

## Problem
The app was failing to launch on Intel Macs with error:
"mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64h' or 'x86_64')"

## Root Cause
CI workflows were manually running `electron:rebuild` before the build,
which only rebuilt native modules for the runner's architecture (arm64).
This prevented electron-builder from properly creating universal binaries
with native modules for both architectures.

## Solution
1. Updated release workflow to use `release:mac:universal` command
2. Updated build workflow to use `build:mac:universal` command
3. Removed manual `electron:rebuild` steps from both workflows
4. Removed native module caching that could cause conflicts

Now electron-builder automatically handles native module building for
both x64 and arm64 architectures, creating true universal binaries
that work on both Intel and Apple Silicon Macs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-10 16:57:21 -04:00
2 changed files with 3 additions and 28 deletions

View File

@ -15,7 +15,7 @@ jobs:
os: [macos-latest, ubuntu-latest]
include:
- os: macos-latest
build_cmd: canary:mac
build_cmd: build:mac:universal
artifact_name: crystal-macos-canary
artifact_path: |
dist-electron/*.dmg
@ -52,19 +52,7 @@ jobs:
node-version: '22.15.1'
cache: 'pnpm'
# Cache native modules and electron binaries to speed up rebuilds
- name: Cache native modules
uses: actions/cache@v4
with:
path: |
main/node_modules/.bin
main/build
~/.electron
~/.electron-gyp
key: ${{ runner.os }}-native-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-native-modules-
# Cache electron binaries to speed up builds
- name: Cache Electron binaries
uses: actions/cache@v4
with:
@ -105,16 +93,6 @@ jobs:
echo "Using cached frontend and main builds"
fi
- name: Rebuild native modules (if needed)
run: |
# Only rebuild if native modules cache missed or build files changed
if [ ! -f "main/build/Release/better_sqlite3.node" ]; then
echo "Rebuilding native modules..."
pnpm run electron:rebuild
else
echo "Using cached native modules"
fi
- name: Generate NOTICES file
run: pnpm run generate-notices

View File

@ -12,7 +12,7 @@ jobs:
os: [macos-latest, ubuntu-latest]
include:
- os: macos-latest
release_cmd: release:mac
release_cmd: release:mac:universal
artifact_name: crystal-macos
artifact_path: |
dist-electron/*.dmg
@ -55,9 +55,6 @@ jobs:
- name: Build main process
run: pnpm run build:main
- name: Rebuild native modules
run: pnpm run electron:rebuild
- name: Build and publish application
run: pnpm run ${{ matrix.release_cmd }}
env: