Skip to content
Merged
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
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,10 @@ jobs:
with:
fetch-depth: 2

# Free up disk space on Linux by removing preinstalled components that
# we do not need. We do this to enable some of the less resource
# intensive jobs to run on free runners, which however also have
# less disk space.
# Free up disk space on Linux or macOS by removing preinstalled components that
# we do not need.
- name: free up disk space
run: src/ci/scripts/free-disk-space-linux.sh
run: src/ci/scripts/free-disk-space.sh
Comment thread
jieyouxu marked this conversation as resolved.
Resolved
if: matrix.free_disk

# If we don't need to free up disk space then just report how much space we have
Expand Down
74 changes: 67 additions & 7 deletions src/ci/github-actions/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ runners:

- &job-macos-15
os: macos-15 # macOS 15 Arm64
free_disk: true
<<: *base-job

- &job-macos-26
os: macos-26 # macOS 26 Arm64
free_disk: true # See https://github.com/rust-lang/infra-team/issues/307
<<: *base-job

- &job-windows
Expand Down Expand Up @@ -561,15 +567,41 @@ auto:
CODEGEN_BACKENDS: llvm,cranelift
<<: *job-macos-15

# - name: test-aarch64-apple-1
- name: test-aarch64-apple-1
env:
# NOTE: keep in sync with `src/ci/docker/scripts/stage_2_test_set1.sh`
SCRIPT: >-
./x.py --stage 2 test
--host=aarch64-apple-darwin
--target=aarch64-apple-darwin
--skip compiler
--skip src
RUST_CONFIGURE_ARGS: >-
--enable-sanitizers
--enable-profiler
--set build.allocator=jemalloc
DEVELOPER_DIR: /Applications/Xcode_26.2.app/Contents/Developer
# Aarch64 tooling only needs to support macOS 11.0 and up as nothing else
# supports the hardware, so only need to test it there.
MACOSX_DEPLOYMENT_TARGET: 11.0
MACOSX_STD_DEPLOYMENT_TARGET: 11.0
<<: *job-macos-15

# - name: test-aarch64-apple-2
# env:
# # NOTE: keep in sync with `src/ci/docker/scripts/stage_2_test_set1.sh`
# # NOTE: keep in sync with `src/ci/docker/scripts/stage_2_test_set2.sh`,
# # union `src/tools/cargo` specifically.
# SCRIPT: >-
# ./x.py --stage 2 test
# --host=aarch64-apple-darwin
# --target=aarch64-apple-darwin
# --skip compiler
# --skip src
# --skip tests
# --skip library
# --skip tidyselftest
# && ./x.py --stage 2 test
# --host=aarch64-apple-darwin
# --target=aarch64-apple-darwin
# src/tools/cargo
# RUST_CONFIGURE_ARGS: >-
# --enable-sanitizers
# --enable-profiler
Expand All @@ -580,8 +612,36 @@ auto:
# MACOSX_DEPLOYMENT_TARGET: 11.0
# MACOSX_STD_DEPLOYMENT_TARGET: 11.0
# <<: *job-macos-15
#
# - name: test-aarch64-apple-2

# EXPERIMENT(#157687): we will try to run `aarch64-apple`-equivalent workload
# on `macos-26` runner images in parallel to evaluate the running times, since
# previous attempts have timed out multiple times. Remove/revert this job if
# this hangs or times out, or if it becomes the slowest Merge CI job, and let
# T-infra know.
# See also #165148
- name: test-aarch64-apple-macos-26-1
doc_url: https://github.com/rust-lang/rust/issues/157687
env:
# NOTE: keep in sync with `src/ci/docker/scripts/stage_2_test_set1.sh`
SCRIPT: >-
./x.py --stage 2 test
--host=aarch64-apple-darwin
--target=aarch64-apple-darwin
--skip compiler
--skip src
RUST_CONFIGURE_ARGS: >-
--enable-sanitizers
--enable-profiler
--set build.allocator=jemalloc
DEVELOPER_DIR: /Applications/Xcode_26.2.app/Contents/Developer
# Aarch64 tooling only needs to support macOS 11.0 and up as nothing else
# supports the hardware, so only need to test it there.
MACOSX_DEPLOYMENT_TARGET: 11.0
MACOSX_STD_DEPLOYMENT_TARGET: 11.0
<<: *job-macos-26

# - name: test-aarch64-apple-macos-26-2
# doc_url: https://github.com/rust-lang/rust/issues/157687
# env:
# # NOTE: keep in sync with `src/ci/docker/scripts/stage_2_test_set2.sh`,
# # union `src/tools/cargo` specifically.
Expand All @@ -605,7 +665,7 @@ auto:
# # supports the hardware, so only need to test it there.
# MACOSX_DEPLOYMENT_TARGET: 11.0
# MACOSX_STD_DEPLOYMENT_TARGET: 11.0
# <<: *job-macos-15
# <<: *job-macos-26

######################
# Windows Builders #
Expand Down
43 changes: 43 additions & 0 deletions src/ci/scripts/free-disk-space-mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
set -euo pipefail
# ignore-tidy-file-linelength

# Free disk space on macOS GitHub action runners
# Achieved by removing all iOS simulator instance files and runtime images
# See https://developer.apple.com/documentation/xcode/xcode-command-line-tool-reference#Manage-the-Simulator

echo "Before clean-up:"
df -h

echo "deleting iOS simulator instance files and runtime images"

space_before=$(df -k "$GITHUB_WORKSPACE" | awk 'NR == 2 {print $4}')

xcrun simctl shutdown all
xcrun simctl delete all

# This subcommand runs asynchronously
xcrun simctl runtime delete all

# Wait a max of 60 seconds to ensure the clean-up is done before any subsequential build steps
for ((attempt = 0; attempt < 30; attempt++)); do
remaining=$(xcrun simctl runtime list -j | jq -e 'length')
echo "Remaining simulator runtime images: $remaining"

if [[ "$remaining" == 0 ]]; then
break
fi
sleep 2
done

if [[ "$remaining" != 0 ]]; then
echo "::warning::Simulator runtime deletion did not finish within the polling period."
fi

# Report net increase in available disk space
space_after=$(df -k "$GITHUB_WORKSPACE" | awk 'NR == 2 {print $4}')
extra_space=$(awk -v b="$space_before" -v a="$space_after" 'BEGIN { printf "%.2f", (a - b) / 1048576 }')
echo "Increase in available disk space: $extra_space GiB"

echo "After clean-up:"
df -h
18 changes: 18 additions & 0 deletions src/ci/scripts/free-disk-space.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail

script_dir=$(cd -- "$(dirname -- "$0")" && pwd)

# dispatch according to the Github Runner
case "${RUNNER_OS:-}" in
Linux)
exec "${script_dir}/free-disk-space-linux.sh"
;;
macOS)
exec "${script_dir}/free-disk-space-mac.sh"
;;
*)
echo "::error:: freeing disk space not supported for: '${RUNNER_OS:-unset}'"
exit 1
;;
esac
Loading