Files
oh-my-pi/scripts/ci-build-native.test.ts
T
roboomp bc7a143c1e fix(setup): used portable native install artifacts
- Built the generic Windows release binary with Bun's baseline x64 runtime so older Windows 10 CPUs do not hit the AVX2-only modern executable.

- Forced pi-natives release builds to link PCRE2 statically so macOS installs do not depend on Homebrew's libpcre2 dylib.

- Added release dry-run and native-build regression coverage for the portable artifact contracts.

Fixes #5172
2026-07-11 09:47:37 +00:00

37 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "bun:test";
import * as path from "node:path";
import { $ } from "bun";
const repoRoot = path.join(import.meta.dir, "..");
async function runCiNativeDryRun(env: Record<string, string | undefined> = {}): Promise<string> {
const result = await $`bun scripts/ci-build-native.ts --dry-run`
.cwd(repoRoot)
.quiet()
.env({
...process.env,
PCRE2_SYS_STATIC: "0",
RUSTFLAGS: "",
TARGET_VARIANT: "",
TARGET_VARIANTS: "",
...env,
})
.nothrow();
expect(result.exitCode).toBe(0);
return result.text();
}
describe("ci native build environment", () => {
it("prints static PCRE2 env for the default native build dry run", async () => {
await expect(runCiNativeDryRun()).resolves.toBe(
"DRY RUN bun --cwd=packages/natives run build [default] PCRE2_SYS_STATIC=1\n",
);
});
it("prints static PCRE2 env without dropping x64 variant settings", async () => {
await expect(runCiNativeDryRun({ TARGET_VARIANTS: "baseline" })).resolves.toBe(
'DRY RUN bun --cwd=packages/natives run build [baseline] PCRE2_SYS_STATIC=1 TARGET_VARIANT=baseline RUSTFLAGS="-C target-cpu=x86-64-v2"\n',
);
});
});