A local-first personal finance app
:arrow_up: Upgrade electron to 43 (#8769)
Michael Clark12a94d93430a
diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.ymlindex 8710aaf3be..03be0da726 100644--- a/.github/workflows/e2e-test.yml+++ b/.github/workflows/e2e-test.yml@@ -134,7 +134,9 @@ jobs:contents: readid-token: write # Authenticate to Depot via GitHub OIDC for test reportingcontainer:- image: mcr.microsoft.com/playwright:v1.61.1-jammy+ # noble (gcc 13) is required to compile native modules against Electron 43+ headers;+ # jammy's gcc 11/12 cannot parse them. Keep in sync with the desktop-vrt job in vrt-update-generate.yml.+ image: mcr.microsoft.com/playwright:v1.61.1-noblesteps:- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2with:diff --git a/.github/workflows/electron-master.yml b/.github/workflows/electron-master.ymlindex b1bc1f5114..324883019d 100644--- a/.github/workflows/electron-master.yml+++ b/.github/workflows/electron-master.yml@@ -58,8 +58,8 @@ jobs:fail-fast: falsematrix:include:- - os: ubuntu-22.04- runner: depot-ubuntu-22.04-8+ - os: ubuntu-24.04+ runner: depot-ubuntu-24.04-8- os: windows-2022runner: depot-windows-2022-8- os: macos-latest@@ -105,6 +105,15 @@ jobs:with:# Avoid restoring potentially poisoned caches in release jobs.cache: 'false'+ - if: ${{ startsWith(matrix.os, 'ubuntu') }}+ name: Install arm64 cross-compilation toolchain+ run: |+ # better-sqlite3 has no Electron prebuilds for this Electron version,+ # so the arm64 AppImage's native modules are cross-compiled from+ # source. beforePackHook points CC_target/CXX_target at this+ # toolchain during the arm64 pass.+ sudo apt-get update+ sudo apt-get install -y crossbuild-essential-arm64- name: Build Electron for Macif: ${{ startsWith(matrix.os, 'macos') }}run: ./bin/package-electron --skip-translationsdiff --git a/.github/workflows/electron-pr.yml b/.github/workflows/electron-pr.ymlindex 072e5ac6ad..bcb27065ac 100644--- a/.github/workflows/electron-pr.yml+++ b/.github/workflows/electron-pr.yml@@ -32,8 +32,8 @@ jobs:fail-fast: falsematrix:include:- - os: ubuntu-22.04- runner: depot-ubuntu-22.04-8+ - os: ubuntu-24.04+ runner: depot-ubuntu-24.04-8- os: windows-2022runner: depot-windows-2022-8- os: macos-latest@@ -70,6 +70,15 @@ jobs:VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/desktop-electron/package.json --type nightly)sed -i "s/%RELEASE_VERSION%/$VERSION/g; s/%RELEASE_DATE%/$TODAY/g" "$METAINFO_FILE"flatpak run --command=flatpak-builder-lint org.flatpak.Builder appstream "$METAINFO_FILE"+ - if: ${{ startsWith(matrix.os, 'ubuntu') }}+ name: Install arm64 cross-compilation toolchain+ run: |+ # better-sqlite3 has no Electron prebuilds for this Electron version,+ # so the arm64 AppImage's native modules are cross-compiled from+ # source. beforePackHook points CC_target/CXX_target at this+ # toolchain during the arm64 pass.+ sudo apt-get update+ sudo apt-get install -y crossbuild-essential-arm64- name: Build Electronrun: ./bin/package-electron --skip-translationsdiff --git a/.github/workflows/publish-nightly-electron.yml b/.github/workflows/publish-nightly-electron.ymlindex d58993ddc4..fa30cf8a2e 100644--- a/.github/workflows/publish-nightly-electron.yml+++ b/.github/workflows/publish-nightly-electron.yml@@ -26,8 +26,8 @@ jobs:fail-fast: falsematrix:include:- - os: ubuntu-22.04- runner: depot-ubuntu-22.04-8+ - os: ubuntu-24.04+ runner: depot-ubuntu-24.04-8- os: windows-latestrunner: depot-windows-2022-8- os: macos-latest@@ -73,6 +73,16 @@ jobs:sed -i "s/%RELEASE_VERSION%/$VERSION/g; s/%RELEASE_DATE%/$TODAY/g" "$METAINFO_FILE"flatpak run --command=flatpak-builder-lint org.flatpak.Builder appstream "$METAINFO_FILE"+ - if: ${{ startsWith(matrix.os, 'ubuntu') }}+ name: Install arm64 cross-compilation toolchain+ run: |+ # better-sqlite3 has no Electron prebuilds for this Electron version,+ # so the arm64 AppImage's native modules are cross-compiled from+ # source. beforePackHook points CC_target/CXX_target at this+ # toolchain during the arm64 pass.+ sudo apt-get update+ sudo apt-get install -y crossbuild-essential-arm64+- name: Update package versionsrun: |# Get new nightly versiondiff --git a/packages/desktop-electron/beforePackHook.ts b/packages/desktop-electron/beforePackHook.tsindex 09e1770c5b..a065d72dfb 100644--- a/packages/desktop-electron/beforePackHook.ts+++ b/packages/desktop-electron/beforePackHook.ts@@ -14,7 +14,18 @@ const beforePackHook = async (context: AfterPackContext) => {if (!electronVersion) {console.error('beforePackHook: Unable to find electron version.');- process.exit(); // End the process - electron version is required+ process.exit(1); // End the process - electron version is required+ }++ // gyp always compiles with CC_target/CXX_target when they are set, so they+ // must only point at the cross-compiler while building for a foreign+ // architecture — leaving them set would cross-compile the host-arch pass too.+ if (process.platform === 'linux' && arch === 'arm64') {+ process.env.CC_target = 'aarch64-linux-gnu-gcc';+ process.env.CXX_target = 'aarch64-linux-gnu-g++';+ } else {+ delete process.env.CC_target;+ delete process.env.CXX_target;}try {@@ -40,7 +51,7 @@ const beforePackHook = async (context: AfterPackContext) => {}} catch (err) {console.error('beforePackHook:', err);- process.exit(); // End the process - unsuccessful build+ process.exit(1); // End the process - unsuccessful build}};diff --git a/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-1-linux.png b/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-1-linux.pngindex 96a89b187c..5ed44a50cb 100644Binary files a/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-1-linux.png and b/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-1-linux.png differdiff --git a/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-2-linux.png b/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-2-linux.pngindex 769e0dfc2a..c1a75fd583 100644Binary files a/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-2-linux.png and b/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-checks-the-page-visuals-2-linux.png differdiff --git a/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-starts-the-sync-server-and-navigates-to-bootstrap-page-1-linux.png b/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-starts-the-sync-server-and-navigates-to-bootstrap-page-1-linux.pngindex 467e3a0f2d..513c94c70c 100644Binary files a/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-starts-the-sync-server-and-navigates-to-bootstrap-page-1-linux.png and b/packages/desktop-electron/e2e/__screenshots__/onboarding.test.ts/Onboarding-starts-the-sync-server-and-navigates-to-bootstrap-page-1-linux.png differdiff --git a/packages/desktop-electron/e2e/global-setup.ts b/packages/desktop-electron/e2e/global-setup.tsnew file mode 100644index 0000000000..19241f2239--- /dev/null+++ b/packages/desktop-electron/e2e/global-setup.ts@@ -0,0 +1,16 @@+import { execFileSync } from 'node:child_process';++// Electron >= 42 downloads its binary on the first launch instead of at+// install time. Fetch it before the test workers start, otherwise parallel+// workers race the download/extraction and `electron.launch` fails with+// `spawn ETXTBSY`. The install script exits immediately when the binary is+// already present.+function globalSetup() {+ execFileSync(process.execPath, [require.resolve('electron/install.js')], {+ stdio: 'inherit',+ });+}++// Playwright requires the setup function to be the default export.+// oxlint-disable-next-line import/no-default-export+export default globalSetup;diff --git a/packages/desktop-electron/package.json b/packages/desktop-electron/package.jsonindex c6f7606041..9aeedbcec6 100644--- a/packages/desktop-electron/package.json+++ b/packages/desktop-electron/package.json@@ -27,7 +27,7 @@"@typescript/native-preview": "beta","copyfiles": "^2.4.1","cross-env": "^10.1.0",- "electron": "41.10.3",+ "electron": "43.4.0","electron-builder": "26.8.1","typescript-strict-plugin": "^2.4.4"},diff --git a/packages/desktop-electron/playwright.config.ts b/packages/desktop-electron/playwright.config.tsindex a904872cff..ae90efde63 100644--- a/packages/desktop-electron/playwright.config.ts+++ b/packages/desktop-electron/playwright.config.ts@@ -4,6 +4,7 @@ export default defineConfig({timeout: 60000, // 60 secondsretries: 1,testDir: 'e2e/',+ globalSetup: './e2e/global-setup.ts',reporter: process.env.CI? [['list'], ['junit', { outputFile: 'e2e/test-results/junit.xml' }]]: undefined,diff --git a/upcoming-release-notes/update-electron-43.md b/upcoming-release-notes/update-electron-43.mdnew file mode 100644index 0000000000..4695664935--- /dev/null+++ b/upcoming-release-notes/update-electron-43.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [MikesGlitch]+---++Upgrade the desktop Electron runtime from 41 to 43diff --git a/yarn.lock b/yarn.lockindex 75944e70ec..bc0bb44740 100644--- a/yarn.lock+++ b/yarn.lock@@ -13555,7 +13555,7 @@ __metadata:better-sqlite3: "npm:^12.11.1"copyfiles: "npm:^2.4.1"cross-env: "npm:^10.1.0"- electron: "npm:41.10.3"+ electron: "npm:43.4.0"electron-builder: "npm:26.8.1"typescript-strict-plugin: "npm:^2.4.4"languageName: unknown@@ -14004,16 +14004,17 @@ __metadata:languageName: nodelinkType: hard-"electron@npm:41.10.3":- version: 41.10.3- resolution: "electron@npm:41.10.3"+"electron@npm:43.4.0":+ version: 43.4.0+ resolution: "electron@npm:43.4.0"dependencies:"@electron-internal/extract-zip": "npm:^1.0.1""@electron/get": "npm:^5.0.0""@types/node": "npm:^24.9.0"bin:electron: cli.js- checksum: 10/cda634238f7b12f87d5374c0a3af1bfe19d2b38ec6c9e08ed10d288cf4baee73da1483a5adf2a4f5ab1df87fb4f8467c4a3ed27da22cadc5ffa1585aba248990+ install-electron: install.js+ checksum: 10/215b76f05bd23a04040091372fedfcf36d2365362b3f15ce955e0ec0c28fed0377283b7a763ade87c473dc8377a2082b070f92cd94877d40403cf7a3c71cb0a0languageName: nodelinkType: hard