Fix the release build: skip windows metadata when cross-compiling
`bun build --compile --target=bun-windows-x64` rejects `--windows-title` unless
the host is Windows:
error: Using --windows-title is only available when compiling on Windows
build failed for windows-x64 (exit 1)
CI releases all five targets from one Ubuntu runner, so the flag failed the
release on the last of the five builds — after the other four had already been
produced. Locally on Windows it passed, which is why it shipped.
The metadata is now stamped only on a Windows host. The published binary goes
without it rather than the release failing.
Extracted `buildArgs()` so the host-dependent branch is testable: the previous
version could only be checked by running a five-platform build on two operating
systems.
This commit is contained in:
@@ -34,3 +34,24 @@ test('every release target is a real bun target triple', async () => {
|
||||
const { TARGETS } = await import('../scripts/release');
|
||||
for (const t of TARGETS) expect(t.target).toMatch(/^bun-(linux|darwin|windows)-(x64|arm64)$/);
|
||||
});
|
||||
|
||||
test('windows metadata is stamped on a windows host and skipped elsewhere', async () => {
|
||||
const { TARGETS, buildArgs } = await import('../scripts/release');
|
||||
const win = TARGETS.find((t) => t.windows)!;
|
||||
|
||||
expect(buildArgs(win, 'out.exe', 'win32')).toContain('--windows-title=shiro-neko');
|
||||
// bun rejects --windows-title when cross-compiling, and CI releases from Ubuntu.
|
||||
// Passing it there failed the whole release on the last of five builds.
|
||||
expect(buildArgs(win, 'out.exe', 'linux').join(' ')).not.toContain('--windows-');
|
||||
});
|
||||
|
||||
test('every target compiles the same entrypoint with the same flags', async () => {
|
||||
const { TARGETS, buildArgs } = await import('../scripts/release');
|
||||
for (const t of TARGETS) {
|
||||
const args = buildArgs(t, `out-${t.name}`, 'linux');
|
||||
expect(args).toContain('--compile');
|
||||
expect(args).toContain('--minify');
|
||||
expect(args).toContain(`--target=${t.target}`);
|
||||
expect(args).toContain('src/cli.tsx');
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user