From d25c4e8c812b8d012010ba38070a2931dcd28908 Mon Sep 17 00:00:00 2001 From: undergroundwires Date: Thu, 16 May 2024 10:53:55 +0200 Subject: [PATCH] Add support for macOS universal binary #348, #362 This commit introduces a universal binary format in the distributed MDG files for macOS, improving support for both Apple Silicon (ARM) and Intel (x64) architectures. It uses `electron-builder` to package both architectures into a single executable, ensuring the application can natively on any macOS hardware without depending on the GitHub runners' architecture. It fixes the issue related to prior releases that supported only the architecture of the build environment itself, which is subject to change. Changes: - Update DMG distribution to include both ARM64 and x64 architectures. - Enhance system requirements documentation to reflect support for both architectures. - Modify CI/CD workflows to check desktop runtime errors for both ARM64 and x64 versions on macOS. Resolves: - Issue #348: Initial request for Apple Silicon support. - Issue #362: Correction of distribution limited to ARM64 in release 0.13.3. `electron-builder` support: - electron-userland/electron-builder#5475 - electron-userland/electron-builder#5689 - electron-userland/electron-builder#5426 --- .../workflows/checks.desktop-runtime-errors.yaml | 10 +++++++--- docs/desktop/system-requirements.md | 16 ++++++---------- electron-builder.cjs | 5 ++++- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/checks.desktop-runtime-errors.yaml b/.github/workflows/checks.desktop-runtime-errors.yaml index 751e0313..f1e38b44 100644 --- a/.github/workflows/checks.desktop-runtime-errors.yaml +++ b/.github/workflows/checks.desktop-runtime-errors.yaml @@ -9,9 +9,13 @@ jobs: run-check: strategy: matrix: - os: [ macos, ubuntu, windows ] + os: + - macos-latest # Apple silicon (ARM64) + - macos-13 # Intel-based (x86-64) + - ubuntu-latest + - windows-latest fail-fast: false # Allows to see results from other combinations - runs-on: ${{ matrix.os }}-latest + runs-on: ${{ matrix.os }} steps: - name: Checkout @@ -24,7 +28,7 @@ jobs: uses: ./.github/actions/npm-install-dependencies - name: Configure Ubuntu - if: matrix.os == 'ubuntu' + if: contains(matrix.os, 'ubuntu') # macOS runner is missing Docker shell: bash run: |- sudo apt update diff --git a/docs/desktop/system-requirements.md b/docs/desktop/system-requirements.md index f554b73a..2369d00e 100644 --- a/docs/desktop/system-requirements.md +++ b/docs/desktop/system-requirements.md @@ -8,7 +8,7 @@ systems or configurations that haven't undergone official testing. - **Version:** Windows 10 and later. - **Processor:** Intel Pentium 4 or later. -- **Architecture:** 64-bit (x64), ARM. +- **Architecture:** 64-bit (x86-64), ARM (ARM64). > **⚠️ Compatibility Note:** > ARM version is only compatible with Windows 11 and later. @@ -17,24 +17,20 @@ systems or configurations that haven't undergone official testing. ## macOS - **Version:** macOS Catalina (10.15) and later. -- **Architecture:** Intel-based (64-bit), Apple Silicon (ARM). - -> **⚠️ Compatibility Note:** -> Apple Silicon version runs non-natively, leading to slower performance due to emulation [2]. +- **Architecture:** Intel-based (x86-64), Apple silicon (ARM64). ## Linux - **Version:** Ubuntu 18.04 and later, Fedora 32 and later, and Debian 10 and later. - **Processor:** Intel Pentium 4 or later. -- **Architecture:** 64-bit (x64). +- **Architecture:** 64-bit (x86-64). ## References -System requirements reflect Electron's platform capabilities [3] and Chromium's recommended configurations [4]. +System requirements reflect Electron's platform capabilities [2] and Chromium's recommended configurations [3]. For details on the build process, see [electron-builder configuration file](./../../electron-builder.cjs). [1]: https://web.archive.org/web/20240428082726/https://learn.microsoft.com/en-us/windows/arm/add-arm-support#emulation-on-arm-based-devices-for-x86-or-x64-windows-apps "Add support Arm devices to your Windows app | Microsoft Learn | learn.microsoft.com" -[2]: https://archive.today/2024.04.28-082901/https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary%23overview "Building a universal macOS binary | Apple Developer Documentation | developer.apple.com" -[3]: https://archive.ph/2024.04.28-082958/https://github.com/electron/electron/blob/main/README.md#platform-support "Platform Support | electron/README.md at main · electron/electron · GitHub | github.com" -[4]: https://web.archive.org/web/20240428082945/https://support.google.com/chrome/a/answer/7100626?hl=en "Chrome browser system requirements - Chrome Enterprise and Education Help | support.google.com" +[2]: https://archive.ph/2024.04.28-082958/https://github.com/electron/electron/blob/main/README.md#platform-support "Platform Support | electron/README.md at main · electron/electron · GitHub | github.com" +[3]: https://web.archive.org/web/20240428082945/https://support.google.com/chrome/a/answer/7100626?hl=en "Chrome browser system requirements - Chrome Enterprise and Education Help | support.google.com" diff --git a/electron-builder.cjs b/electron-builder.cjs index 97eb3ed2..383f1a78 100644 --- a/electron-builder.cjs +++ b/electron-builder.cjs @@ -43,7 +43,10 @@ module.exports = { // macOS mac: { - target: 'dmg', + target: { + target: 'dmg', + arch: 'universal', + }, }, dmg: { artifactName: '${name}-${version}.${ext}',