Skip to content

Commit 249f74a

Browse files
committed
macos13: base image scripts (#3)
1 parent 8d397a4 commit 249f74a

File tree

6 files changed

+91
-3
lines changed

6 files changed

+91
-3
lines changed

download.sh

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -euo pipefail -o bsdecho
55
download() {
66
local dest_path=$1/${2##*/}
77
local expected=${3-0000000000000000000000000000000000000000000000000000000000000000}
8+
mkdir -p -- "$1"
89
[ -e "$dest_path" ] || curl -Lo "$dest_path" -- "$2"
910
if ! printf '%s %s\n' "$expected" "$dest_path" | sha256sum -c; then
1011
>&2 printf 'Expected sha256: %s\n' "$expected"

inject.sh

+7
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,10 @@ inject() (
66
dest=$1; shift
77
rsync -a --no-i-r --info=progress2 -- "$@" "$dest"
88
)
9+
10+
inject_exfat() (
11+
dest=$1; shift
12+
# Skip owners, groups, and links (for exFAT)
13+
# FIXME: are macOS Servo builds ok with this?
14+
rsync -a --no-o --no-g --no-l --no-i-r --info=progress2 -- "$@" "$dest"
15+
)

macos13/configure-base.sh

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env zsh
2+
# usage: configure-base.sh
3+
script_dir=${0:a:h}/..
4+
. "$script_dir/common.sh"
5+
cache_dir=$script_dir/cache
6+
. "$script_dir/download.sh"
7+
. "$script_dir/inject.sh"
8+
9+
>&2 echo '[*] Caching downloads'
10+
mkdir -p -- "$cache_dir"
11+
download "$cache_dir" https://static.rust-lang.org/rustup/rustup-init.sh 32a680a84cf76014915b3f8aa44e3e40731f3af92cd45eb0fcc6264fd257c428
12+
download "$cache_dir" https://github.com/actions/runner/releases/download/v2.321.0/actions-runner-osx-x64-2.321.0.tar.gz b2c91416b3e4d579ae69fc2c381fc50dbda13f1b3fcc283187e2c75d1b173072
13+
download "$cache_dir" https://astral.sh/uv/install.sh 47ead06f79eba7461fd113fc92dc0f191af7455418462fbbed21affa2a6c22e2
14+
download "$cache_dir/homebrew" https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh 9ad0c8048f3f1a01d5f6610e0df347ceeae5879cf0aa51c1d987aa8aee740dca
15+
16+
>&2 echo '[*] Injecting init script'
17+
mkdir -p init
18+
inject_exfat init "$script_dir/macos13/init.sh"
19+
inject_exfat init "$cache_dir/rustup-init.sh"
20+
inject_exfat init/install-uv.sh "$cache_dir/install.sh"
21+
inject_exfat init/install-homebrew.sh "$cache_dir/homebrew/install.sh"
22+
chmod +x init/rustup-init.sh init/install-uv.sh
23+
24+
>&2 echo '[*] Injecting GitHub Actions runner'
25+
# See also: <https://github.com/servo/servo/settings/actions/runners/new?arch=x64&os=linux>
26+
# Runner tarball includes symlinks, which are not supported by exFAT (on macOS at least)
27+
inject_exfat init/actions-runner-osx-x64.tar.gz "$cache_dir/actions-runner-osx-x64-2.321.0.tar.gz"
28+
29+
>&2 echo '[*] Creating working directory for builds (/Volumes/a/a)'
30+
mkdir -p a
31+
32+
>&2 echo '[*] Injecting servo repo'
33+
mkdir -p a/servo
34+
inject_exfat a/servo "$SERVO_CI_MAIN_REPO_PATH"
35+
git -C a/servo/servo remote remove origin || :
36+
git -C a/servo/servo remote add origin https://github.com/servo/servo.git
37+
38+
>&2 echo '[*] Injecting cargo cache'
39+
inject_exfat . "$SERVO_CI_DOT_CARGO_PATH"
40+
41+
>&2 echo '[*] Injecting cargo config'
42+
inject_exfat .cargo/config.toml "$script_dir/shared/cargo-config.toml"

macos13/init.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env zsh
2+
set -euo pipefail -o bsdecho
3+
4+
# Install Homebrew, including Xcode CLT (Command Line Tools)
5+
NONINTERACTIVE=1 /Volumes/a/init/install-homebrew.sh
6+
7+
# Install rustup and the latest Rust
8+
if ! [ -e /Users/servo/.rustup ]; then
9+
/Volumes/a/init/rustup-init.sh -y --quiet
10+
fi
11+
12+
# ~/.cargo/env requires HOME to be set
13+
export HOME=/Users/servo
14+
. /Users/servo/.cargo/env
15+
16+
# Install uv and ensure it is on PATH
17+
if ! [ -e /Users/servo/.local/bin/uv ]; then
18+
/Volumes/a/init/install-uv.sh
19+
fi
20+
export PATH=$HOME/.local/bin:$PATH
21+
22+
if ! [ -e /Volumes/a/init/built_servo_once_successfully ]; then
23+
cd /Volumes/a/a/servo/servo
24+
./mach bootstrap --force
25+
# Build the same way as a typical Linux build job, to allow for incremental builds.
26+
./mach build --use-crown --locked --release --features layout_2013
27+
touch /Volumes/a/init/built_servo_once_successfully
28+
sudo shutdown -h now
29+
exit
30+
fi
31+
32+
if [ -e /Volumes/a/init/runner.sh ]; then
33+
. /Volumes/a/init/runner.sh
34+
fi

mount-runner.sh

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ else
1010
fi
1111

1212
mount=$(mktemp -d)
13-
if [ -e /dev/zvol/$SERVO_CI_ZFS_PREFIX/$vm-part1 ]; then
13+
if [ -e /dev/zvol/$SERVO_CI_ZFS_PREFIX/$vm-part2 ]; then
14+
mount /dev/zvol/$SERVO_CI_ZFS_PREFIX/$vm-part2 $mount
15+
elif [ -e /dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX/$vm-part2 ]; then
16+
mount /dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX/$vm-part2 $mount
17+
elif [ -e /dev/zvol/$SERVO_CI_ZFS_PREFIX/$vm-part1 ]; then
1418
mount /dev/zvol/$SERVO_CI_ZFS_PREFIX/$vm-part1 $mount
1519
elif [ -e /dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX/$vm-part1 ]; then
1620
mount /dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX/$vm-part1 $mount
1721
else
18-
>&2 echo "fatal: failed to find $vm-part1 in /dev/zvol/$SERVO_CI_ZFS_PREFIX or /dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX"
22+
>&2 echo "fatal: failed to find $vm-part2 or $vm-part1 in /dev/zvol/$SERVO_CI_ZFS_PREFIX or /dev/zvol/$SERVO_CI_ZFS_CLONE_PREFIX"
1923
exit 1
2024
fi
2125
cd $mount

static/macos13/org.servo.ci.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<string>open</string>
2020
<string>-Wa</string><!-- wait, application -->
2121
<string>/System/Applications/Utilities/Terminal.app</string>
22-
<string>/Volumes/a/init/boot.sh</string>
22+
<string>/Volumes/a/init/init.sh</string>
2323
</array>
2424
</dict>
2525
</plist>

0 commit comments

Comments
 (0)