Skip to content

Commit 766fc44

Browse files
committed
update: standardize Rust version setup to 1.87.0 and streamline target addition for all platforms
1 parent 77e45c2 commit 766fc44

File tree

1 file changed

+17
-35
lines changed

1 file changed

+17
-35
lines changed

.github/workflows/scripts/setup-rust.sh

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ PGO_ARTIFACT_NAME="$3"
1313

1414
echo "Setting up Rust for platform=$PLATFORM, arch=$ARCH, pgo_artifact=$PGO_ARTIFACT_NAME"
1515

16+
# Install and use minimum required Rust version (1.87.0+ required by mach bootstrap)
17+
RUST_VERSION="1.87.0"
18+
rustup toolchain install "$RUST_VERSION"
19+
rustup default "$RUST_VERSION"
20+
1621
if [[ "$PLATFORM" == "windows" ]]; then
17-
rustup default 1.86.0
18-
rustup target add x86_64-pc-windows-msvc
22+
rustup target add x86_64-pc-windows-msvc --toolchain "$RUST_VERSION"
1923
elif [[ "$PLATFORM" == "linux" ]]; then
2024
if [[ "$ARCH" == "aarch64" ]]; then
21-
rustup default 1.86.0
22-
rustup target add aarch64-unknown-linux-gnu
25+
rustup target add aarch64-unknown-linux-gnu --toolchain "$RUST_VERSION"
2326
else
24-
rustup default 1.86.0
25-
rustup target add x86_64-unknown-linux-gnu
27+
rustup target add x86_64-unknown-linux-gnu --toolchain "$RUST_VERSION"
2628
fi
2729
elif [[ "$PLATFORM" == "mac" ]]; then
2830
if [[ "$ARCH" == "x86_64" ]]; then
@@ -33,36 +35,16 @@ elif [[ "$PLATFORM" == "mac" ]]; then
3335

3436
echo "Mac target: $TARGET"
3537

36-
# Install and configure Rust toolchain for PGO builds
37-
if [[ -n "$PGO_ARTIFACT_NAME" ]]; then
38-
echo "PGO build detected - installing Rust 1.86.0"
39-
rustup toolchain install 1.86.0
40-
rustup default 1.86.0
41-
# Add target to the specific toolchain
42-
rustup target add "$TARGET" --toolchain 1.86.0
43-
44-
# Verify target is installed for 1.86.0 toolchain
45-
echo "Verifying Rust target installation for 1.86.0:"
46-
rustup target list --toolchain 1.86.0 --installed | grep "$TARGET" || {
47-
echo "ERROR: Target $TARGET not found in 1.86.0 toolchain"
48-
echo "Attempting to add target again..."
49-
rustup target add "$TARGET" --toolchain 1.86.0
50-
}
51-
else
52-
echo "Non-PGO build - using stable toolchain"
53-
# Ensure we have stable toolchain
54-
rustup default stable
55-
# Add target to stable toolchain
56-
rustup target add "$TARGET"
38+
# Add target to the specific toolchain
39+
rustup target add "$TARGET" --toolchain "$RUST_VERSION"
5740

58-
# Verify target is installed for stable toolchain
59-
echo "Verifying Rust target installation for stable:"
60-
rustup target list --installed | grep "$TARGET" || {
61-
echo "ERROR: Target $TARGET not found in stable toolchain"
62-
echo "Attempting to add target again..."
63-
rustup target add "$TARGET"
64-
}
65-
fi
41+
# Verify target is installed
42+
echo "Verifying Rust target installation for $RUST_VERSION:"
43+
rustup target list --toolchain "$RUST_VERSION" --installed | grep "$TARGET" || {
44+
echo "ERROR: Target $TARGET not found in $RUST_VERSION toolchain"
45+
echo "Attempting to add target again..."
46+
rustup target add "$TARGET" --toolchain "$RUST_VERSION"
47+
}
6648
fi
6749

6850
echo "Rust configuration complete:"

0 commit comments

Comments
 (0)