perf(cli): skip native-binary build tests by default
The build-exe and build-exe-cross suites invoke `bun build` in beforeAll hooks and pegged CPU for ~6 min on every test run (one cached-on-miss build plus three unconditional cross-target builds). Move them to a dedicated vitest project, skip them unless CI=1 or FUSION_TEST_BUILD_EXE=1 is set, and add cache guards so CI re-runs skip rebuilds when the target binary already exists. With build-exe out of the default cli run, the main config can enable fileParallelism. Run on demand via `pnpm --filter @runfusion/fusion test:build-exe`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,9 +38,15 @@ function nativeTarget(): string | null {
|
||||
return `bun-${platform}-${arch}`;
|
||||
}
|
||||
|
||||
describe("build-exe-cross: single target", () => {
|
||||
// Cross-compiling native binaries pegs CPU for ~60s per target. Skip by
|
||||
// default locally; opt in with FUSION_TEST_BUILD_EXE=1 or run on CI.
|
||||
const SHOULD_RUN_BUILD_EXE =
|
||||
Boolean(process.env.FUSION_TEST_BUILD_EXE) || Boolean(process.env.CI);
|
||||
|
||||
describe.skipIf(!SHOULD_RUN_BUILD_EXE)("build-exe-cross: single target", () => {
|
||||
beforeAll(() => {
|
||||
// Build for linux-x64 specifically
|
||||
const bin = join(distDir, "fn-linux-x64");
|
||||
if (existsSync(bin)) return;
|
||||
execSync("bun run build.ts --target bun-linux-x64", {
|
||||
cwd: cliRoot,
|
||||
stdio: "pipe",
|
||||
@@ -59,8 +65,10 @@ describe("build-exe-cross: single target", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("build-exe-cross: windows target has .exe extension", () => {
|
||||
describe.skipIf(!SHOULD_RUN_BUILD_EXE)("build-exe-cross: windows target has .exe extension", () => {
|
||||
beforeAll(() => {
|
||||
const bin = join(distDir, "fn-windows-x64.exe");
|
||||
if (existsSync(bin)) return;
|
||||
execSync("bun run build.ts --target bun-windows-x64", {
|
||||
cwd: cliRoot,
|
||||
stdio: "pipe",
|
||||
@@ -75,8 +83,12 @@ describe("build-exe-cross: windows target has .exe extension", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("build-exe-cross: --all builds all platforms", () => {
|
||||
describe.skipIf(!SHOULD_RUN_BUILD_EXE)("build-exe-cross: --all builds all platforms", () => {
|
||||
beforeAll(() => {
|
||||
const allBuilt = SUPPORTED_TARGETS.every((target) =>
|
||||
existsSync(join(distDir, expectedBinaryName(target))),
|
||||
);
|
||||
if (allBuilt) return;
|
||||
execSync("bun run build.ts --all", {
|
||||
cwd: cliRoot,
|
||||
stdio: "pipe",
|
||||
@@ -147,8 +159,11 @@ describe("build-exe-cross: --all builds all platforms", () => {
|
||||
}, 60_000);
|
||||
});
|
||||
|
||||
describe("build-exe-cross: default (no args) backward compatibility", () => {
|
||||
describe.skipIf(!SHOULD_RUN_BUILD_EXE)("build-exe-cross: default (no args) backward compatibility", () => {
|
||||
beforeAll(() => {
|
||||
const defaultName = process.platform === "win32" ? "fn.exe" : "fn";
|
||||
const bin = join(distDir, defaultName);
|
||||
if (existsSync(bin)) return;
|
||||
execSync("bun run build.ts", {
|
||||
cwd: cliRoot,
|
||||
stdio: "pipe",
|
||||
|
||||
@@ -61,7 +61,12 @@ async function stopChildProcess(child: ChildProcess | null): Promise<void> {
|
||||
});
|
||||
}
|
||||
|
||||
describe("build-exe", () => {
|
||||
// Native-binary build tests are expensive (~2 min of pegged CPU). Skip by
|
||||
// default locally; opt in with FUSION_TEST_BUILD_EXE=1 or run on CI.
|
||||
const SHOULD_RUN_BUILD_EXE =
|
||||
Boolean(process.env.FUSION_TEST_BUILD_EXE) || Boolean(process.env.CI);
|
||||
|
||||
describe.skipIf(!SHOULD_RUN_BUILD_EXE)("build-exe", () => {
|
||||
beforeAll(() => {
|
||||
// Build the executable (skip if already built to speed up re-runs)
|
||||
if (!existsSync(outBinary)) {
|
||||
|
||||
Reference in New Issue
Block a user