mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 23:18:47 +00:00
Compare commits
169 Commits
dylan/ref-
...
jarred/fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3515f7f755 | ||
|
|
d5a118e25f | ||
|
|
1911fa1e75 | ||
|
|
6dbf1bff4f | ||
|
|
a5a0539f26 | ||
|
|
3393b0e1d3 | ||
|
|
910efec0b7 | ||
|
|
dafd8156b0 | ||
|
|
befb269b2d | ||
|
|
39d8ade27c | ||
|
|
4fedc41545 | ||
|
|
15f2bbb33a | ||
|
|
4ddb63e7e2 | ||
|
|
3791146476 | ||
|
|
910e479d29 | ||
|
|
266e033d6f | ||
|
|
9a6f033206 | ||
|
|
2810f39802 | ||
|
|
3170b88058 | ||
|
|
357581c61a | ||
|
|
d8987ccdb8 | ||
|
|
fdd8d35845 | ||
|
|
32ddf343ee | ||
|
|
bceb0a2327 | ||
|
|
9b0cdf01f9 | ||
|
|
35513a9d6d | ||
|
|
f8979b05b1 | ||
|
|
ec91e91fda | ||
|
|
956853f036 | ||
|
|
c5df329772 | ||
|
|
e945146fde | ||
|
|
873b0a7540 | ||
|
|
c785ab921b | ||
|
|
797958082c | ||
|
|
2b9abc20da | ||
|
|
d713001e35 | ||
|
|
b49f6d143e | ||
|
|
4cf9851747 | ||
|
|
56f7c8887b | ||
|
|
62cabe9003 | ||
|
|
781a392baa | ||
|
|
d879f4370d | ||
|
|
ae6e23ab28 | ||
|
|
7a9165555d | ||
|
|
b54137174b | ||
|
|
635789944b | ||
|
|
a1c4f667d9 | ||
|
|
07dc1ae547 | ||
|
|
8f5eab3c84 | ||
|
|
6ec03b8b05 | ||
|
|
183c661c40 | ||
|
|
c2e7643aa9 | ||
|
|
376b1b4f97 | ||
|
|
27067d2a6d | ||
|
|
1e932ff38b | ||
|
|
a116b2281e | ||
|
|
66ba6ba061 | ||
|
|
8d4bb080a3 | ||
|
|
bef50a9b9b | ||
|
|
56b57012ed | ||
|
|
c39ae74d3e | ||
|
|
fc071d3362 | ||
|
|
1a9d20e50a | ||
|
|
8d8a6bc5c3 | ||
|
|
076d1d3d36 | ||
|
|
484c3de861 | ||
|
|
27a1b2413b | ||
|
|
3950873272 | ||
|
|
6fb73f2011 | ||
|
|
497fa59bf0 | ||
|
|
5e5e7c60f1 | ||
|
|
85fd471d9d | ||
|
|
6914c5e32c | ||
|
|
ce2afac827 | ||
|
|
5236d974b5 | ||
|
|
6e448619d0 | ||
|
|
c89a958299 | ||
|
|
d75488124d | ||
|
|
4d269995ad | ||
|
|
71fdb59918 | ||
|
|
62881ee36b | ||
|
|
6933208790 | ||
|
|
b1e9e3b31b | ||
|
|
7035a1107e | ||
|
|
353d44f1ae | ||
|
|
4b8ca51b87 | ||
|
|
f8d5b2e6e2 | ||
|
|
9647291d73 | ||
|
|
eaa088ba55 | ||
|
|
955cc6265b | ||
|
|
489890deb1 | ||
|
|
d7710c6c67 | ||
|
|
9f70f68f00 | ||
|
|
240b2a539f | ||
|
|
b9e5420571 | ||
|
|
b5a73130ad | ||
|
|
d5f9978007 | ||
|
|
698e87aa67 | ||
|
|
5502278f3e | ||
|
|
f005e8c057 | ||
|
|
e93c5ad993 | ||
|
|
5237869101 | ||
|
|
2456d70ac7 | ||
|
|
50d80a805d | ||
|
|
2d9a73fc07 | ||
|
|
d0b3802a79 | ||
|
|
7053212566 | ||
|
|
4f5660a6f7 | ||
|
|
87279392cf | ||
|
|
7f5860331e | ||
|
|
b895738156 | ||
|
|
61534c7efe | ||
|
|
ec4c9f8f84 | ||
|
|
35a64d8585 | ||
|
|
eb6995e09b | ||
|
|
1391e5269b | ||
|
|
9621b641a1 | ||
|
|
5eaa7301eb | ||
|
|
f21870a06c | ||
|
|
0e4006eefd | ||
|
|
9643a924e1 | ||
|
|
247456b675 | ||
|
|
6f60523e6c | ||
|
|
2de2e9f600 | ||
|
|
29bf8a505d | ||
|
|
93d115f9b7 | ||
|
|
74e440d58a | ||
|
|
aa4dde976d | ||
|
|
eb0e9b9bde | ||
|
|
a656cc1b70 | ||
|
|
4044ff740d | ||
|
|
b9240f6ec7 | ||
|
|
3db0191409 | ||
|
|
00b055566e | ||
|
|
517cdc1392 | ||
|
|
8b4b55725e | ||
|
|
38d39109b3 | ||
|
|
ec29311c7a | ||
|
|
fe8d0079ec | ||
|
|
8063e9d6b8 | ||
|
|
ae8de1926e | ||
|
|
b9b94de5ed | ||
|
|
070e5804ad | ||
|
|
67b4478137 | ||
|
|
522c9fa22d | ||
|
|
4b63ffeceb | ||
|
|
fe45b1e9b9 | ||
|
|
d41ca824dd | ||
|
|
663331c56f | ||
|
|
64d0b626b9 | ||
|
|
e5c00ab4b4 | ||
|
|
4f2d924db3 | ||
|
|
bf8a75a63f | ||
|
|
253cc15a9f | ||
|
|
fbf4b30e70 | ||
|
|
f3b658d9f7 | ||
|
|
b652136cf7 | ||
|
|
8376b82371 | ||
|
|
7bb39023b8 | ||
|
|
850cdb0587 | ||
|
|
2f2a24f625 | ||
|
|
e448c4cc3b | ||
|
|
2d0b557ff7 | ||
|
|
15f5ba3e26 | ||
|
|
1385f9f686 | ||
|
|
07ccec0fd8 | ||
|
|
7283453eed | ||
|
|
1a08cfcd6b | ||
|
|
06e733cc64 |
809
.buildkite/ci.mjs
Executable file
809
.buildkite/ci.mjs
Executable file
@@ -0,0 +1,809 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Build and test Bun on macOS, Linux, and Windows.
|
||||
* @link https://buildkite.com/docs/pipelines/defining-steps
|
||||
*/
|
||||
|
||||
import { writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import {
|
||||
getBootstrapVersion,
|
||||
getBuildNumber,
|
||||
getCanaryRevision,
|
||||
getChangedFiles,
|
||||
getCommit,
|
||||
getCommitMessage,
|
||||
getLastSuccessfulBuild,
|
||||
getMainBranch,
|
||||
getTargetBranch,
|
||||
isBuildkite,
|
||||
isFork,
|
||||
isMainBranch,
|
||||
isMergeQueue,
|
||||
printEnvironment,
|
||||
spawnSafe,
|
||||
toYaml,
|
||||
uploadArtifact,
|
||||
} from "../scripts/utils.mjs";
|
||||
|
||||
/**
|
||||
* @typedef PipelineOptions
|
||||
* @property {string} [buildId]
|
||||
* @property {boolean} [buildImages]
|
||||
* @property {boolean} [publishImages]
|
||||
* @property {boolean} [skipTests]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {PipelineOptions} options
|
||||
*/
|
||||
function getPipeline(options) {
|
||||
const { buildId, buildImages, publishImages, skipTests } = options;
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} text
|
||||
* @returns {string}
|
||||
* @link https://github.com/buildkite/emojis#emoji-reference
|
||||
*/
|
||||
const getEmoji = string => {
|
||||
if (string === "amazonlinux") {
|
||||
return ":aws:";
|
||||
}
|
||||
return `:${string}:`;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {"linux" | "darwin" | "windows"} Os
|
||||
* @typedef {"aarch64" | "x64"} Arch
|
||||
* @typedef {"musl"} Abi
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef Target
|
||||
* @property {Os} os
|
||||
* @property {Arch} arch
|
||||
* @property {Abi} [abi]
|
||||
* @property {boolean} [baseline]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {string}
|
||||
*/
|
||||
const getTargetKey = target => {
|
||||
const { os, arch, abi, baseline } = target;
|
||||
let key = `${os}-${arch}`;
|
||||
if (abi) {
|
||||
key += `-${abi}`;
|
||||
}
|
||||
if (baseline) {
|
||||
key += "-baseline";
|
||||
}
|
||||
return key;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {string}
|
||||
*/
|
||||
const getTargetLabel = target => {
|
||||
const { os, arch, abi, baseline } = target;
|
||||
let label = `${getEmoji(os)} ${arch}`;
|
||||
if (abi) {
|
||||
label += `-${abi}`;
|
||||
}
|
||||
if (baseline) {
|
||||
label += "-baseline";
|
||||
}
|
||||
return label;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef Platform
|
||||
* @property {Os} os
|
||||
* @property {Arch} arch
|
||||
* @property {Abi} [abi]
|
||||
* @property {boolean} [baseline]
|
||||
* @property {string} [distro]
|
||||
* @property {string} release
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {string}
|
||||
*/
|
||||
const getPlatformKey = platform => {
|
||||
const { os, arch, abi, baseline, distro, release } = platform;
|
||||
const target = getTargetKey({ os, arch, abi, baseline });
|
||||
if (distro) {
|
||||
return `${target}-${distro}-${release.replace(/\./g, "")}`;
|
||||
}
|
||||
return `${target}-${release.replace(/\./g, "")}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {string}
|
||||
*/
|
||||
const getPlatformLabel = platform => {
|
||||
const { os, arch, baseline, distro, release } = platform;
|
||||
let label = `${getEmoji(distro || os)} ${release} ${arch}`;
|
||||
if (baseline) {
|
||||
label += "-baseline";
|
||||
}
|
||||
return label;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {string}
|
||||
*/
|
||||
const getImageKey = platform => {
|
||||
const { os, arch, distro, release } = platform;
|
||||
if (distro) {
|
||||
return `${os}-${arch}-${distro}-${release.replace(/\./g, "")}`;
|
||||
}
|
||||
return `${os}-${arch}-${release.replace(/\./g, "")}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {string}
|
||||
*/
|
||||
const getImageLabel = platform => {
|
||||
const { os, arch, distro, release } = platform;
|
||||
return `${getEmoji(distro || os)} ${release} ${arch}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} [limit]
|
||||
* @link https://buildkite.com/docs/pipelines/command-step#retry-attributes
|
||||
*/
|
||||
const getRetry = (limit = 0) => {
|
||||
return {
|
||||
automatic: [
|
||||
{ exit_status: 1, limit },
|
||||
{ exit_status: -1, limit: 3 },
|
||||
{ exit_status: 255, limit: 3 },
|
||||
{ signal_reason: "agent_stop", limit: 3 },
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
* @link https://buildkite.com/docs/pipelines/managing-priorities
|
||||
*/
|
||||
const getPriority = () => {
|
||||
if (isFork()) {
|
||||
return -1;
|
||||
}
|
||||
if (isMainBranch()) {
|
||||
return 2;
|
||||
}
|
||||
if (isMergeQueue()) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {Record<string, string | undefined>}
|
||||
*/
|
||||
const getBuildEnv = target => {
|
||||
const { baseline, abi } = target;
|
||||
return {
|
||||
ENABLE_BASELINE: baseline ? "ON" : "OFF",
|
||||
ABI: abi === "musl" ? "musl" : undefined,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {string}
|
||||
*/
|
||||
const getBuildToolchain = target => {
|
||||
const { os, arch, abi, baseline } = target;
|
||||
let key = `${os}-${arch}`;
|
||||
if (abi) {
|
||||
key += `-${abi}`;
|
||||
}
|
||||
if (baseline) {
|
||||
key += "-baseline";
|
||||
}
|
||||
return key;
|
||||
};
|
||||
|
||||
/**
|
||||
* Agents
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Record<string, string | undefined>} Agent
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {boolean}
|
||||
*/
|
||||
const isUsingNewAgent = platform => {
|
||||
const { os, distro } = platform;
|
||||
if (os === "linux" && distro === "alpine") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {"v1" | "v2"} version
|
||||
* @param {Platform} platform
|
||||
* @param {string} [instanceType]
|
||||
* @returns {Agent}
|
||||
*/
|
||||
const getEmphemeralAgent = (version, platform, instanceType) => {
|
||||
const { os, arch, abi, distro, release } = platform;
|
||||
if (version === "v1") {
|
||||
return {
|
||||
robobun: true,
|
||||
os,
|
||||
arch,
|
||||
distro,
|
||||
release,
|
||||
};
|
||||
}
|
||||
let image;
|
||||
if (distro) {
|
||||
image = `${os}-${arch}-${distro}-${release}`;
|
||||
} else {
|
||||
image = `${os}-${arch}-${release}`;
|
||||
}
|
||||
if (buildImages && !publishImages) {
|
||||
image += `-build-${getBuildNumber()}`;
|
||||
} else {
|
||||
image += `-v${getBootstrapVersion()}`;
|
||||
}
|
||||
return {
|
||||
robobun: true,
|
||||
robobun2: true,
|
||||
os,
|
||||
arch,
|
||||
abi,
|
||||
distro,
|
||||
release,
|
||||
"image-name": image,
|
||||
"instance-type": instanceType,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {Agent}
|
||||
*/
|
||||
const getBuildAgent = target => {
|
||||
const { os, arch, abi } = target;
|
||||
if (isUsingNewAgent(target)) {
|
||||
const instanceType = arch === "aarch64" ? "c8g.8xlarge" : "c7i.8xlarge";
|
||||
return getEmphemeralAgent("v2", target, instanceType);
|
||||
}
|
||||
return {
|
||||
queue: `build-${os}`,
|
||||
os,
|
||||
arch,
|
||||
abi,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {Agent}
|
||||
*/
|
||||
const getZigAgent = target => {
|
||||
const { abi, arch } = target;
|
||||
// if (abi === "musl") {
|
||||
// const instanceType = arch === "aarch64" ? "c8g.large" : "c7i.large";
|
||||
// return getEmphemeralAgent("v2", target, instanceType);
|
||||
// }
|
||||
return {
|
||||
queue: "build-zig",
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {Agent}
|
||||
*/
|
||||
const getTestAgent = platform => {
|
||||
const { os, arch, release } = platform;
|
||||
if (isUsingNewAgent(platform)) {
|
||||
const instanceType = arch === "aarch64" ? "t4g.large" : "t3.large";
|
||||
return getEmphemeralAgent("v2", platform, instanceType);
|
||||
}
|
||||
if (os === "darwin") {
|
||||
return {
|
||||
os,
|
||||
arch,
|
||||
release,
|
||||
queue: "test-darwin",
|
||||
};
|
||||
}
|
||||
return getEmphemeralAgent("v1", platform);
|
||||
};
|
||||
|
||||
/**
|
||||
* Steps
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef Step
|
||||
* @property {string} key
|
||||
* @property {string} [label]
|
||||
* @property {Record<string, string | undefined>} [agents]
|
||||
* @property {Record<string, string | undefined>} [env]
|
||||
* @property {string} command
|
||||
* @property {string[]} [depends_on]
|
||||
* @property {Record<string, string | undefined>} [retry]
|
||||
* @property {boolean} [cancel_on_build_failing]
|
||||
* @property {boolean} [soft_fail]
|
||||
* @property {number} [parallelism]
|
||||
* @property {number} [concurrency]
|
||||
* @property {string} [concurrency_group]
|
||||
* @property {number} [priority]
|
||||
* @property {number} [timeout_in_minutes]
|
||||
* @link https://buildkite.com/docs/pipelines/command-step
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getBuildImageStep = platform => {
|
||||
const { os, arch, distro, release } = platform;
|
||||
const action = publishImages ? "publish-image" : "create-image";
|
||||
return {
|
||||
key: `${getImageKey(platform)}-build-image`,
|
||||
label: `${getImageLabel(platform)} - build-image`,
|
||||
agents: {
|
||||
queue: "build-image",
|
||||
},
|
||||
env: {
|
||||
DEBUG: "1",
|
||||
},
|
||||
command: `node ./scripts/machine.mjs ${action} --ci --cloud=aws --os=${os} --arch=${arch} --distro=${distro} --distro-version=${release}`,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getBuildVendorStep = target => {
|
||||
return {
|
||||
key: `${getTargetKey(target)}-build-vendor`,
|
||||
label: `${getTargetLabel(target)} - build-vendor`,
|
||||
agents: getBuildAgent(target),
|
||||
retry: getRetry(),
|
||||
cancel_on_build_failing: isMergeQueue(),
|
||||
env: getBuildEnv(target),
|
||||
command: "bun run build:ci --target dependencies",
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getBuildCppStep = target => {
|
||||
return {
|
||||
key: `${getTargetKey(target)}-build-cpp`,
|
||||
label: `${getTargetLabel(target)} - build-cpp`,
|
||||
agents: getBuildAgent(target),
|
||||
retry: getRetry(),
|
||||
cancel_on_build_failing: isMergeQueue(),
|
||||
env: {
|
||||
BUN_CPP_ONLY: "ON",
|
||||
...getBuildEnv(target),
|
||||
},
|
||||
command: "bun run build:ci --target bun",
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getBuildZigStep = target => {
|
||||
const toolchain = getBuildToolchain(target);
|
||||
return {
|
||||
key: `${getTargetKey(target)}-build-zig`,
|
||||
label: `${getTargetLabel(target)} - build-zig`,
|
||||
agents: getZigAgent(target),
|
||||
retry: getRetry(1), // FIXME: Sometimes zig build hangs, so we need to retry once
|
||||
cancel_on_build_failing: isMergeQueue(),
|
||||
env: getBuildEnv(target),
|
||||
command: `bun run build:ci --target bun-zig --toolchain ${toolchain}`,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Target} target
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getBuildBunStep = target => {
|
||||
return {
|
||||
key: `${getTargetKey(target)}-build-bun`,
|
||||
label: `${getTargetLabel(target)} - build-bun`,
|
||||
depends_on: [
|
||||
`${getTargetKey(target)}-build-vendor`,
|
||||
`${getTargetKey(target)}-build-cpp`,
|
||||
`${getTargetKey(target)}-build-zig`,
|
||||
],
|
||||
agents: getBuildAgent(target),
|
||||
retry: getRetry(),
|
||||
cancel_on_build_failing: isMergeQueue(),
|
||||
env: {
|
||||
BUN_LINK_ONLY: "ON",
|
||||
...getBuildEnv(target),
|
||||
},
|
||||
command: "bun run build:ci --target bun",
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @returns {Step}
|
||||
*/
|
||||
const getTestBunStep = platform => {
|
||||
const { os } = platform;
|
||||
let command;
|
||||
if (os === "windows") {
|
||||
command = `node .\\scripts\\runner.node.mjs --step ${getTargetKey(platform)}-build-bun`;
|
||||
} else {
|
||||
command = `./scripts/runner.node.mjs --step ${getTargetKey(platform)}-build-bun`;
|
||||
}
|
||||
let parallelism;
|
||||
if (os === "darwin") {
|
||||
parallelism = 2;
|
||||
} else {
|
||||
parallelism = 10;
|
||||
}
|
||||
let depends;
|
||||
let env;
|
||||
if (buildId) {
|
||||
env = {
|
||||
BUILDKITE_ARTIFACT_BUILD_ID: buildId,
|
||||
};
|
||||
} else {
|
||||
depends = [`${getTargetKey(platform)}-build-bun`];
|
||||
}
|
||||
let retry;
|
||||
if (os !== "windows") {
|
||||
// When the runner fails on Windows, Buildkite only detects an exit code of 1.
|
||||
// Because of this, we don't know if the run was fatal, or soft-failed.
|
||||
retry = getRetry(1);
|
||||
}
|
||||
return {
|
||||
key: `${getPlatformKey(platform)}-test-bun`,
|
||||
label: `${getPlatformLabel(platform)} - test-bun`,
|
||||
depends_on: depends,
|
||||
agents: getTestAgent(platform),
|
||||
retry,
|
||||
cancel_on_build_failing: isMergeQueue(),
|
||||
soft_fail: isMainBranch(),
|
||||
parallelism,
|
||||
command,
|
||||
env,
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Config
|
||||
*/
|
||||
|
||||
/**
|
||||
* @type {Platform[]}
|
||||
*/
|
||||
const buildPlatforms = [
|
||||
{ os: "darwin", arch: "aarch64", release: "14" },
|
||||
{ os: "darwin", arch: "x64", release: "14" },
|
||||
{ os: "linux", arch: "aarch64", distro: "debian", release: "11" },
|
||||
{ os: "linux", arch: "x64", distro: "debian", release: "11" },
|
||||
{ os: "linux", arch: "x64", baseline: true, distro: "debian", release: "11" },
|
||||
{ os: "linux", arch: "aarch64", abi: "musl", distro: "alpine", release: "3.20" },
|
||||
{ os: "linux", arch: "x64", abi: "musl", distro: "alpine", release: "3.20" },
|
||||
{ os: "linux", arch: "x64", abi: "musl", baseline: true, distro: "alpine", release: "3.20" },
|
||||
{ os: "windows", arch: "x64", release: "2019" },
|
||||
{ os: "windows", arch: "x64", baseline: true, release: "2019" },
|
||||
];
|
||||
|
||||
/**
|
||||
* @type {Platform[]}
|
||||
*/
|
||||
const testPlatforms = [
|
||||
{ os: "darwin", arch: "aarch64", release: "14" },
|
||||
{ os: "darwin", arch: "aarch64", release: "13" },
|
||||
{ os: "darwin", arch: "x64", release: "14" },
|
||||
{ os: "darwin", arch: "x64", release: "13" },
|
||||
{ os: "linux", arch: "aarch64", distro: "debian", release: "12" },
|
||||
// { os: "linux", arch: "aarch64", distro: "debian", release: "11" },
|
||||
// { os: "linux", arch: "aarch64", distro: "debian", release: "10" },
|
||||
{ os: "linux", arch: "x64", distro: "debian", release: "12" },
|
||||
// { os: "linux", arch: "x64", distro: "debian", release: "11" },
|
||||
// { os: "linux", arch: "x64", distro: "debian", release: "10" },
|
||||
{ os: "linux", arch: "x64", baseline: true, distro: "debian", release: "12" },
|
||||
// { os: "linux", arch: "x64", baseline: true, distro: "debian", release: "11" },
|
||||
// { os: "linux", arch: "x64", baseline: true, distro: "debian", release: "10" },
|
||||
// { os: "linux", arch: "aarch64", distro: "ubuntu", release: "24.04" },
|
||||
{ os: "linux", arch: "aarch64", distro: "ubuntu", release: "22.04" },
|
||||
{ os: "linux", arch: "aarch64", distro: "ubuntu", release: "20.04" },
|
||||
// { os: "linux", arch: "x64", distro: "ubuntu", release: "24.04" },
|
||||
{ os: "linux", arch: "x64", distro: "ubuntu", release: "22.04" },
|
||||
{ os: "linux", arch: "x64", distro: "ubuntu", release: "20.04" },
|
||||
// { os: "linux", arch: "x64", baseline: true, distro: "ubuntu", release: "24.04" },
|
||||
{ os: "linux", arch: "x64", baseline: true, distro: "ubuntu", release: "22.04" },
|
||||
{ os: "linux", arch: "x64", baseline: true, distro: "ubuntu", release: "20.04" },
|
||||
// { os: "linux", arch: "aarch64", distro: "amazonlinux", release: "2023" },
|
||||
// { os: "linux", arch: "aarch64", distro: "amazonlinux", release: "2" },
|
||||
// { os: "linux", arch: "x64", distro: "amazonlinux", release: "2023" },
|
||||
// { os: "linux", arch: "x64", distro: "amazonlinux", release: "2" },
|
||||
// { os: "linux", arch: "x64", baseline: true, distro: "amazonlinux", release: "2023" },
|
||||
// { os: "linux", arch: "x64", baseline: true, distro: "amazonlinux", release: "2" },
|
||||
{ os: "linux", arch: "aarch64", abi: "musl", distro: "alpine", release: "3.20" },
|
||||
// { os: "linux", arch: "aarch64", abi: "musl", distro: "alpine", release: "3.17" },
|
||||
{ os: "linux", arch: "x64", abi: "musl", distro: "alpine", release: "3.20" },
|
||||
// { os: "linux", arch: "x64", abi: "musl", distro: "alpine", release: "3.17" },
|
||||
{ os: "linux", arch: "x64", abi: "musl", baseline: true, distro: "alpine", release: "3.20" },
|
||||
// { os: "linux", arch: "x64", abi: "musl", baseline: true, distro: "alpine", release: "3.17" },
|
||||
{ os: "windows", arch: "x64", release: "2019" },
|
||||
{ os: "windows", arch: "x64", baseline: true, release: "2019" },
|
||||
];
|
||||
|
||||
const imagePlatforms = new Map(
|
||||
[...buildPlatforms, ...testPlatforms]
|
||||
.filter(platform => buildImages && isUsingNewAgent(platform))
|
||||
.map(platform => [getImageKey(platform), platform]),
|
||||
);
|
||||
|
||||
/**
|
||||
* @type {Step[]}
|
||||
*/
|
||||
const steps = [];
|
||||
|
||||
if (imagePlatforms.size) {
|
||||
steps.push({
|
||||
group: ":docker:",
|
||||
steps: [...imagePlatforms.values()].map(platform => getBuildImageStep(platform)),
|
||||
});
|
||||
}
|
||||
|
||||
for (const platform of buildPlatforms) {
|
||||
const { os, arch, abi, baseline } = platform;
|
||||
|
||||
/** @type {Step[]} */
|
||||
const platformSteps = [];
|
||||
|
||||
if (buildImages || !buildId) {
|
||||
platformSteps.push(
|
||||
getBuildVendorStep(platform),
|
||||
getBuildCppStep(platform),
|
||||
getBuildZigStep(platform),
|
||||
getBuildBunStep(platform),
|
||||
);
|
||||
}
|
||||
|
||||
if (!skipTests) {
|
||||
platformSteps.push(
|
||||
...testPlatforms
|
||||
.filter(
|
||||
testPlatform =>
|
||||
testPlatform.os === os &&
|
||||
testPlatform.arch === arch &&
|
||||
testPlatform.abi === abi &&
|
||||
testPlatform.baseline === baseline,
|
||||
)
|
||||
.map(testPlatform => getTestBunStep(testPlatform)),
|
||||
);
|
||||
}
|
||||
|
||||
if (!platformSteps.length) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (imagePlatforms.has(getImageKey(platform))) {
|
||||
for (const step of platformSteps) {
|
||||
if (step.agents?.["image-name"]) {
|
||||
step.depends_on ??= [];
|
||||
step.depends_on.push(`${getImageKey(platform)}-build-image`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
steps.push({
|
||||
key: getTargetKey(platform),
|
||||
group: getTargetLabel(platform),
|
||||
steps: platformSteps,
|
||||
});
|
||||
}
|
||||
|
||||
if (isMainBranch() && !isFork()) {
|
||||
steps.push({
|
||||
label: ":github:",
|
||||
agents: {
|
||||
queue: "test-darwin",
|
||||
},
|
||||
depends_on: buildPlatforms.map(platform => `${getTargetKey(platform)}-build-bun`),
|
||||
command: ".buildkite/scripts/upload-release.sh",
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
priority: getPriority(),
|
||||
steps,
|
||||
};
|
||||
}
|
||||
|
||||
async function main() {
|
||||
printEnvironment();
|
||||
|
||||
console.log("Checking last successful build...");
|
||||
const lastBuild = await getLastSuccessfulBuild();
|
||||
if (lastBuild) {
|
||||
const { id, path, commit_id: commit } = lastBuild;
|
||||
console.log(" - Build ID:", id);
|
||||
console.log(" - Build URL:", new URL(path, "https://buildkite.com/").toString());
|
||||
console.log(" - Commit:", commit);
|
||||
} else {
|
||||
console.log(" - No build found");
|
||||
}
|
||||
|
||||
let changedFiles;
|
||||
if (!isFork()) {
|
||||
console.log("Checking changed files...");
|
||||
const baseRef = getCommit();
|
||||
console.log(" - Base Ref:", baseRef);
|
||||
const headRef = lastBuild?.commit_id || getTargetBranch() || getMainBranch();
|
||||
console.log(" - Head Ref:", headRef);
|
||||
|
||||
changedFiles = await getChangedFiles(undefined, baseRef, headRef);
|
||||
if (changedFiles) {
|
||||
if (changedFiles.length) {
|
||||
changedFiles.forEach(filename => console.log(` - ${filename}`));
|
||||
} else {
|
||||
console.log(" - No changed files");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const isDocumentationFile = filename => /^(\.vscode|\.github|bench|docs|examples)|\.(md)$/i.test(filename);
|
||||
const isTestFile = filename => /^test/i.test(filename) || /runner\.node\.mjs$/i.test(filename);
|
||||
|
||||
console.log("Checking if CI should be forced...");
|
||||
let forceBuild;
|
||||
{
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(force ci|ci force|ci force build)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
forceBuild = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if CI should be skipped...");
|
||||
if (!forceBuild) {
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(skip ci|no ci|ci skip|ci no)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
return;
|
||||
}
|
||||
if (changedFiles && changedFiles.every(filename => isDocumentationFile(filename))) {
|
||||
console.log(" - Yes, because all changed files are documentation");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if CI should re-build images...");
|
||||
let buildImages;
|
||||
{
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(build images?|images? build)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
buildImages = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if CI should publish images...");
|
||||
let publishImages;
|
||||
{
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(publish images?|images? publish)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
publishImages = true;
|
||||
buildImages = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if build should be skipped...");
|
||||
let skipBuild;
|
||||
if (!forceBuild) {
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(only tests?|tests? only|skip build|no build|build skip|build no)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
skipBuild = true;
|
||||
}
|
||||
if (changedFiles && changedFiles.every(filename => isTestFile(filename) || isDocumentationFile(filename))) {
|
||||
console.log(" - Yes, because all changed files are tests or documentation");
|
||||
skipBuild = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if tests should be skipped...");
|
||||
let skipTests;
|
||||
{
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(skip tests?|tests? skip|no tests?|tests? no)\]/i.exec(message);
|
||||
if (match) {
|
||||
console.log(" - Yes, because commit message contains:", match[1]);
|
||||
skipTests = true;
|
||||
}
|
||||
if (isMainBranch()) {
|
||||
console.log(" - Yes, because we're on main branch");
|
||||
skipTests = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Checking if build is a named release...");
|
||||
let buildRelease;
|
||||
{
|
||||
const message = getCommitMessage();
|
||||
const match = /\[(release|release build|build release)\]/i.exec(message);
|
||||
if (match) {
|
||||
const [, reason] = match;
|
||||
console.log(" - Yes, because commit message contains:", reason);
|
||||
buildRelease = true;
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Generating pipeline...");
|
||||
const pipeline = getPipeline({
|
||||
buildId: lastBuild && skipBuild && !forceBuild ? lastBuild.id : undefined,
|
||||
buildImages,
|
||||
publishImages,
|
||||
skipTests,
|
||||
});
|
||||
|
||||
const content = toYaml(pipeline);
|
||||
const contentPath = join(process.cwd(), ".buildkite", "ci.yml");
|
||||
writeFileSync(contentPath, content);
|
||||
|
||||
console.log("Generated pipeline:");
|
||||
console.log(" - Path:", contentPath);
|
||||
console.log(" - Size:", (content.length / 1024).toFixed(), "KB");
|
||||
if (isBuildkite) {
|
||||
await uploadArtifact(contentPath);
|
||||
}
|
||||
|
||||
if (isBuildkite) {
|
||||
console.log("Setting canary revision...");
|
||||
const canaryRevision = buildRelease ? 0 : await getCanaryRevision();
|
||||
await spawnSafe(["buildkite-agent", "meta-data", "set", "canary", `${canaryRevision}`], { stdio: "inherit" });
|
||||
|
||||
console.log("Uploading pipeline...");
|
||||
await spawnSafe(["buildkite-agent", "pipeline", "upload", contentPath], { stdio: "inherit" });
|
||||
}
|
||||
}
|
||||
|
||||
await main();
|
||||
@@ -1,790 +0,0 @@
|
||||
# Build and test Bun on macOS, Linux, and Windows.
|
||||
# https://buildkite.com/docs/pipelines/defining-steps
|
||||
#
|
||||
# If a step has the `robobun: true` label, robobun will listen
|
||||
# to webhooks from Buildkite and provision a VM to run the step.
|
||||
#
|
||||
# Changes to this file will be automatically uploaded on the next run
|
||||
# for a particular commit.
|
||||
|
||||
steps:
|
||||
# macOS aarch64
|
||||
- key: "darwin-aarch64"
|
||||
group: ":darwin: aarch64"
|
||||
steps:
|
||||
- key: "darwin-aarch64-build-deps"
|
||||
label: "build-deps"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "aarch64"
|
||||
command:
|
||||
- "bun run build:ci --target dependencies"
|
||||
|
||||
- key: "darwin-aarch64-build-cpp"
|
||||
label: "build-cpp"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "aarch64"
|
||||
env:
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "darwin-aarch64-build-zig"
|
||||
label: "build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain darwin-aarch64"
|
||||
|
||||
- key: "darwin-aarch64-build-bun"
|
||||
label: "build-bun"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "aarch64"
|
||||
depends_on:
|
||||
- "darwin-aarch64-build-deps"
|
||||
- "darwin-aarch64-build-cpp"
|
||||
- "darwin-aarch64-build-zig"
|
||||
env:
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "darwin-aarch64-test-macos-14"
|
||||
label: ":darwin: 14 aarch64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 3
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "darwin-aarch64-build-bun"
|
||||
agents:
|
||||
queue: "test-darwin"
|
||||
os: "darwin"
|
||||
arch: "aarch64"
|
||||
release: "14"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step darwin-aarch64-build-bun"
|
||||
|
||||
- key: "darwin-aarch64-test-macos-13"
|
||||
label: ":darwin: 13 aarch64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 3
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "darwin-aarch64-build-bun"
|
||||
agents:
|
||||
queue: "test-darwin"
|
||||
os: "darwin"
|
||||
arch: "aarch64"
|
||||
release: "13"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step darwin-aarch64-build-bun"
|
||||
|
||||
# macOS x64
|
||||
- key: "darwin-x64"
|
||||
group: ":darwin: x64"
|
||||
steps:
|
||||
- key: "darwin-x64-build-deps"
|
||||
label: "build-deps"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "x64"
|
||||
command:
|
||||
- "bun run build:ci --target dependencies"
|
||||
|
||||
- key: "darwin-x64-build-cpp"
|
||||
label: "build-cpp"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "x64"
|
||||
env:
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "darwin-x64-build-zig"
|
||||
label: "build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain darwin-x64"
|
||||
|
||||
- key: "darwin-x64-build-bun"
|
||||
label: "build-bun"
|
||||
agents:
|
||||
queue: "build-darwin"
|
||||
os: "darwin"
|
||||
arch: "x64"
|
||||
depends_on:
|
||||
- "darwin-x64-build-deps"
|
||||
- "darwin-x64-build-cpp"
|
||||
- "darwin-x64-build-zig"
|
||||
env:
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "darwin-x64-test-macos-14"
|
||||
label: ":darwin: 14 x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 3
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "darwin-x64-build-bun"
|
||||
agents:
|
||||
queue: "test-darwin"
|
||||
os: "darwin"
|
||||
arch: "x64"
|
||||
release: "14"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step darwin-x64-build-bun"
|
||||
|
||||
- key: "darwin-x64-test-macos-13"
|
||||
label: ":darwin: 13 x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 3
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "darwin-x64-build-bun"
|
||||
agents:
|
||||
queue: "test-darwin"
|
||||
os: "darwin"
|
||||
arch: "x64"
|
||||
release: "13"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step darwin-x64-build-bun"
|
||||
|
||||
# Linux x64
|
||||
- key: "linux-x64"
|
||||
group: ":linux: x64"
|
||||
steps:
|
||||
- key: "linux-x64-build-deps"
|
||||
label: "build-deps"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
command:
|
||||
- "bun run build:ci --target dependencies"
|
||||
|
||||
- key: "linux-x64-build-cpp"
|
||||
label: "build-cpp"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
env:
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-x64-build-zig"
|
||||
label: "build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain linux-x64"
|
||||
|
||||
- key: "linux-x64-build-bun"
|
||||
label: "build-bun"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
depends_on:
|
||||
- "linux-x64-build-deps"
|
||||
- "linux-x64-build-cpp"
|
||||
- "linux-x64-build-zig"
|
||||
env:
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-x64-test-debian-12"
|
||||
label: ":debian: 12 x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "debian"
|
||||
release: "12"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-build-bun"
|
||||
|
||||
- key: "linux-x64-test-ubuntu-2204"
|
||||
label: ":ubuntu: 22.04 x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "ubuntu"
|
||||
release: "22.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-build-bun"
|
||||
|
||||
- key: "linux-x64-test-ubuntu-2004"
|
||||
label: ":ubuntu: 20.04 x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "ubuntu"
|
||||
release: "20.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-build-bun"
|
||||
|
||||
# Linux x64-baseline
|
||||
- key: "linux-x64-baseline"
|
||||
group: ":linux: x64-baseline"
|
||||
steps:
|
||||
- key: "linux-x64-baseline-build-deps"
|
||||
label: "build-deps"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target dependencies"
|
||||
|
||||
- key: "linux-x64-baseline-build-cpp"
|
||||
label: "build-cpp"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-x64-baseline-build-zig"
|
||||
label: "build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain linux-x64-baseline"
|
||||
|
||||
- key: "linux-x64-baseline-build-bun"
|
||||
label: "build-bun"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
depends_on:
|
||||
- "linux-x64-baseline-build-deps"
|
||||
- "linux-x64-baseline-build-cpp"
|
||||
- "linux-x64-baseline-build-zig"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-x64-baseline-test-debian-12"
|
||||
label: ":debian: 12 x64-baseline - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-baseline-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "debian"
|
||||
release: "12"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-baseline-build-bun"
|
||||
|
||||
- key: "linux-x64-baseline-test-ubuntu-2204"
|
||||
label: ":ubuntu: 22.04 x64-baseline - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-baseline-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "ubuntu"
|
||||
release: "22.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-baseline-build-bun"
|
||||
|
||||
- key: "linux-x64-baseline-test-ubuntu-2004"
|
||||
label: ":ubuntu: 20.04 x64-baseline - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-x64-baseline-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "x64"
|
||||
distro: "ubuntu"
|
||||
release: "20.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-x64-baseline-build-bun"
|
||||
|
||||
# Linux aarch64
|
||||
- key: "linux-aarch64"
|
||||
group: ":linux: aarch64"
|
||||
steps:
|
||||
- key: "linux-aarch64-build-deps"
|
||||
label: "build-deps"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
command:
|
||||
- "bun run build:ci --target dependencies"
|
||||
|
||||
- key: "linux-aarch64-build-cpp"
|
||||
label: "build-cpp"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
env:
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-aarch64-build-zig"
|
||||
label: "build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain linux-aarch64"
|
||||
|
||||
- key: "linux-aarch64-build-bun"
|
||||
label: "build-bun"
|
||||
agents:
|
||||
queue: "build-linux"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
depends_on:
|
||||
- "linux-aarch64-build-deps"
|
||||
- "linux-aarch64-build-cpp"
|
||||
- "linux-aarch64-build-zig"
|
||||
env:
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "linux-aarch64-test-debian-12"
|
||||
label: ":debian: 12 aarch64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-aarch64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
distro: "debian"
|
||||
release: "12"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-aarch64-build-bun"
|
||||
|
||||
- key: "linux-aarch64-test-ubuntu-2204"
|
||||
label: ":ubuntu: 22.04 aarch64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-aarch64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
distro: "ubuntu"
|
||||
release: "22.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-aarch64-build-bun"
|
||||
|
||||
- key: "linux-aarch64-test-ubuntu-2004"
|
||||
label: ":ubuntu: 20.04 aarch64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 2
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 1
|
||||
limit: 1
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "linux-aarch64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "linux"
|
||||
arch: "aarch64"
|
||||
distro: "ubuntu"
|
||||
release: "20.04"
|
||||
command:
|
||||
- "./scripts/runner.node.mjs --step linux-aarch64-build-bun"
|
||||
|
||||
# Windows x64
|
||||
- key: "windows-x64"
|
||||
group: ":windows: x64"
|
||||
steps:
|
||||
- key: "windows-x64-build-deps"
|
||||
label: "build-deps"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 255
|
||||
limit: 5
|
||||
command:
|
||||
- "bun run build:ci --target dependencies"
|
||||
|
||||
- key: "windows-x64-build-cpp"
|
||||
label: "build-cpp"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 255
|
||||
limit: 5
|
||||
env:
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "windows-x64-build-zig"
|
||||
label: "build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain windows-x64"
|
||||
|
||||
- key: "windows-x64-build-bun"
|
||||
label: "build-bun"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
depends_on:
|
||||
- "windows-x64-build-deps"
|
||||
- "windows-x64-build-cpp"
|
||||
- "windows-x64-build-zig"
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 255
|
||||
limit: 5
|
||||
env:
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "windows-x64-test-bun"
|
||||
label: ":windows: x64 - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 1
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "windows-x64-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
command:
|
||||
- "node .\\scripts\\runner.node.mjs --step windows-x64-build-bun"
|
||||
|
||||
# Windows x64-baseline
|
||||
- key: "windows-x64-baseline"
|
||||
group: ":windows: x64-baseline"
|
||||
steps:
|
||||
- key: "windows-x64-baseline-build-deps"
|
||||
label: "build-deps"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 255
|
||||
limit: 5
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target dependencies"
|
||||
|
||||
- key: "windows-x64-baseline-build-cpp"
|
||||
label: "build-cpp"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 255
|
||||
limit: 5
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
BUN_CPP_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "windows-x64-baseline-build-zig"
|
||||
label: "build-zig"
|
||||
agents:
|
||||
queue: "build-zig"
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun-zig --toolchain windows-x64-baseline"
|
||||
|
||||
- key: "windows-x64-baseline-build-bun"
|
||||
label: "build-bun"
|
||||
agents:
|
||||
queue: "build-windows"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
depends_on:
|
||||
- "windows-x64-baseline-build-deps"
|
||||
- "windows-x64-baseline-build-cpp"
|
||||
- "windows-x64-baseline-build-zig"
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: 255
|
||||
limit: 5
|
||||
env:
|
||||
ENABLE_BASELINE: "ON"
|
||||
BUN_LINK_ONLY: "ON"
|
||||
command:
|
||||
- "bun run build:ci --target bun"
|
||||
|
||||
- key: "windows-x64-baseline-test-bun"
|
||||
label: ":windows: x64-baseline - test-bun"
|
||||
if: "build.branch != 'main'"
|
||||
parallelism: 10
|
||||
soft_fail:
|
||||
- exit_status: 1
|
||||
retry:
|
||||
automatic:
|
||||
- exit_status: -1
|
||||
limit: 3
|
||||
- exit_status: 255
|
||||
limit: 3
|
||||
- signal_reason: agent_stop
|
||||
limit: 3
|
||||
- signal: SIGTERM
|
||||
limit: 3
|
||||
depends_on:
|
||||
- "windows-x64-baseline-build-bun"
|
||||
agents:
|
||||
robobun: "true"
|
||||
os: "windows"
|
||||
arch: "x64"
|
||||
command:
|
||||
- "node .\\scripts\\runner.node.mjs --step windows-x64-baseline-build-bun"
|
||||
@@ -2,96 +2,10 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
function assert_build() {
|
||||
if [ -z "$BUILDKITE_REPO" ]; then
|
||||
echo "error: Cannot find repository for this build"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$BUILDKITE_COMMIT" ]; then
|
||||
echo "error: Cannot find commit for this build"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function assert_buildkite_agent() {
|
||||
if ! command -v buildkite-agent &> /dev/null; then
|
||||
echo "error: Cannot find buildkite-agent, please install it:"
|
||||
echo "https://buildkite.com/docs/agent/v3/install"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function assert_jq() {
|
||||
assert_command "jq" "jq" "https://stedolan.github.io/jq/"
|
||||
}
|
||||
|
||||
function assert_curl() {
|
||||
assert_command "curl" "curl" "https://curl.se/download.html"
|
||||
}
|
||||
|
||||
function assert_command() {
|
||||
local command="$1"
|
||||
local package="$2"
|
||||
local help_url="$3"
|
||||
if ! command -v "$command" &> /dev/null; then
|
||||
echo "warning: $command is not installed, installing..."
|
||||
if command -v brew &> /dev/null; then
|
||||
HOMEBREW_NO_AUTO_UPDATE=1 brew install "$package"
|
||||
else
|
||||
echo "error: Cannot install $command, please install it"
|
||||
if [ -n "$help_url" ]; then
|
||||
echo ""
|
||||
echo "hint: See $help_url for help"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function assert_release() {
|
||||
if [ "$RELEASE" == "1" ]; then
|
||||
run_command buildkite-agent meta-data set canary "0"
|
||||
fi
|
||||
}
|
||||
|
||||
function assert_canary() {
|
||||
local canary="$(buildkite-agent meta-data get canary 2>/dev/null)"
|
||||
if [ -z "$canary" ]; then
|
||||
local repo=$(echo "$BUILDKITE_REPO" | sed -E 's#https://github.com/([^/]+)/([^/]+).git#\1/\2#g')
|
||||
local tag="$(curl -sL "https://api.github.com/repos/$repo/releases/latest" | jq -r ".tag_name")"
|
||||
if [ "$tag" == "null" ]; then
|
||||
canary="1"
|
||||
else
|
||||
local revision=$(curl -sL "https://api.github.com/repos/$repo/compare/$tag...$BUILDKITE_COMMIT" | jq -r ".ahead_by")
|
||||
if [ "$revision" == "null" ]; then
|
||||
canary="1"
|
||||
else
|
||||
canary="$revision"
|
||||
fi
|
||||
fi
|
||||
run_command buildkite-agent meta-data set canary "$canary"
|
||||
fi
|
||||
}
|
||||
|
||||
function upload_buildkite_pipeline() {
|
||||
local path="$1"
|
||||
if [ ! -f "$path" ]; then
|
||||
echo "error: Cannot find pipeline: $path"
|
||||
exit 1
|
||||
fi
|
||||
run_command buildkite-agent pipeline upload "$path"
|
||||
}
|
||||
|
||||
function run_command() {
|
||||
set -x
|
||||
"$@"
|
||||
{ set +x; } 2>/dev/null
|
||||
}
|
||||
|
||||
assert_build
|
||||
assert_buildkite_agent
|
||||
assert_jq
|
||||
assert_curl
|
||||
assert_release
|
||||
assert_canary
|
||||
upload_buildkite_pipeline ".buildkite/ci.yml"
|
||||
run_command node ".buildkite/ci.mjs"
|
||||
|
||||
@@ -162,6 +162,27 @@ function upload_s3_file() {
|
||||
run_command aws --endpoint-url="$AWS_ENDPOINT" s3 cp "$file" "s3://$AWS_BUCKET/$folder/$file"
|
||||
}
|
||||
|
||||
function send_bench_webhook() {
|
||||
if [ -z "$BENCHMARK_URL" ]; then
|
||||
echo "error: \$BENCHMARK_URL is not set"
|
||||
# exit 1 # TODO: this isn't live yet
|
||||
return
|
||||
fi
|
||||
|
||||
local tag="$1"
|
||||
local commit="$BUILDKITE_COMMIT"
|
||||
local artifact_path="${commit}"
|
||||
|
||||
if [ "$tag" == "canary" ]; then
|
||||
artifact_path="${commit}-canary"
|
||||
fi
|
||||
|
||||
local artifact_url="https://pub-5e11e972747a44bf9aaf9394f185a982.r2.dev/releases/$artifact_path/bun-linux-x64.zip"
|
||||
local webhook_url="$BENCHMARK_URL?tag=$tag&commit=$commit&artifact_url=$artifact_url"
|
||||
|
||||
curl -X POST "$webhook_url"
|
||||
}
|
||||
|
||||
function create_release() {
|
||||
assert_main
|
||||
assert_buildkite_agent
|
||||
@@ -181,6 +202,12 @@ function create_release() {
|
||||
bun-linux-x64-profile.zip
|
||||
bun-linux-x64-baseline.zip
|
||||
bun-linux-x64-baseline-profile.zip
|
||||
bun-linux-aarch64-musl.zip
|
||||
bun-linux-aarch64-musl-profile.zip
|
||||
bun-linux-x64-musl.zip
|
||||
bun-linux-x64-musl-profile.zip
|
||||
bun-linux-x64-musl-baseline.zip
|
||||
bun-linux-x64-musl-baseline-profile.zip
|
||||
bun-windows-x64.zip
|
||||
bun-windows-x64-profile.zip
|
||||
bun-windows-x64-baseline.zip
|
||||
@@ -206,6 +233,7 @@ function create_release() {
|
||||
|
||||
update_github_release "$tag"
|
||||
create_sentry_release "$tag"
|
||||
send_bench_webhook "$tag"
|
||||
}
|
||||
|
||||
function assert_canary() {
|
||||
|
||||
@@ -11,5 +11,8 @@ packages/**/bun-profile
|
||||
src/bun.js/WebKit
|
||||
src/bun.js/WebKit/LayoutTests
|
||||
zig-build
|
||||
zig-cache
|
||||
zig-out
|
||||
.zig-cache
|
||||
zig-out
|
||||
build
|
||||
vendor
|
||||
node_modules
|
||||
|
||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -49,3 +49,5 @@ vendor/brotli/** linguist-vendored
|
||||
|
||||
test/js/node/test/fixtures linguist-vendored
|
||||
test/js/node/test/common linguist-vendored
|
||||
|
||||
test/js/bun/css/files linguist-vendored
|
||||
|
||||
1
.github/workflows/clang-format.yml
vendored
1
.github/workflows/clang-format.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.1.27"
|
||||
|
||||
1
.github/workflows/clang-tidy.yml
vendored
1
.github/workflows/clang-tidy.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.1.27"
|
||||
|
||||
56
.github/workflows/labeled.yml
vendored
56
.github/workflows/labeled.yml
vendored
@@ -83,6 +83,26 @@ jobs:
|
||||
echo "latest=$(cat LATEST)" >> $GITHUB_OUTPUT
|
||||
|
||||
rm -rf is-outdated.txt outdated.txt latest.txt
|
||||
- name: Generate comment text with Sentry Link
|
||||
if: github.event.label.name == 'crash'
|
||||
# ignore if fail
|
||||
continue-on-error: true
|
||||
id: generate-comment-text
|
||||
env:
|
||||
GITHUB_ISSUE_BODY: ${{ github.event.issue.body }}
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_EVENTS_SECRET }}
|
||||
shell: bash
|
||||
run: |
|
||||
bun scripts/associate-issue-with-sentry.ts
|
||||
|
||||
if [[ -f "sentry-link.txt" ]]; then
|
||||
echo "sentry-link=$(cat sentry-link.txt)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
if [[ -f "sentry-id.txt" ]]; then
|
||||
echo "sentry-id=$(cat sentry-id.txt)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Add labels
|
||||
uses: actions-cool/issues-helper@v3
|
||||
if: github.event.label.name == 'crash'
|
||||
@@ -92,7 +112,7 @@ jobs:
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
labels: ${{ steps.add-labels.outputs.labels }}
|
||||
- name: Comment outdated
|
||||
if: steps.add-labels.outputs.is-outdated == 'true' && github.event.label.name == 'crash'
|
||||
if: steps.add-labels.outputs.is-outdated == 'true' && github.event.label.name == 'crash' && steps.generate-comment-text.outputs.sentry-link == ''
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: "create-comment"
|
||||
@@ -106,6 +126,40 @@ jobs:
|
||||
```sh
|
||||
bun upgrade
|
||||
```
|
||||
- name: Comment with Sentry Link and outdated version
|
||||
if: steps.generate-comment-text.outputs.sentry-link != '' && github.event.label.name == 'crash' && steps.add-labels.outputs.is-outdated == 'true'
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: "create-comment"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
@${{ github.event.issue.user.login }}, thank you for reporting this crash. The latest version of Bun is v${{ steps.add-labels.outputs.latest }}, but this crash was reported on Bun v${{ steps.add-labels.outputs.oudated }}.
|
||||
|
||||
Are you able to reproduce this crash on the latest version of Bun?
|
||||
|
||||
```sh
|
||||
bun upgrade
|
||||
```
|
||||
|
||||
For Bun's internal tracking, this issue is [${{ steps.generate-comment-text.outputs.sentry-id }}](${{ steps.generate-comment-text.outputs.sentry-link }}).
|
||||
|
||||
<!-- sentry-id: ${{ steps.generate-comment-text.outputs.sentry-id }} -->
|
||||
<!-- sentry-link: ${{ steps.generate-comment-text.outputs.sentry-link }} -->
|
||||
- name: Comment with Sentry Link
|
||||
if: steps.generate-comment-text.outputs.sentry-link != '' && github.event.label.name == 'crash' && steps.add-labels.outputs.is-outdated != 'true'
|
||||
uses: actions-cool/issues-helper@v3
|
||||
with:
|
||||
actions: "create-comment"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
Thank you for reporting this crash.
|
||||
|
||||
For Bun's internal tracking, this issue is [${{ steps.generate-comment-text.outputs.sentry-id }}](${{ steps.generate-comment-text.outputs.sentry-link }}).
|
||||
|
||||
<!-- sentry-id: ${{ steps.generate-comment-text.outputs.sentry-id }} -->
|
||||
<!-- sentry-link: ${{ steps.generate-comment-text.outputs.sentry-link }} -->
|
||||
- name: Comment needs repro
|
||||
if: github.event.label.name == 'needs repro'
|
||||
uses: actions-cool/issues-helper@v3
|
||||
|
||||
1
.github/workflows/prettier-format.yml
vendored
1
.github/workflows/prettier-format.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.1.27"
|
||||
|
||||
1
.github/workflows/zig-format.yml
vendored
1
.github/workflows/zig-format.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.1.27"
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -141,6 +141,7 @@ test/node.js/upstream
|
||||
.zig-cache
|
||||
scripts/env.local
|
||||
*.generated.ts
|
||||
src/bake/generated.ts
|
||||
|
||||
# Dependencies
|
||||
/vendor
|
||||
@@ -163,3 +164,7 @@ scripts/env.local
|
||||
/src/deps/zstd
|
||||
/src/deps/zlib
|
||||
/src/deps/zig
|
||||
|
||||
# Generated files
|
||||
|
||||
.buildkite/ci.yml
|
||||
|
||||
128
.vscode/launch.json
generated
vendored
128
.vscode/launch.json
generated
vendored
@@ -14,7 +14,7 @@
|
||||
"name": "bun test [file]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -22,6 +22,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -29,7 +31,7 @@
|
||||
"name": "bun test [file] --only",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "--only", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -37,6 +39,8 @@
|
||||
"BUN_DEBUG_jest": "1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -50,7 +54,7 @@
|
||||
"name": "bun test [file] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -58,6 +62,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -65,7 +71,7 @@
|
||||
"name": "bun test [file] (verbose)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "0",
|
||||
@@ -73,6 +79,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -80,7 +88,7 @@
|
||||
"name": "bun test [file] --watch",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "--watch", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -88,6 +96,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -95,7 +105,7 @@
|
||||
"name": "bun test [file] --hot",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "--hot", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -103,6 +113,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -110,7 +122,7 @@
|
||||
"name": "bun test [file] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -119,6 +131,8 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -131,7 +145,7 @@
|
||||
"name": "bun test [file] --inspect-brk",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -140,6 +154,8 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -160,6 +176,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -178,6 +196,8 @@
|
||||
"GOMAXPROCS": "1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -192,6 +212,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -206,6 +228,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -220,6 +244,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -235,6 +261,8 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -255,6 +283,8 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -268,7 +298,7 @@
|
||||
"name": "bun test [...]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -276,6 +306,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -283,7 +315,7 @@
|
||||
"name": "bun test [...] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -291,6 +323,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -298,7 +332,7 @@
|
||||
"name": "bun test [...] (verbose)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -306,6 +340,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -313,7 +349,7 @@
|
||||
"name": "bun test [...] --watch",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "--watch", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -321,6 +357,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -328,7 +366,7 @@
|
||||
"name": "bun test [...] --hot",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "--hot", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -336,6 +374,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -343,7 +383,7 @@
|
||||
"name": "bun test [...] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -352,6 +392,8 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?wait=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -364,7 +406,7 @@
|
||||
"name": "bun test [...] --inspect-brk",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -373,6 +415,8 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/?break=1",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -393,6 +437,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
// bun test [*]
|
||||
{
|
||||
@@ -401,13 +447,15 @@
|
||||
"name": "bun test [*]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -415,13 +463,15 @@
|
||||
"name": "bun test [*] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "0",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -429,7 +479,7 @@
|
||||
"name": "bun test [*] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"env": {
|
||||
"FORCE_COLOR": "1",
|
||||
"BUN_DEBUG_QUIET_LOGS": "1",
|
||||
@@ -437,6 +487,8 @@
|
||||
"BUN_INSPECT": "ws://localhost:0/",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
"serverReadyAction": {
|
||||
"pattern": "https://debug.bun.sh/#localhost:([0-9]+)/",
|
||||
"uriFormat": "https://debug.bun.sh/#ws://localhost:%s/",
|
||||
@@ -456,6 +508,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
{
|
||||
"type": "lldb",
|
||||
@@ -470,6 +524,8 @@
|
||||
"BUN_GARBAGE_COLLECTOR_LEVEL": "2",
|
||||
},
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
// Windows: bun test [file]
|
||||
{
|
||||
@@ -481,7 +537,7 @@
|
||||
"name": "Windows: bun test [file]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -510,7 +566,7 @@
|
||||
"name": "Windows: bun test --only [file]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "--only", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -539,7 +595,7 @@
|
||||
"name": "Windows: bun test [file] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -568,7 +624,7 @@
|
||||
"name": "Windows: bun test [file] (verbose)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -597,7 +653,7 @@
|
||||
"name": "Windows: bun test [file] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -635,7 +691,7 @@
|
||||
"name": "Windows: bun test [file] --inspect-brk",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${file}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -822,7 +878,7 @@
|
||||
"name": "Windows: bun test [...]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -851,7 +907,7 @@
|
||||
"name": "Windows: bun test [...] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -880,7 +936,7 @@
|
||||
"name": "Windows: bun test [...] (verbose)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -909,7 +965,7 @@
|
||||
"name": "Windows: bun test [...] --watch",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "--watch", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -938,7 +994,7 @@
|
||||
"name": "Windows: bun test [...] --hot",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "--hot", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -967,7 +1023,7 @@
|
||||
"name": "Windows: bun test [...] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1005,7 +1061,7 @@
|
||||
"name": "Windows: bun test [...] --inspect-brk",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test", "${input:testName}"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1070,7 +1126,7 @@
|
||||
"name": "Windows: bun test [*]",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1095,7 +1151,7 @@
|
||||
"name": "Windows: bun test [*] (fast)",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1124,7 +1180,7 @@
|
||||
"name": "Windows: bun test [*] --inspect",
|
||||
"program": "${workspaceFolder}/build/debug/bun-debug.exe",
|
||||
"args": ["test"],
|
||||
"cwd": "${workspaceFolder}/test",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [
|
||||
{
|
||||
"name": "FORCE_COLOR",
|
||||
@@ -1182,6 +1238,8 @@
|
||||
},
|
||||
],
|
||||
"console": "internalConsole",
|
||||
// Don't pause when the GC runs while the debugger is open.
|
||||
"postRunCommands": ["process handle -p true -s false -n false SIGUSR1"],
|
||||
},
|
||||
],
|
||||
"inputs": [
|
||||
@@ -1196,4 +1254,4 @@
|
||||
"description": "Usage: bun test [...]",
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ Bun currently requires `glibc >=2.32` in development which means if you're on Ub
|
||||
|
||||
Using your system's package manager, install Bun's dependencies:
|
||||
|
||||
{% codetabs %}
|
||||
{% codetabs group="os" %}
|
||||
|
||||
```bash#macOS (Homebrew)
|
||||
$ brew install automake ccache cmake coreutils gnu-sed go icu4c libiconv libtool ninja pkg-config rust ruby
|
||||
@@ -30,7 +30,7 @@ $ sudo dnf install cargo ccache cmake git golang libtool ninja-build pkg-config
|
||||
```
|
||||
|
||||
```bash#openSUSE Tumbleweed
|
||||
$ sudo zypper install go cmake ninja automake git rustup && rustup toolchain install stable
|
||||
$ sudo zypper install go cmake ninja automake git icu rustup && rustup toolchain install stable
|
||||
```
|
||||
|
||||
{% /codetabs %}
|
||||
@@ -60,7 +60,7 @@ $ brew install bun
|
||||
|
||||
Bun requires LLVM 16 (`clang` is part of LLVM). This version requirement is to match WebKit (precompiled), as mismatching versions will cause memory allocation failures at runtime. In most cases, you can install LLVM through your system package manager:
|
||||
|
||||
{% codetabs %}
|
||||
{% codetabs group="os" %}
|
||||
|
||||
```bash#macOS (Homebrew)
|
||||
$ brew install llvm@18
|
||||
@@ -77,8 +77,8 @@ $ sudo pacman -S llvm clang lld
|
||||
|
||||
```bash#Fedora
|
||||
$ sudo dnf install 'dnf-command(copr)'
|
||||
$ sudo dnf copr enable -y @fedora-llvm-team/llvm-snapshots
|
||||
$ sudo dnf install llvm clang lld
|
||||
$ sudo dnf copr enable -y @fedora-llvm-team/llvm17
|
||||
$ sudo dnf install llvm16 clang16 lld16-devel
|
||||
```
|
||||
|
||||
```bash#openSUSE Tumbleweed
|
||||
@@ -97,7 +97,7 @@ $ which clang-16
|
||||
|
||||
If not, run this to manually add it:
|
||||
|
||||
{% codetabs %}
|
||||
{% codetabs group="os" %}
|
||||
|
||||
```bash#macOS (Homebrew)
|
||||
# use fish_add_path if you're using fish
|
||||
@@ -285,17 +285,17 @@ If you see this error when compiling, run:
|
||||
$ xcode-select --install
|
||||
```
|
||||
|
||||
## Cannot find `libatomic.a`
|
||||
### Cannot find `libatomic.a`
|
||||
|
||||
Bun defaults to linking `libatomic` statically, as not all systems have it. If you are building on a distro that does not have a static libatomic available, you can run the following command to enable dynamic linking:
|
||||
|
||||
```bash
|
||||
$ bun setup -DUSE_STATIC_LIBATOMIC=OFF
|
||||
$ bun run build -DUSE_STATIC_LIBATOMIC=OFF
|
||||
```
|
||||
|
||||
The built version of Bun may not work on other systems if compiled this way.
|
||||
|
||||
## ccache conflicts with building TinyCC on macOS
|
||||
### ccache conflicts with building TinyCC on macOS
|
||||
|
||||
If you run into issues with `ccache` when building TinyCC, try reinstalling ccache
|
||||
|
||||
@@ -303,3 +303,9 @@ If you run into issues with `ccache` when building TinyCC, try reinstalling ccac
|
||||
brew uninstall ccache
|
||||
brew install ccache
|
||||
```
|
||||
|
||||
## Using bun-debug
|
||||
|
||||
- Disable logging: `BUN_DEBUG_QUIET_LOGS=1 bun-debug ...` (to disable all debug logging)
|
||||
- Enable logging for a specific zig scope: `BUN_DEBUG_EventLoop=1 bun-debug ...` (to allow `std.log.scoped(.EventLoop)`)
|
||||
- Bun transpiles every file it runs, to see the actual executed source in a debug build find it in `/tmp/bun-debug-src/...path/to/file`, for example the transpiled version of `/home/bun/index.ts` would be in `/tmp/bun-debug-src/home/bun/index.ts`
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<a href="https://bun.sh"><img src="https://user-images.githubusercontent.com/709451/182802334-d9c42afe-f35d-4a7b-86ea-9985f73f20c3.png" alt="Logo" height=170></a>
|
||||
<a href="https://bun.sh"><img src="https://github.com/user-attachments/assets/50282090-adfd-4ddb-9e27-c30753c6b161" alt="Logo" height=170></a>
|
||||
</p>
|
||||
<h1 align="center">Bun</h1>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("sync", () => {});
|
||||
bench("async", async () => {});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("sync", () => {});
|
||||
bench("async", async () => {});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("sync", () => {});
|
||||
bench("async", async () => {});
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"scripts": {
|
||||
"deps": "exit 0",
|
||||
"build": "exit 0",
|
||||
"bench:bun": "$BUN bun.js",
|
||||
"bench:node": "$NODE node.mjs",
|
||||
"bench:deno": "$DENO run -A --unstable deno.js",
|
||||
"bench:bun": "bun bun.js",
|
||||
"bench:node": "node node.mjs",
|
||||
"bench:deno": "deno run -A --unstable deno.js",
|
||||
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
|
||||
}
|
||||
}
|
||||
|
||||
BIN
bench/bun.lockb
BIN
bench/bun.lockb
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { copyFileSync, statSync, writeFileSync } from "node:fs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
function runner(ready) {
|
||||
for (let size of [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000]) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
const crypto = require("node:crypto");
|
||||
|
||||
const keyPair = crypto.generateKeyPairSync("rsa", {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
const crypto = require("node:crypto");
|
||||
|
||||
const keyPair = crypto.generateKeyPairSync("rsa", {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect } from "bun:test";
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const MAP_SIZE = 10_000;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { expect } from "bun:test";
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const SET_SIZE = 10_000;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { group } from "mitata";
|
||||
import EventEmitterNative from "node:events";
|
||||
import { group } from "../runner.mjs";
|
||||
|
||||
export const implementations = [
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { groupForEmitter } from "./implementations.mjs";
|
||||
|
||||
var id = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { groupForEmitter } from "./implementations.mjs";
|
||||
|
||||
var id = 0;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
import { groupForEmitter } from "./implementations.mjs";
|
||||
|
||||
// Pseudo RNG is derived from https://stackoverflow.com/a/424445
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const count = 100;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const count = 100;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { CString, dlopen, ptr } from "bun:ffi";
|
||||
import { bench, group, run } from "mitata";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
const { napiNoop, napiHash, napiString } = require(import.meta.dir + "/src/ffi_napi_bench.node");
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, group, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
const extension = "darwin" !== Deno.build.os ? "so" : "dylib";
|
||||
const path = new URL("src/target/release/libffi_napi_bench." + extension, import.meta.url).pathname;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { bench, group, run } from "mitata";
|
||||
import { createRequire } from "node:module";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const { napiNoop, napiHash, napiString } = require("./src/ffi_napi_bench.node");
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"name": "bench",
|
||||
"scripts": {
|
||||
"bench:bun": "$BUN bun.js",
|
||||
"bench:node": "$NODE node.mjs",
|
||||
"bench:bun": "bun bun.js",
|
||||
"bench:node": "node node.mjs",
|
||||
"deps": "cd src && bun run deps",
|
||||
"build": "cd src && bun run build",
|
||||
"bench:deno": "$DENO run -A --unstable deno.js",
|
||||
"bench:deno": "deno run -A --unstable deno.js",
|
||||
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import braces from "braces";
|
||||
import { bench, group, run } from "mitata";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
// const iterations = 1000;
|
||||
const iterations = 100;
|
||||
@@ -10,15 +10,16 @@ const veryComplexPattern = "{a,b,HI{c,e,LMAO{d,f}Q}}{1,2,{3,4},5}";
|
||||
|
||||
console.log(braces(complexPattern, { expand: true }));
|
||||
function benchPattern(pattern, name) {
|
||||
group({ name: `${name} pattern: "${pattern}"`, summary: true }, () => {
|
||||
const _name = `${name} pattern: "${pattern}"`;
|
||||
group({ name: _name, summary: true }, () => {
|
||||
if (typeof Bun !== "undefined")
|
||||
bench("Bun", () => {
|
||||
bench(`Bun (${_name})`, () => {
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
Bun.$.braces(pattern);
|
||||
}
|
||||
});
|
||||
|
||||
bench("micromatch/braces", () => {
|
||||
bench(`micromatch/braces ${_name}`, () => {
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
braces(pattern, { expand: true });
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import micromatch from "micromatch";
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const Glob = typeof Bun !== "undefined" ? Bun.Glob : undefined;
|
||||
const doMatch = typeof Bun === "undefined" ? micromatch.isMatch : (a, b) => new Glob(b).match(a);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import fg from "fast-glob";
|
||||
import { fdir } from "fdir";
|
||||
import { bench, group, run } from "mitata";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
const normalPattern = "*.ts";
|
||||
const recursivePattern = "**/*.ts";
|
||||
|
||||
14
bench/grpc-server/benchmark.proto
Normal file
14
bench/grpc-server/benchmark.proto
Normal file
@@ -0,0 +1,14 @@
|
||||
syntax = "proto3";
|
||||
package benchmark;
|
||||
|
||||
service BenchmarkService {
|
||||
rpc Ping(Request) returns (Response);
|
||||
}
|
||||
|
||||
message Request {
|
||||
string message = 1;
|
||||
}
|
||||
|
||||
message Response {
|
||||
string message = 1;
|
||||
}
|
||||
33
bench/grpc-server/cert.pem
Normal file
33
bench/grpc-server/cert.pem
Normal file
@@ -0,0 +1,33 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIFxjCCA66gAwIBAgIUUaQCzOcxcFBP0KwoQfNqD/FoI44wDQYJKoZIhvcNAQEL
|
||||
BQAwYjELMAkGA1UEBhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1TYW4gRnJh
|
||||
bmNpc2NvMQwwCgYDVQQKDANCdW4xDDAKBgNVBAsMA0J1bjESMBAGA1UEAwwJbG9j
|
||||
YWxob3N0MB4XDTI0MTAxNjAwMDExNloXDTM0MTAxNDAwMDExNlowYjELMAkGA1UE
|
||||
BhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1TYW4gRnJhbmNpc2NvMQwwCgYD
|
||||
VQQKDANCdW4xDDAKBgNVBAsMA0J1bjESMBAGA1UEAwwJbG9jYWxob3N0MIICIjAN
|
||||
BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp2s1CWRRV3bkjUxyBefcRCiZj8v6
|
||||
LIIWOb/kFJOo1PQsmQtOOWfY/kNEATPhLtEVolMzsQtaKV+u/Jnp6vU6cCU0qfQ/
|
||||
cha/s0XaSn9zkJSXjmNOPDOXoeJ5wmSUvWETRvDgeYXCg84zTwRnD1pXIsKxHtia
|
||||
SYkTC29skSn0+63GW2Ebzkbn3jcYbk3gfkRO/qw8EDh/4/TcS2SjoHl96E1QcfBX
|
||||
InXrPGoHQhuqJV60rmmkVws0lTIZIq0g2p7iFDCg5TG1asakX7+CrEM/q+oyo3e8
|
||||
RwMfc+9pqFEqyvXGIQSulS+CVKKbpAFMg07UGYe1t0s5iCwfLQ9apaKL31t/3Vkr
|
||||
uVKgy5FrPLnRXkFXDZ1v+43AZBmdLrKODzsqHEbt2JmV0V6JVUkE4kbeJr/nlkhQ
|
||||
x6yXloYY3VKbnCb1L3HmMInrK1QSpxlOb8RllTd33oBwd1FKEvH2gza0j9hqq8uQ
|
||||
hWVN7tlamkgtBteZ8Y9fd3MdxD9iZOx4dVtCX1+sgJFdaL2ZgE0asojn46yT8Uqw
|
||||
5d0M9vqmWc5AqG7c4UWWRrfB1MfOq/X8GtImmKyhEgizIPdWFeF1cNjhPffJv4yR
|
||||
Y4Rj33OBTCM+9h8ZSw/fKo55yRXyz3bjrW2Mg8Dtq+6TcRd5gSLCaTN6jX8E9y7G
|
||||
TobnA9MnKHhSIhsCAwEAAaN0MHIwHQYDVR0OBBYEFEJU6/9ELCp1CAxYJ5FJJxpV
|
||||
FSRmMB8GA1UdIwQYMBaAFEJU6/9ELCp1CAxYJ5FJJxpVFSRmMA8GA1UdEwEB/wQF
|
||||
MAMBAf8wHwYDVR0RBBgwFoIJbG9jYWxob3N0ggkxMjcuMC4wLjEwDQYJKoZIhvcN
|
||||
AQELBQADggIBACyOPdVwfJg1aUNANy78+cm6eoInM9NDdXGWHMqCJwYF6qJTQV11
|
||||
jYwYrl+OWOi3CEC+ogXl+uJX4tSS5d+rBTXEb73cLpogxP+xuxr4cBHhtgpGRpY0
|
||||
GqWCFUTexHxXMrYhHQxf3uv79PNauw/dd1Baby1OjF3zSKRzFsv4KId97cAgT/9H
|
||||
HfUo2ym5jmhNFj5rhUavO3Pw1++1eeDeDAkS6T59buzx0h9760WD20oBdgjt42cb
|
||||
P6xg9OwV7ALQSwJ8YPEXpkl7u+6jy0j5ceYmXh76tAyA+hDYOJrY0opBjSPmXH99
|
||||
p3W63gvk/AdfeAdbFHp6en0b04x4EIogOGZxBP35rzBvsQpqavBE3PBpUIyrQs5p
|
||||
OBUncRrcjEDL6WKh6RJIjZnvpHPrEqOqyxaeWRc4+85ZrVArJHGMc8I+zs9uCFjo
|
||||
Cjfde3d317kCszUTxo0l3azyBpr007PMIUoBF2VJEAyQp2Tz/yu0CbEscNJO/wCn
|
||||
Sb1A6ojaQcgQe2hsaJz/mS+OOjHHaDbCp9iltP2CS63PYleEx4q1Bn8KVRy2zYTB
|
||||
n74y4YaD8Q+hSA6zU741pzqK2SFCpBQnSz757ocr6WspQ47iOonX2giGZS/3KVeK
|
||||
qNzU14+h0b8HaBqZmOvjF+S4G0HDpRwxPzDWgc7dEIWlzHH+ZCqjBFwL
|
||||
-----END CERTIFICATE-----
|
||||
31
bench/grpc-server/index.js
Normal file
31
bench/grpc-server/index.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const grpc = require("@grpc/grpc-js");
|
||||
const protoLoader = require("@grpc/proto-loader");
|
||||
const packageDefinition = protoLoader.loadSync("benchmark.proto", {});
|
||||
const proto = grpc.loadPackageDefinition(packageDefinition).benchmark;
|
||||
const fs = require("fs");
|
||||
|
||||
function ping(call, callback) {
|
||||
callback(null, { message: "Hello, World" });
|
||||
}
|
||||
|
||||
function main() {
|
||||
const server = new grpc.Server();
|
||||
server.addService(proto.BenchmarkService.service, { ping: ping });
|
||||
const tls = !!process.env.TLS && (process.env.TLS === "1" || process.env.TLS === "true");
|
||||
const port = process.env.PORT || 50051;
|
||||
const host = process.env.HOST || "localhost";
|
||||
let credentials;
|
||||
if (tls) {
|
||||
const ca = fs.readFileSync("./cert.pem");
|
||||
const key = fs.readFileSync("./key.pem");
|
||||
const cert = fs.readFileSync("./cert.pem");
|
||||
credentials = grpc.ServerCredentials.createSsl(ca, [{ private_key: key, cert_chain: cert }]);
|
||||
} else {
|
||||
credentials = grpc.ServerCredentials.createInsecure();
|
||||
}
|
||||
server.bindAsync(`${host}:${port}`, credentials, () => {
|
||||
console.log(`Server running at ${tls ? "https" : "http"}://${host}:${port}`);
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
52
bench/grpc-server/key.pem
Normal file
52
bench/grpc-server/key.pem
Normal file
@@ -0,0 +1,52 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCnazUJZFFXduSN
|
||||
THIF59xEKJmPy/osghY5v+QUk6jU9CyZC045Z9j+Q0QBM+Eu0RWiUzOxC1opX678
|
||||
menq9TpwJTSp9D9yFr+zRdpKf3OQlJeOY048M5eh4nnCZJS9YRNG8OB5hcKDzjNP
|
||||
BGcPWlciwrEe2JpJiRMLb2yRKfT7rcZbYRvORufeNxhuTeB+RE7+rDwQOH/j9NxL
|
||||
ZKOgeX3oTVBx8Fcides8agdCG6olXrSuaaRXCzSVMhkirSDanuIUMKDlMbVqxqRf
|
||||
v4KsQz+r6jKjd7xHAx9z72moUSrK9cYhBK6VL4JUopukAUyDTtQZh7W3SzmILB8t
|
||||
D1qloovfW3/dWSu5UqDLkWs8udFeQVcNnW/7jcBkGZ0uso4POyocRu3YmZXRXolV
|
||||
SQTiRt4mv+eWSFDHrJeWhhjdUpucJvUvceYwiesrVBKnGU5vxGWVN3fegHB3UUoS
|
||||
8faDNrSP2Gqry5CFZU3u2VqaSC0G15nxj193cx3EP2Jk7Hh1W0JfX6yAkV1ovZmA
|
||||
TRqyiOfjrJPxSrDl3Qz2+qZZzkCobtzhRZZGt8HUx86r9fwa0iaYrKESCLMg91YV
|
||||
4XVw2OE998m/jJFjhGPfc4FMIz72HxlLD98qjnnJFfLPduOtbYyDwO2r7pNxF3mB
|
||||
IsJpM3qNfwT3LsZOhucD0ycoeFIiGwIDAQABAoICAE+YYrDCZwHEXsjmzVcNcuVc
|
||||
wBVjjt9WQabXGmLGCQClzgY9H8WfH8VSyaQgvDB762MvV2YW1ZjSCunBazrvuAbV
|
||||
SYJ7wyZEtoNO9IdyrMjSPHPPtsRcavzmJalMFIMtAfM6Vh6wf1gW0sIAf9cGxmKa
|
||||
WYcmx8OqTcmkAePKJNT7O1D6jDO39kjpvM3EbLTbWQsva6bylasVIR8fC8QhvsCQ
|
||||
8WwaLfMOSPaCGk1Nxcjai+BYDW/sveUo2lZoJTSLUUT0EaqlxXCsXD3BWSj5F+5t
|
||||
/AFHzdWdIHkIHB2P6V5xFu9fwHjhC3+dh42jqHLNKX2xza0FMKcTAwdzQ094RjL3
|
||||
cOGIsa0Vdt7Mks5eLCRxz0xI3kyrbF0/CopxT0pVWZwUzPk1G+Z3HesWkVtQpg7u
|
||||
RYzsoNKKc5mhc/V+vG290WAcNB4E3m85DgKQr4ib+J/rCy5/SnJYgg4QXsEyNlQ5
|
||||
ESBtRmuPfnrPIxqrDKZ7ZsJv8XFWydXTOfJxeKR1T1S02iYna+z1FnNu+t0ELTr9
|
||||
uhmkuqmV8RJVTub1P2EJPdiku/61UwNLyyZMgFjATDxB0hHIj1FP1HbfhEYbkYNc
|
||||
Dl7a7egJ4KFYWpQ+7MzOmc0OKq1HuJ9H4FhoYpbVq1OQosZ6G3d9afKSZa6dFdK0
|
||||
8ujvdQBR0NlAhc/LAr6BAoIBAQDfD3h9P4i5L8NCdocovCi3Eo0kcNQ3QuvnWrrs
|
||||
B/9CLoWhJrcLV85d0dEX6lSYl9BWW02ilVB+Qvom2wS2td1CBUgDxovX4tCZCuXt
|
||||
otYL/yWWOA7IG0Fjt6YEERQD/tRfKnn8hVBlk5cDTXXxHRGVMku4CHsN3ILtITQS
|
||||
VnVsTrGoWd6mFFA9X9Qu4zR9wKtjGEuL7BT8ixxtXLa2tMjdc4UL140yAgmMemJS
|
||||
TzC6EURe2OnhIzVe9yyLKcqw0prkGHg/Lau5lA1CAh67ZMY4EjO3cuda8R+O7vyO
|
||||
z2afeaTORzzdEbSZPG+8oqIN1/RjRCbl3RXYN8ibSwOzp6X7AoIBAQDAJEVta98J
|
||||
P2/36rXrkl6WrRfYqUPy6vgo/lPuRpp+BQ7ldgmH4+ZrJW5Mxa5hktVujk/C2kAO
|
||||
auzhzNlsxR+c/KwtsL1JXwBn8CT1bR0qvi+URmvGQn9GOKrLLy+6cfphuZWuc4/r
|
||||
hAgXzEjzPcJJJfxA1i2soKPbiFiCGHxot68P4uJSM2sU6QjNIxEjPbTJjEg894pD
|
||||
GJoiRRVHgnzzxL3cqrK90Zn6MAl9f2tYihfddsENeZb5t84LBppxBSGouE3ZH8uD
|
||||
Sufs4DSj1ptocbDbX+0kRNqfjTI5ivDxlS+ZKBe05PVTUmGBAWLamfCe89IW3/z+
|
||||
Rfkh4ZBPtlphAoIBADwjSqPR7kWnN+iCVjxIRl3dNYpelQh1FW7hikW6fjpUmphw
|
||||
/KalPLEUsV/WQIqHW5b8tLihsvrnidPR9rpf29BB5kGGVQuWThEE3CquXTEM0BBo
|
||||
+qs+lemRiMPN6uyM1qr1o7/OHXfVS8CLMMIZyTTFQ57RQoPhMLdH3WcYQj46FTHD
|
||||
UQDLtzpkzKr7fJpuyIZF9ZA6zQmtY7OkbGpj4Ue7LmKb8ahK3lIuaLWyPfvcTeeY
|
||||
aa3WNTxuPWcjlE8J6NKYOksmQAcfgFeMhMaXC83wMltCMlfVbGG30wWZqxxRynoG
|
||||
wMUFUgCCR8m+uxwqXewpYqdUbOBHYeFkXxIfn+MCggEAR5p8wQ1NHd4lNOekCfkP
|
||||
BOnWlChoKRPFjUlSL97h3gq2hW6amKimitF1LGkS1kvo+/1O3heFfZn9UxyK/kzr
|
||||
vg4vgAt4Tup3dUR6EXgrQW2Ev6YKreTEF4Awre2UxM+K9nY5wLxSKvuWJIA9w2AF
|
||||
kkr0mZj3hniK99n02e6UFlY1iB8OJoIA6tb5L7FcxpxNTjrYBNhfDygQ8Kp8Bp0r
|
||||
QZDVDHIUkEaXMjRKpRkiAOndgOurgAEK8V69C0DXtzypUX31jO+bYP8+NPlMxK3K
|
||||
Vn7f4LD75+M88e6lg+oyZmUpStM1GnWksvtlWLUSiNKLaEEGzv2EA6JB+I1dwUb8
|
||||
oQKCAQEAlmisUyn1/lpNnEzKsfUnRs53WxS2e1br5vJ5+pet3cjXT2btfp6J5/mf
|
||||
Tfqv5mZfTjYxydG0Kl3afI/SnhTcRS2/s4svrktZYLOLM2PAGYdCV6j1stXl4ObO
|
||||
eIfjzB3y1Zc2dEcWTylJ/lABoNGMPWFJQ67q8WS37pUHQPseJ++LmZFvlRyBgZBl
|
||||
VLqiHHiZ2ax+yC1ZxY4RECtEiYFplspNldNe+bP/lzTJftsUDe1FqRT/SvEam+1f
|
||||
kb//sbHkJ+l4BEv0Us3SIGwJ0BblhxLYO34IFVpheY4UQBy/nRaeUUdVR9r8JtYD
|
||||
z/cCLOrUJfealezimyd8SKPWPeHhrA==
|
||||
-----END PRIVATE KEY-----
|
||||
15
bench/grpc-server/package.json
Normal file
15
bench/grpc-server/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "bench",
|
||||
"scripts": {
|
||||
"deps": "exit 0",
|
||||
"build": "exit 0",
|
||||
"bun:server": "TLS=1 PORT=50051 bun ./index.js",
|
||||
"node:server": "TLS=1 PORT=50051 node ./index.js",
|
||||
"bench": "ghz --cacert ./cert.pem --proto ./benchmark.proto --call benchmark.BenchmarkService.Ping -d '{\"message\": \"Hello\"}' --total=100000 localhost:50051",
|
||||
"bench:insecure": "ghz --insecure --proto ./benchmark.proto --call benchmark.BenchmarkService.Ping -d '{\"message\": \"Hello\"}' --total=100000 localhost:50051"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "1.12.0",
|
||||
"@grpc/proto-loader": "0.7.10"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { gunzipSync, gzipSync } from "bun";
|
||||
import { bench, group, run } from "mitata";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
const data = await Bun.file(require.resolve("@babel/standalone/babel.min.js")).arrayBuffer();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const data = new TextEncoder().encode("Hello World!".repeat(9999));
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { readFileSync } from "fs";
|
||||
import { bench, run } from "mitata";
|
||||
import { createRequire } from "module";
|
||||
import { gunzipSync, gzipSync } from "zlib";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const data = readFileSync(require.resolve("@babel/standalone/babel.min.js"));
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"scripts": {
|
||||
"deps": "exit 0",
|
||||
"build": "exit 0",
|
||||
"bench:bun": "$BUN bun.js",
|
||||
"bench:node": "$NODE node.mjs",
|
||||
"bench:deno": "$DENO run -A --unstable deno.js",
|
||||
"bench:bun": "bun bun.js",
|
||||
"bench:node": "node node.mjs",
|
||||
"bench:deno": "deno run -A --unstable deno.js",
|
||||
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("console.log('hello')", () => console.log("hello"));
|
||||
bench("console.log({ hello: 'object' })", () => console.log({ hello: "object" }));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("console.log", () => console.log("hello"));
|
||||
bench("console.log({ hello: 'object' })", () => console.log({ hello: "object" }));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("console.log", () => console.log("hello"));
|
||||
bench("console.log({ hello: 'object' })", () => console.log({ hello: "object" }));
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"scripts": {
|
||||
"deps": "exit 0",
|
||||
"build": "exit 0",
|
||||
"bench:bun": "$BUN bun.js | grep iter",
|
||||
"bench:node": "$NODE node.mjs | grep iter",
|
||||
"bench:deno": "$DENO run -A --unstable deno.mjs | grep iter",
|
||||
"bench:bun": "bun bun.js | grep iter",
|
||||
"bench:node": "node node.mjs | grep iter",
|
||||
"bench:deno": "deno run -A --unstable deno.mjs | grep iter",
|
||||
"bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../../runner.mjs";
|
||||
import {
|
||||
arch,
|
||||
cpus,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { bench, run } from "mitata";
|
||||
import {
|
||||
arch,
|
||||
cpus,
|
||||
@@ -19,6 +18,7 @@ import {
|
||||
userInfo,
|
||||
version,
|
||||
} from "node:os";
|
||||
import { bench, run } from "../../runner.mjs";
|
||||
|
||||
bench("cpus()", () => cpus());
|
||||
bench("networkInterfaces()", () => networkInterfaces());
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
"scripts": {
|
||||
"deps": "exit 0",
|
||||
"build": "exit 0",
|
||||
"bench:bun": "$BUN bun.js",
|
||||
"bench:node": "$NODE node.mjs",
|
||||
"bench:bun": "bun bun.js",
|
||||
"bench:node": "node node.mjs",
|
||||
"bench": "bun run bench:bun && bun run bench:node"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
"execa": "^8.0.1",
|
||||
"fast-glob": "3.3.1",
|
||||
"fdir": "^6.1.0",
|
||||
"mitata": "^0.1.6",
|
||||
"mitata": "^1.0.10",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"string-width": "7.1.0",
|
||||
"tinycolor2": "^1.6.0",
|
||||
"zx": "^7.2.3"
|
||||
|
||||
19
bench/runner.mjs
Normal file
19
bench/runner.mjs
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as Mitata from "mitata";
|
||||
import process from "node:process";
|
||||
|
||||
const asJSON = !!process?.env?.BENCHMARK_RUNNER;
|
||||
|
||||
/** @param {Parameters<typeof Mitata["run"]>["0"]} opts */
|
||||
export function run(opts = {}) {
|
||||
if (asJSON) {
|
||||
opts.format = "json";
|
||||
}
|
||||
|
||||
return Mitata.run(opts);
|
||||
}
|
||||
|
||||
export const bench = Mitata.bench;
|
||||
|
||||
export function group(_name, fn) {
|
||||
return Mitata.group(fn);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
function doIt(...args) {
|
||||
// we use .at() to prevent constant folding optimizations
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// https://github.com/oven-sh/bun/issues/1096
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const identity = x => x;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
var myArray = new Array(5);
|
||||
bench("[1, 2, 3, 4, 5].shift()", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
var comparator = (a, b) => a - b;
|
||||
|
||||
const numbers = [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @runtime bun
|
||||
import { ArrayBufferSink } from "bun";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
var short = "Hello World!";
|
||||
var shortUTF16 = "Hello World 💕💕💕";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as assert from "assert";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("deepEqual", () => {
|
||||
assert.deepEqual({ foo: "123", bar: "baz" }, { foo: "123", bar: "baz" });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("noop", function () {});
|
||||
bench("async function(){}", async function () {});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
function makeBenchmark(size) {
|
||||
const latin1 = btoa("A".repeat(size));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("new Blob(['hello world'])", function () {
|
||||
return new Blob(["hello world"]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
function makeBenchmark(size, isToString) {
|
||||
const base64Input = Buffer.alloc(size, "latin1").toString("base64");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
for (let size of [32, 2048, 1024 * 16, 1024 * 1024 * 2, 1024 * 1024 * 16]) {
|
||||
const first = Buffer.allocUnsafe(size);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @runtime bun,node,deno
|
||||
import { Buffer } from "node:buffer";
|
||||
import process from "node:process";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const N = parseInt(process.env.RUN_COUNTER ?? "10000", 10);
|
||||
var isBuffer = new Buffer(0);
|
||||
|
||||
15
bench/snippets/buffer-fill.mjs
Normal file
15
bench/snippets/buffer-fill.mjs
Normal file
@@ -0,0 +1,15 @@
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
for (let size of [32, 2048, 1024 * 16, 1024 * 1024 * 2, 1024 * 1024 * 16]) {
|
||||
for (let fillSize of [4, 8, 16, 11]) {
|
||||
const buffer = Buffer.allocUnsafe(size);
|
||||
|
||||
const pattern = "x".repeat(fillSize);
|
||||
|
||||
bench(`Buffer.fill ${size} bytes with ${fillSize} byte value`, () => {
|
||||
buffer.fill(pattern);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
await run();
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Buffer } from "node:buffer";
|
||||
import crypto from "node:crypto";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const bigBuffer = Buffer.from("hello world".repeat(10000));
|
||||
const converted = bigBuffer.toString("base64");
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import Color from "color";
|
||||
import tinycolor from "tinycolor2";
|
||||
import { bench, group, run } from "./runner.mjs";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
const inputs = ["#f00", "rgb(255, 0, 0)", "rgba(255, 0, 0, 1)", "hsl(0, 100%, 50%)"];
|
||||
|
||||
for (const input of inputs) {
|
||||
group(`${input}`, () => {
|
||||
if (typeof Bun !== "undefined") {
|
||||
bench("Bun.color()", () => {
|
||||
bench(`Bun.color() (${input})`, () => {
|
||||
Bun.color(input, "css");
|
||||
});
|
||||
}
|
||||
|
||||
bench("color", () => {
|
||||
bench(`color (${input})`, () => {
|
||||
Color(input).hex();
|
||||
});
|
||||
|
||||
bench("'tinycolor2'", () => {
|
||||
bench(`'tinycolor2' (${input})`, () => {
|
||||
tinycolor(input).toHexString();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { allocUnsafe } from "bun";
|
||||
import { readFileSync } from "fs";
|
||||
import { bench, group, run } from "./runner.mjs";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
function polyfill(chunks) {
|
||||
var size = 0;
|
||||
@@ -41,15 +41,16 @@ const chunkGroups = [
|
||||
];
|
||||
|
||||
for (const chunks of chunkGroups) {
|
||||
group(`${chunks.reduce((prev, curr, i, a) => prev + curr.byteLength, 0)} bytes for ${chunks.length} chunks`, () => {
|
||||
bench("Bun.concatArrayBuffers", () => {
|
||||
const name = `${chunks.reduce((prev, curr, i, a) => prev + curr.byteLength, 0)} bytes for ${chunks.length} chunks`
|
||||
group(name, () => {
|
||||
bench(`Bun.concatArrayBuffers (${name})`, () => {
|
||||
Bun.concatArrayBuffers(chunks);
|
||||
});
|
||||
bench("Uint8Array.set", () => {
|
||||
bench(`Uint8Array.set (${name})`, () => {
|
||||
polyfill(chunks);
|
||||
});
|
||||
|
||||
bench("Uint8Array.set (uninitialized memory)", () => {
|
||||
bench(`Uint8Array.set (uninitialized memory) (${name})`, () => {
|
||||
polyfillUninitialized(chunks);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const json = {
|
||||
login: "wongmjane",
|
||||
|
||||
@@ -2,7 +2,7 @@ import { mkdirSync, rmSync, writeFileSync } from "fs";
|
||||
import { cp } from "fs/promises";
|
||||
import { tmpdir } from "os";
|
||||
import { join, resolve } from "path";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
import { fileURLToPath } from "url";
|
||||
const hugeDirectory = (() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// https://github.com/oven-sh/bun/issues/2190
|
||||
import { bench, run } from "mitata";
|
||||
import { createHash } from "node:crypto";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const data =
|
||||
"Delightful remarkably mr on announcing themselves entreaties favourable. About to in so terms voice at. Equal an would is found seems of. The particular friendship one sufficient terminated frequently themselves. It more shed went up is roof if loud case. Delay music in lived noise an. Beyond genius really enough passed is up.";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// so it can run in environments without node module resolution
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
import crypto from "node:crypto";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("crypto.randomUUID()", () => {
|
||||
return crypto.randomUUID();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// https://github.com/oven-sh/bun/issues/2190
|
||||
import { bench, run } from "mitata";
|
||||
import { createHash } from "node:crypto";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const data =
|
||||
"Delightful remarkably mr on announcing themselves entreaties favourable. About to in so terms voice at. Equal an would is found seems of. The particular friendship one sufficient terminated frequently themselves. It more shed went up is roof if loud case. Delay music in lived noise an. Beyond genius really enough passed is up.";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// so it can run in environments without node module resolution
|
||||
import crypto from "node:crypto";
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
var foo = new Uint8Array(65536);
|
||||
bench("crypto.getRandomValues(65536)", () => {
|
||||
crypto.getRandomValues(foo);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import fastDeepEquals from "fast-deep-equal/es6/index";
|
||||
import { bench, group, run } from "./runner.mjs";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
// const Date = globalThis.Date;
|
||||
|
||||
function func1() {}
|
||||
@@ -490,7 +490,7 @@ for (let { tests, description } of fixture) {
|
||||
var expected;
|
||||
group(describe, () => {
|
||||
for (let equalsFn of [Bun.deepEquals, fastDeepEquals]) {
|
||||
bench(equalsFn.name, () => {
|
||||
bench(`${describe}: ${equalsFn.name}`, () => {
|
||||
expected = equalsFn(value1, value2);
|
||||
if (expected !== equal) {
|
||||
throw new Error(`Expected ${expected} to be ${equal} for ${description}`);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const properties = {
|
||||
closed: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { lookup, resolve } from "node:dns/promises";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("(cached) dns.lookup remote x 50", async () => {
|
||||
var tld = "example.com";
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { dns } from "bun";
|
||||
import { bench, group, run } from "./runner.mjs";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
async function forEachBackend(name, fn) {
|
||||
group(name, () => {
|
||||
for (let backend of ["libc", "c-ares", process.platform === "darwin" ? "system" : ""].filter(Boolean))
|
||||
bench(backend, fn(backend));
|
||||
bench(`${backend} (${name})`, fn(backend));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
var err = new Error();
|
||||
bench("Error.captureStackTrace(err)", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, group, run } from "./runner.mjs";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
var bunEscapeHTML = globalThis.escapeHTML || Bun.escapeHTML;
|
||||
|
||||
@@ -92,24 +92,21 @@ function reactEscapeHtml(string) {
|
||||
// }
|
||||
|
||||
for (let input of [
|
||||
`long string, nothing to escape... `.repeat(9999999 * 3),
|
||||
"long string, nothing to escape... ".repeat(9999999 * 3),
|
||||
FIXTURE.repeat(8000),
|
||||
// "[unicode]" + FIXTURE_WITH_UNICODE,
|
||||
]) {
|
||||
const name = `"${input.substring(0, Math.min(input.length, 32))}" (${new Intl.NumberFormat().format(input.length / 100_000_000_0)} GB)`
|
||||
group(
|
||||
{
|
||||
summary: true,
|
||||
name:
|
||||
`"` +
|
||||
input.substring(0, Math.min(input.length, 32)) +
|
||||
`"` +
|
||||
` (${new Intl.NumberFormat().format(input.length / 100_000_000_0)} GB)`,
|
||||
name
|
||||
},
|
||||
() => {
|
||||
// bench(`ReactDOM.escapeHTML`, () => reactEscapeHtml(input));
|
||||
// bench(`html-entities.encode`, () => htmlEntityEncode(input));
|
||||
// bench(`he.escape`, () => heEscape(input));
|
||||
bench(`Bun.escapeHTML`, () => bunEscapeHTML(input));
|
||||
bench(`Bun.escapeHTML (${name})`, () => bunEscapeHTML(input));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { dlopen } from "bun:ffi";
|
||||
import { bench, group, run } from "./runner.mjs";
|
||||
import { bench, group, run } from "../runner.mjs";
|
||||
|
||||
const types = {
|
||||
returns_true: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// so it can run in environments without node module resolution
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const blob = new Blob(["foo", "bar", "baz"]);
|
||||
bench("FormData.append", () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
// pure JS implementation will optimze this out
|
||||
bench("new Headers", function () {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const input =
|
||||
"Hello, World! foo bar baz qux quux corge grault garply waldo fred plugh xyzzy thud z a b c d e f g h i j k l m n o p q r s t u v w x y z".split(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
var obj = {
|
||||
"restApiRoot": "/api",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "mitata";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
bench("JSON.stringify({hello: 'world'})", () => JSON.stringify({ hello: "world" }));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// This is a stress test of some internals in How Bun does the module.exports assignment.
|
||||
// If it crashes or throws then this fails
|
||||
import("./runner.mjs").then(({ bench, run }) => {
|
||||
import("../runner.mjs").then(({ bench, run }) => {
|
||||
bench("Object.defineProperty(module, 'exports', { get() { return 42; } })", () => {
|
||||
Object.defineProperty(module, "exports", {
|
||||
get() {
|
||||
@@ -36,7 +36,9 @@ import("./runner.mjs").then(({ bench, run }) => {
|
||||
a: 1,
|
||||
};
|
||||
|
||||
console.log(
|
||||
const log = !process?.env?.BENCHMARK_RUNNER ? console.log : () => {};
|
||||
|
||||
log(
|
||||
module?.exports,
|
||||
require.cache[module.id].exports,
|
||||
module?.exports === require.cache[module.id],
|
||||
@@ -49,10 +51,11 @@ import("./runner.mjs").then(({ bench, run }) => {
|
||||
return 42;
|
||||
};
|
||||
|
||||
console.log(module.exports, module.exports());
|
||||
log(module.exports);
|
||||
log(module.exports, module.exports());
|
||||
|
||||
queueMicrotask(() => {
|
||||
console.log(
|
||||
log(
|
||||
module?.exports,
|
||||
require.cache[module.id].exports,
|
||||
module?.exports === require.cache[module.id]?.exports,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
// These are no-op C++ functions that are exported to JS.
|
||||
const lazy = globalThis[Symbol.for("Bun.lazy")];
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IncomingMessage } from "node:http";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const headers = {
|
||||
date: "Mon, 06 Nov 2023 05:12:49 GMT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @runtime node, bun
|
||||
import * as vm from "node:vm";
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const context = {
|
||||
animal: "cat",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
var noop = globalThis[Symbol.for("Bun.lazy")]("noop");
|
||||
var { function: noopFn, callback } = noop;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// so it can run in environments without node module resolution
|
||||
import { bench, run } from "../../node_modules/mitata/src/cli.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
const obj = {
|
||||
a: 1,
|
||||
|
||||
@@ -24,7 +24,7 @@ const obj = {
|
||||
w: 23,
|
||||
};
|
||||
|
||||
import { bench, run } from "./runner.mjs";
|
||||
import { bench, run } from "../runner.mjs";
|
||||
|
||||
var val = 0;
|
||||
bench("Object.values(literal)", () => {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user