(args = Bun.argv.slice(2))
| 73 | |
| 74 | /** Run the default benchmark suite and write the versioned release snapshot. */ |
| 75 | export async function main(args = Bun.argv.slice(2)) { |
| 76 | const options = await parseRunReleaseBenchmarkArgs(args); |
| 77 | mkdirSync(path.dirname(options.out), { recursive: true }); |
| 78 | |
| 79 | const proc = Bun.spawn( |
| 80 | ["bun", "run", "benchmarks/run.ts", "--samples", String(options.samples), "--out", options.out], |
| 81 | { |
| 82 | cwd: repoRoot, |
| 83 | stdin: "inherit", |
| 84 | stdout: "inherit", |
| 85 | stderr: "inherit", |
| 86 | env: { ...process.env, CI: process.env.CI ?? "1" }, |
| 87 | }, |
| 88 | ); |
| 89 | const exitCode = await proc.exited; |
| 90 | if (exitCode !== 0) { |
| 91 | throw new Error(`Release benchmark run failed with exit code ${exitCode}`); |
| 92 | } |
| 93 | |
| 94 | console.log(`Wrote release benchmark ${options.out}`); |
| 95 | console.log("Commit this file with the release prep change before pushing the release tag."); |
| 96 | } |
| 97 | |
| 98 | if (import.meta.main) { |
| 99 | await main(); |
no test coverage detected