Skip to content

Commit a3edb20

Browse files
authored
🤖 ci: optimize Windows builds with caching and MSYS2 (#1055)
_Generated with `mux`_ Optimizations: - Cache Electron binaries and electron-builder resources - Replace `choco install make` with MSYS2 pacman (pre-installed) **Benchmarks (warm cache):** | Runner | Total | dist-win | |--------|-------|----------| | windows-latest | 5m58s | 166s | | depot-windows-2022-16 | 7m23s | 85s | | depot-windows-2022-32 | 7m31s | 82s | Depot runners have 2x faster electron-builder but ~130s setup overhead negates the gains. Keeping `windows-latest`.
1 parent 5ac2a94 commit a3edb20

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed

.github/actions/setup-mux/action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,27 @@ runs:
4848
if: steps.check-node-modules.outputs.exists != 'true'
4949
shell: bash
5050
run: bun install --frozen-lockfile
51+
52+
# Cache Electron binaries and electron-builder resources (NSIS, etc.)
53+
# These are downloaded during electron-builder and can be 200MB+ total
54+
- name: Cache Electron
55+
uses: actions/cache@v4
56+
with:
57+
path: |
58+
~/.cache/electron
59+
~/Library/Caches/electron
60+
~/AppData/Local/electron/Cache
61+
key: ${{ runner.os }}-${{ runner.arch }}-electron-${{ hashFiles('**/bun.lock') }}
62+
restore-keys: |
63+
${{ runner.os }}-${{ runner.arch }}-electron-
64+
65+
- name: Cache electron-builder
66+
uses: actions/cache@v4
67+
with:
68+
path: |
69+
~/.cache/electron-builder
70+
~/Library/Caches/electron-builder
71+
~/AppData/Local/electron-builder/Cache
72+
key: ${{ runner.os }}-${{ runner.arch }}-electron-builder-${{ hashFiles('**/bun.lock') }}
73+
restore-keys: |
74+
${{ runner.os }}-${{ runner.arch }}-electron-builder-

.github/workflows/pr.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,13 @@ jobs:
292292
with:
293293
fetch-depth: 0
294294
- uses: ./.github/actions/setup-mux
295-
- name: Install GNU Make
296-
run: choco install -y make
295+
- name: Add MSYS2 make to PATH
296+
shell: pwsh
297+
run: |
298+
# MSYS2 is pre-installed on Windows runners, just needs to be in PATH
299+
# Install make via pacman (faster than choco)
300+
C:\msys64\usr\bin\pacman.exe -S --noconfirm make
301+
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
297302
- name: Verify tools
298303
shell: bash
299304
run: |

.github/workflows/release.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,17 @@ jobs:
152152
uses: actions/checkout@v4
153153
with:
154154
ref: ${{ inputs.tag || github.ref }}
155-
fetch-depth: 0 # Required for git describe to find tags
155+
fetch-depth: 0
156156

157157
- uses: ./.github/actions/setup-mux
158158

159-
- name: Install GNU Make (for build)
160-
run: choco install -y make
159+
- name: Add MSYS2 make to PATH
160+
shell: pwsh
161+
run: |
162+
# MSYS2 is pre-installed on Windows runners, just needs to be in PATH
163+
# Install make via pacman (faster than choco)
164+
C:\msys64\usr\bin\pacman.exe -S --noconfirm make
165+
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
161166
162167
- name: Verify tools
163168
shell: bash

0 commit comments

Comments
 (0)