Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,29 @@ jobs:
if: steps.windows-release-mode.outputs.signed == 'true'
run: node scripts/configure-win-signing.js electron-builder.json

- name: Keep the Windows zip off maximum compression
# At the top-level `compression: maximum`, electron-builder builds the zip
# with 15-pass Deflate, which outlasts this job's timeout on the x64 CUDA
# libraries. electron-builder.json now sets win.compression to normal;
# this applies the same setting to tags cut before it did (v5.1.0) and is
# a no-op afterwards. The NSIS app archive uses the same 7z settings
# either way, and only the x64 leg builds the zip.
if: matrix.arch == 'x64'
shell: bash
run: |
node -e '
const fs = require("fs");
const file = "electron-builder.json";
const config = JSON.parse(fs.readFileSync(file, "utf8"));
if (config.win.compression === undefined) {
config.win.compression = "normal";
fs.writeFileSync(file, JSON.stringify(config, null, 2) + "\n");
console.log("Set win.compression to normal for this build.");
} else {
console.log("win.compression is already " + config.win.compression + ".");
}
'

- name: Clean release output directory
shell: pwsh
run: |
Expand Down
1 change: 1 addition & 0 deletions electron-builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
"win": {
"icon": "assets/icons/win/icon.ico",
"target": ["nsis", "zip"],
"compression": "normal",
"files": [
"!**/node_modules/better-sqlite3/prebuilds/!(win32-${arch}).node",
"!**/node_modules/@node-llama-cpp/win-!(${arch}|${arch}-*)/**"
Expand Down
21 changes: 21 additions & 0 deletions test/electron-builder-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,27 @@ describe('electron-builder.json Windows targets', () => {
});
});

// The top-level `compression: maximum` turns a zip into 15-pass Deflate
// (-mfb=258 -mpass=15), which ran the x64 release job past its 45-minute limit
// on the CUDA libraries. win.compression overrides it for both Windows targets.
describe('electron-builder.json Windows compression', () => {
const { compute7zCompressArgs } = require('app-builder-lib/out/targets/archive');
const winCompression = builderConfig.win.compression;

test('the Windows zip is not built with 15-pass Deflate', () => {
expect(winCompression).toBe('normal');
expect(compute7zCompressArgs('zip', { compression: winCompression })).not.toContain(
'-mpass=15'
);
});

test('the NSIS app archive keeps the 7z settings it had at maximum', () => {
expect(compute7zCompressArgs('7z', { compression: winCompression })).toEqual(
compute7zCompressArgs('7z', { compression: 'maximum' })
);
});
});

// Runs app-builder-lib's own node_modules filter (the one NodeModuleCopyHelper
// applies while copying dependencies) against the committed `files` patterns.
describe('electron-builder.json node_modules exclusions', () => {
Expand Down
Loading