Skip to content

Commit 1457651

Browse files
committed
fix(ci): use different runners for macos arm and intel arch
Update GitHub Actions workflow to support multiple OS runners and CPU architectures, standardize matrix keys, and adjust platform-specific steps and artifact names. - Replace simple os matrix with include entries specifying os, runner, and arch to allow macOS x64/arm64 separation and explicit runners for linux/windows. - Use runner matrix value for runs-on and change timeout/strategy accordingly. - Adjust conditional checks to use normalized os values (linux, macos, windows) rather than platform-specific runner labels. - Install Linux system deps only when os == 'linux' and keep Flatpak setup for electron-builder. - Add a macOS-specific make step that passes the architecture to the electron make command, while keeping a combined make step for non-macOS builds. - Upload macOS artifacts per architecture and rename artifact paths to include arch; update release files list to include both macOS x64 and arm64 artifact patterns. These changes enable reliable, architecture-aware macOS builds, prevent native module conflicts across runners, and ensure artifacts are labeled and uploaded correctly.
1 parent ddc87e9 commit 1457651

File tree

1 file changed

+40
-21
lines changed

1 file changed

+40
-21
lines changed

.github/workflows/build-and-make.yaml

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,24 @@ on:
1515

1616
jobs:
1717
build:
18-
name: Build on ${{ matrix.os }}
19-
runs-on: ${{ matrix.os }}
18+
name: Build on ${{ matrix.os }} ${{ matrix.arch }}
19+
runs-on: ${{ matrix.runner }}
2020
timeout-minutes: 60
2121
strategy:
2222
matrix:
23-
os: [macos-latest, ubuntu-latest, windows-latest]
23+
include:
24+
# macOS builds - separate runners to avoid native module conflicts
25+
- os: macos
26+
runner: macos-15-intel
27+
arch: x64
28+
- os: macos
29+
runner: macos-latest
30+
arch: arm64
31+
# Linux and Windows
32+
- os: linux
33+
runner: ubuntu-latest
34+
- os: windows
35+
runner: windows-latest
2436

2537
steps:
2638
- name: Checkout code
@@ -38,18 +50,18 @@ jobs:
3850
cache: 'pnpm'
3951

4052
- name: Install Linux system dependencies
41-
if: matrix.os == 'ubuntu-latest'
53+
if: matrix.os == 'linux'
4254
run: |
43-
sudo apt-get update
44-
sudo apt-get install --no-install-recommends -y rpm libarchive-tools flatpak flatpak-builder
45-
46-
# Configure Flatpak
47-
# 1. Add the Flathub repository (source of runtimes)
48-
flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
49-
50-
# 2. Install the standard Freedesktop Platform and SDK (required by electron-builder)
51-
# We install version 24.08 as a safe default, electron-builder might pick what it needs
52-
flatpak install --user -y flathub org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08
55+
sudo apt-get update
56+
sudo apt-get install --no-install-recommends -y rpm libarchive-tools flatpak flatpak-builder
57+
58+
# Configure Flatpak
59+
# 1. Add the Flathub repository (source of runtimes)
60+
flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
61+
62+
# 2. Install the standard Freedesktop Platform and SDK (required by electron-builder)
63+
# We install version 24.08 as a safe default, electron-builder might pick what it needs
64+
flatpak install --user -y flathub org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08
5365
5466
- name: Install dependencies
5567
run: pnpm install --no-frozen-lockfile
@@ -60,21 +72,26 @@ jobs:
6072
- name: Build backend
6173
run: npm run build:backend
6274

63-
- name: Make Electron app
75+
- name: Make Electron app (macOS)
76+
if: matrix.os == 'macos'
77+
run: npx nx run electron-backend:make --skip-nx-cache -- --arch=${{ matrix.arch }}
78+
79+
- name: Make Electron app (Linux/Windows)
80+
if: matrix.os != 'macos'
6481
run: npm run make:app
6582

6683
- name: Upload artifacts (macOS)
67-
if: matrix.os == 'macos-latest'
84+
if: matrix.os == 'macos'
6885
uses: actions/upload-artifact@v4
6986
with:
70-
name: macos-artifacts
87+
name: macos-${{ matrix.arch }}-artifacts
7188
path: |
7289
dist/executables/**/*.dmg
7390
dist/executables/**/*.zip
7491
retention-days: 7
7592

7693
- name: Upload artifacts (Linux)
77-
if: matrix.os == 'ubuntu-latest'
94+
if: matrix.os == 'linux'
7895
uses: actions/upload-artifact@v4
7996
with:
8097
name: linux-artifacts
@@ -89,7 +106,7 @@ jobs:
89106
retention-days: 7
90107

91108
- name: Upload artifacts (Windows)
92-
if: matrix.os == 'windows-latest'
109+
if: matrix.os == 'windows'
93110
uses: actions/upload-artifact@v4
94111
with:
95112
name: windows-artifacts
@@ -131,8 +148,10 @@ jobs:
131148
tag_name: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || format('test-{0}', github.sha) }}
132149
generate_release_notes: true
133150
files: |
134-
artifacts/macos-artifacts/*.dmg
135-
artifacts/macos-artifacts/*.zip
151+
artifacts/macos-x64-artifacts/*.dmg
152+
artifacts/macos-x64-artifacts/*.zip
153+
artifacts/macos-arm64-artifacts/*.dmg
154+
artifacts/macos-arm64-artifacts/*.zip
136155
artifacts/linux-artifacts/*.AppImage
137156
artifacts/linux-artifacts/*.deb
138157
artifacts/linux-artifacts/*.rpm

0 commit comments

Comments
 (0)