mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
ci: Fix build image step with zig (#20023)
This commit is contained in:
@@ -309,6 +309,19 @@ function getCppAgent(platform, options) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Platform}
|
||||
*/
|
||||
function getZigPlatform() {
|
||||
return {
|
||||
os: "linux",
|
||||
arch: "aarch64",
|
||||
abi: "musl",
|
||||
distro: "alpine",
|
||||
release: "3.21",
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Platform} platform
|
||||
* @param {PipelineOptions} options
|
||||
@@ -322,19 +335,9 @@ function getZigAgent(platform, options) {
|
||||
// queue: "build-zig",
|
||||
// };
|
||||
|
||||
return getEc2Agent(
|
||||
{
|
||||
os: "linux",
|
||||
arch: "aarch64",
|
||||
abi: "musl",
|
||||
distro: "alpine",
|
||||
release: "3.21",
|
||||
},
|
||||
options,
|
||||
{
|
||||
instanceType: "r8g.large",
|
||||
},
|
||||
);
|
||||
return getEc2Agent(getZigPlatform(), options, {
|
||||
instanceType: "r8g.large",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1105,6 +1108,11 @@ async function getPipeline(options = {}) {
|
||||
steps.push(
|
||||
...relevantBuildPlatforms.map(target => {
|
||||
const imageKey = getImageKey(target);
|
||||
const zigImageKey = getImageKey(getZigPlatform());
|
||||
const dependsOn = imagePlatforms.has(zigImageKey) ? [`${zigImageKey}-build-image`] : [];
|
||||
if (imagePlatforms.has(imageKey)) {
|
||||
dependsOn.push(`${imageKey}-build-image`);
|
||||
}
|
||||
|
||||
return getStepWithDependsOn(
|
||||
{
|
||||
@@ -1114,7 +1122,7 @@ async function getPipeline(options = {}) {
|
||||
? [getBuildBunStep(target, options)]
|
||||
: [getBuildCppStep(target, options), getBuildZigStep(target, options), getLinkBunStep(target, options)],
|
||||
},
|
||||
imagePlatforms.has(imageKey) ? `${imageKey}-build-image` : undefined,
|
||||
...dependsOn,
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Version: 7
|
||||
# Version: 8
|
||||
# A script that installs the dependencies needed to build and test Bun.
|
||||
# This should work on Windows 10 or newer with PowerShell.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# Version: 10
|
||||
# Version: 11
|
||||
|
||||
# A script that installs the dependencies needed to build and test Bun.
|
||||
# This should work on macOS and Linux with a POSIX shell.
|
||||
|
||||
@@ -290,7 +290,7 @@ export async function spawn(command, options = {}) {
|
||||
if (exitCode !== 0 && isWindows) {
|
||||
const exitReason = getWindowsExitReason(exitCode);
|
||||
if (exitReason) {
|
||||
exitCode = exitReason;
|
||||
signalCode = exitReason;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ export function spawnSync(command, options = {}) {
|
||||
if (exitCode !== 0 && isWindows) {
|
||||
const exitReason = getWindowsExitReason(exitCode);
|
||||
if (exitReason) {
|
||||
exitCode = exitReason;
|
||||
signalCode = exitReason;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -442,9 +442,37 @@ export function spawnSyncSafe(command, options = {}) {
|
||||
* @returns {string | undefined}
|
||||
*/
|
||||
export function getWindowsExitReason(exitCode) {
|
||||
const ntStatusPath = "C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.22621.0\\shared\\ntstatus.h";
|
||||
const nthStatus = readFile(ntStatusPath, { cache: true });
|
||||
const windowsKitPath = "C:\\Program Files (x86)\\Windows Kits";
|
||||
if (!existsSync(windowsKitPath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const windowsKitPaths = readdirSync(windowsKitPath)
|
||||
.filter(filename => isFinite(parseInt(filename)))
|
||||
.sort((a, b) => parseInt(b) - parseInt(a));
|
||||
|
||||
let ntStatusPath;
|
||||
for (const windowsKitPath of windowsKitPaths) {
|
||||
const includePath = `${windowsKitPath}\\Include`;
|
||||
if (!existsSync(includePath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const windowsSdkPaths = readdirSync(includePath).sort();
|
||||
for (const windowsSdkPath of windowsSdkPaths) {
|
||||
const statusPath = `${includePath}\\${windowsSdkPath}\\shared\\ntstatus.h`;
|
||||
if (existsSync(statusPath)) {
|
||||
ntStatusPath = statusPath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ntStatusPath) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nthStatus = readFile(ntStatusPath, { cache: true });
|
||||
const match = nthStatus.match(new RegExp(`(STATUS_\\w+).*0x${exitCode?.toString(16)}`, "i"));
|
||||
if (match) {
|
||||
const [, exitReason] = match;
|
||||
|
||||
Reference in New Issue
Block a user