diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f15a9fcd59124..3e45ac01331ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 if: matrix.free_disk # If we don't need to free up disk space then just report how much space we have diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 8ee042c415322..68298870cf739 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -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 @@ -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 @@ -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. @@ -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 # diff --git a/src/ci/scripts/free-disk-space-mac.sh b/src/ci/scripts/free-disk-space-mac.sh new file mode 100755 index 0000000000000..b67222ef9210c --- /dev/null +++ b/src/ci/scripts/free-disk-space-mac.sh @@ -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 diff --git a/src/ci/scripts/free-disk-space.sh b/src/ci/scripts/free-disk-space.sh new file mode 100755 index 0000000000000..76e0140806e93 --- /dev/null +++ b/src/ci/scripts/free-disk-space.sh @@ -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