Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .buildkite/ci.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ function getTargetLabel(target) {
* @type {Platform[]}
*/
const buildPlatforms = [
{ os: "darwin", arch: "aarch64", release: "13" },
{ os: "darwin", arch: "aarch64", release: "14" },
{ os: "darwin", arch: "aarch64", release: "15" },
{ os: "darwin", arch: "aarch64", release: "26" },
{ os: "darwin", arch: "x64", release: "14" },
{ os: "linux", arch: "aarch64", distro: "amazonlinux", release: "2023", features: ["docker"] },
{ os: "linux", arch: "x64", distro: "amazonlinux", release: "2023", features: ["docker"] },
Expand Down Expand Up @@ -612,6 +615,7 @@ function getBuildImageStep(platform, options) {
const { os, arch, distro, release, features } = platform;
const { publishImages } = options;
const action = publishImages ? "publish-image" : "create-image";
const cloud = os == "darwin" ? "tart" : "aws";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Prefer strict equality (===) for consistency.

The comparison uses == while the rest of the codebase uses === for string comparisons.

-  const cloud = os == "darwin" ? "tart" : "aws";
+  const cloud = os === "darwin" ? "tart" : "aws";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const cloud = os == "darwin" ? "tart" : "aws";
const cloud = os === "darwin" ? "tart" : "aws";
🤖 Prompt for AI Agents
In .buildkite/ci.mjs around line 618, the conditional uses loose equality (==)
to compare os to "darwin"; change it to strict equality (===) to match codebase
conventions and avoid type-coercion issues—update the expression so it uses ===
for the comparison while keeping the existing ternary result.


const command = [
"node",
Expand All @@ -621,7 +625,7 @@ function getBuildImageStep(platform, options) {
`--arch=${arch}`,
distro && `--distro=${distro}`,
`--release=${release}`,
"--cloud=aws",
`--cloud=${cloud}`,
"--ci",
"--authorized-org=oven-sh",
];
Expand Down Expand Up @@ -660,7 +664,9 @@ function getReleaseStep(buildPlatforms, options) {
agents: {
queue: "test-darwin",
},
depends_on: buildPlatforms.filter(p => p.os !== "freebsd").map(platform => `${getTargetKey(platform)}-build-bun`),
depends_on: buildPlatforms
.filter(p => !(p.os === "freebsd" || p.os === "darwin"))
.map(platform => `${getTargetKey(platform)}-build-bun`),
env: {
CANARY: revision,
},
Expand Down Expand Up @@ -1073,7 +1079,7 @@ async function getPipeline(options = {}) {
const imagePlatforms = new Map(
buildImages || publishImages
? [...buildPlatforms, ...testPlatforms]
.filter(({ os }) => os !== "darwin")
.filter(({ os, arch }) => !(os === "darwin"))
.map(platform => [getImageKey(platform), platform])
: [],
);
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@
"machine:linux:amazonlinux": "./scripts/machine.mjs ssh --cloud=aws --arch=x64 --instance-type c7i.2xlarge --os=linux --distro=amazonlinux --release=2023",
"machine:windows:2019": "./scripts/machine.mjs ssh --cloud=aws --arch=x64 --instance-type c7i.2xlarge --os=windows --release=2019",
"machine:freebsd": "./scripts/machine.mjs ssh --cloud=aws --arch=x64 --instance-type c7i.2xlarge --os=freebsd --release=14.3",
"machine:macos:13": "./scripts/machine.mjs ssh --cloud=tart --arch=arm64 --os=darwin --distro=macos --release=13",
"machine:macos:14": "./scripts/machine.mjs ssh --cloud=tart --arch=arm64 --os=darwin --distro=macos --release=14",
"machine:macos:15": "./scripts/machine.mjs ssh --cloud=tart --arch=arm64 --os=darwin --distro=macos --release=15",
"machine:macos:26": "./scripts/machine.mjs ssh --cloud=tart --arch=arm64 --os=darwin --distro=macos --release=26",
"sync-webkit-source": "bun ./scripts/sync-webkit-source.ts"
}
}
101 changes: 68 additions & 33 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ error() {
if ! [ "$$" = "$pid" ]; then
kill -s TERM "$pid"
fi
exit 1
# Kill the shell. This used to be 'exit 1' but if the command is running inside a
# subshell, then only the subshell dies and the script keeps running uninterrupted.
kill $$
}

execute() {
local opts=$-
set -x
"$@"
{ local status=$?; set +x "$opts"; } 2> /dev/null
if [ "$status" -ne 0 ]; then
print "$ $@" >&2
if ! "$@"; then
error "Command failed: $@"
fi
}
Expand Down Expand Up @@ -62,7 +61,7 @@ execute_as_user() {
}

grant_to_user() {
path="$1"
local path="$1"
if ! [ -f "$path" ] && ! [ -d "$path" ]; then
error "Could not find file or directory: \"$path\""
fi
Expand All @@ -77,7 +76,7 @@ which() {
}

require() {
path="$(which "$1")"
local path="$(which "$1")"
if ! [ -f "$path" ]; then
error "Command \"$1\" is required, but is not installed."
fi
Expand Down Expand Up @@ -109,7 +108,7 @@ compare_version() {
}

create_directory() {
path="$1"
local path="$1"
path_dir="$path"
while ! [ -d "$path_dir" ]; do
path_dir="$(dirname "$path_dir")"
Expand All @@ -132,13 +131,13 @@ create_directory() {

create_tmp_directory() {
mktemp="$(require mktemp)"
path="$(execute "$mktemp" -d)"
local path="$(execute "$mktemp" -d)"
grant_to_user "$path"
print "$path"
}

create_file() {
path="$1"
local path="$1"
path_dir="$(dirname "$path")"
if ! [ -d "$path_dir" ]; then
create_directory "$path_dir"
Expand All @@ -164,7 +163,7 @@ create_file() {
}

append_file() {
path="$1"
local path="$1"
if ! [ -f "$path" ]; then
create_file "$path"
fi
Expand Down Expand Up @@ -203,7 +202,7 @@ download_and_verify_file() {
file_url="$1"
hash="$2"

path=$(download_file "$file_url")
local path=$(download_file "$file_url")
execute sh -c 'echo "'"$hash $path"'" | sha256sum -c -' >/dev/null 2>&1

print "$path"
Expand All @@ -222,7 +221,7 @@ append_to_profile() {
}

append_to_path() {
path="$1"
local path="$1"
if ! [ -d "$path" ]; then
error "Could not find directory: \"$path\""
fi
Expand Down Expand Up @@ -331,7 +330,7 @@ check_operating_system() {
darwin)
sw_vers="$(which sw_vers)"
if [ -f "$sw_vers" ]; then
distro="$("$sw_vers" -productName)"
distro="$("$sw_vers" -productName | tr '[:upper:]' '[:lower:]')"
release="$("$sw_vers" -productVersion)"
fi

Expand Down Expand Up @@ -372,12 +371,12 @@ check_operating_system() {
;;
esac
fi

if [ -n "$abi" ]; then
print "ABI: $abi $abi_version"
fi
;;
esac

if [ -n "$abi" ]; then
print "ABI: $abi $abi_version"
fi
}

check_inside_docker() {
Expand Down Expand Up @@ -456,6 +455,9 @@ check_package_manager() {
export ASSUME_ALWAYS_YES=yes
package_manager update -f
;;
brew)
package_manager upgrade
;;
esac
}

Expand Down Expand Up @@ -655,11 +657,6 @@ install_packages() {
brew)
package_manager install \
--force \
--formula \
"$@"
package_manager link \
--force \
--overwrite \
"$@"
;;
apk)
Expand All @@ -682,7 +679,7 @@ install_brew() {
print "Installing Homebrew..."

bash="$(require bash)"
script=$(download_file "https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh")
script=$(download_file "https://github.com/Homebrew/install/raw/main/install.sh")
execute_as_user "$bash" -lc "NONINTERACTIVE=1 $script"

case "$arch" in
Expand Down Expand Up @@ -766,6 +763,12 @@ install_common_software() {
editors/vim \
sysutils/neofetch \
;;
brew)
# https://brew.sh
install_packages \
coreutils \
neofetch \
;;
esac

case "$distro" in
Expand Down Expand Up @@ -1163,7 +1166,8 @@ install_llvm() {
install_packages "llvm-$(llvm_version)-tools"
;;
brew)
install_packages "llvm@$(llvm_version)"
install_packages "llvm@$(llvm_version)" "lld@$(llvm_version)"
package_manager link "llvm@$(llvm_version)" "lld@$(llvm_version)"
;;
apk)
install_packages \
Expand All @@ -1184,7 +1188,13 @@ install_llvm() {
}

install_gcc() {
if ! [ "$os" = "linux" ] || ! [ "$distro" = "ubuntu" ] || [ -z "$gcc_version" ]; then
if ! [ "$os" = "linux" ]; then
return
fi
if ! [ "$distro" = "ubuntu" ]; then
return
fi
if [ -z "$gcc_version" ]; then
return
fi

Expand Down Expand Up @@ -1260,7 +1270,7 @@ install_sccache() {
case "$os" in
linux)
;;
freebsd)
freebsd | darwin)
cargo install sccache --locked --version 0.12.0
return
;;
Expand Down Expand Up @@ -1307,6 +1317,9 @@ install_rust() {
create_directory "$HOME/.cargo/bin"
append_to_path "$HOME/.cargo/bin"
;;
macos)
install_packages rust
;;
*)
rust_home="/opt/rust"
create_directory "$rust_home"
Expand All @@ -1333,7 +1346,7 @@ install_docker() {
case "$pm" in
brew)
if ! [ -d "/Applications/Docker.app" ]; then
package_manager install docker --cask
install_packages docker docker-compose
fi
;;
pkg)
Expand All @@ -1358,6 +1371,10 @@ install_docker() {
;;
esac

if [ "$os" = "darwin" ]; then
return
fi

systemctl="$(which systemctl)"
if [ -f "$systemctl" ]; then
execute_sudo "$systemctl" enable docker
Expand Down Expand Up @@ -1385,7 +1402,10 @@ macos_sdk_version() {
}

install_osxcross() {
if ! [ "$os" = "linux" ] || ! [ "$osxcross" = "1" ]; then
if ! [ "$os" = "linux" ]; then
return
fi
if ! [ "$osxcross" = "1" ]; then
return
fi

Expand Down Expand Up @@ -1431,9 +1451,7 @@ install_tailscale() {
execute "$sh" "$tailscale_script"
;;
darwin)
install_packages go
execute_as_user go install tailscale.com/cmd/tailscale{,d}@latest
append_to_path "$home/go/bin"
install_packages tailscale
;;
freebsd)
install_packages security/tailscale
Expand Down Expand Up @@ -1666,6 +1684,9 @@ install_chromium() {
install_packages \
www/chromium \
;;
brew)
install_packages --cask google-chrome
;;
esac

case "$distro" in
Expand Down Expand Up @@ -1705,6 +1726,17 @@ install_age() {
;;
esac
;;
darwin)
case "$arch" in
aarch64)
age_arch="arm64"
age_hash="cf79875bd5970dc2dac60c87fa50cee1ff1f9a41b0eb273f65e174aff37c367a"
;;
*)
error "Unsupported platform: $os-$arch"
;;
esac
;;
*)
error "Unsupported platform: $os-$arch"
;;
Expand Down Expand Up @@ -1753,6 +1785,9 @@ clean_system() {
if ! [ "$ci" = "1" ]; then
return
fi
if [ "$os" = "darwin" ]; then
return
fi

print "Cleaning system..."

Expand Down
Loading