File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -121,12 +121,12 @@ jobs:
121121 with :
122122 fetch-depth : 2
123123
124- # Free up disk space on Linux by removing preinstalled components that
124+ # Free up disk space on Linux or macOS by removing preinstalled components that
125125 # we do not need. We do this to enable some of the less resource
126126 # intensive jobs to run on free runners, which however also have
127127 # less disk space.
128128 - name : free up disk space
129- run : src/ci/scripts/free-disk-space-linux .sh
129+ run : src/ci/scripts/free-disk-space.sh
130130 if : matrix.free_disk
131131
132132 # If we don't need to free up disk space then just report how much space we have
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ runners:
2121
2222 - &job-macos-26
2323 os : macos-26 # macOS 26 Arm64
24+ free_disk : true # See https://github.com/rust-lang/infra-team/issues/307
2425 << : *base-job
2526
2627 - &job-windows
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -euo pipefail
3+ # ignore-tidy-file-linelength
4+
5+ # Free disk space on macOS GitHub action runners
6+ # Achieved by removing all iOS simulator instance files and runtimes
7+ # See https://developer.apple.com/documentation/xcode/xcode-command-line-tool-reference#Manage-the-Simulator
8+
9+ space_before=$( df -k " $GITHUB_WORKSPACE " | awk ' NR == 2 {print $4}' )
10+
11+ xcrun simctl shutdown all
12+ xcrun simctl delete all
13+
14+ # This subcommand runs asynchronously
15+ xcrun simctl runtime delete all
16+
17+ # Wait a max of 60 seconds to ensure the clean-up is done before any subsequential build steps
18+ for (( attempt = 0 ; attempt < 30 ; attempt++ )) ; do
19+ remaining=$( xcrun simctl runtime list -j | jq ' length' )
20+ echo " Remaining runtime iOS simulator images : $remaining "
21+
22+ if [[ " $remaining " == 0 ]]; then
23+ break
24+ fi
25+ sleep 2
26+ done
27+
28+ if [[ " $remaining " != 0 ]]; then
29+ echo " ::warning::Runtime deletion did not finish within the polling period."
30+ fi
31+
32+ # Report net increase in available disk space
33+ space_after=$( df -k " $GITHUB_WORKSPACE " | awk ' NR == 2 {print $4}' )
34+ extra_space=$( awk -v b=" $space_before " -v a=" $space_after " ' BEGIN { printf "%.2f", (a - b) / 1048576 }' )
35+ echo " Increase in available disk space: $extra_space GiB"
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -euo pipefail
3+
4+ script_dir=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " && pwd)
5+
6+ # dispatch according to the Github Runner
7+ case " ${RUNNER_OS:- } " in
8+ Linux)
9+ exec " ${script_dir} /free-disk-space-linux.sh"
10+ ;;
11+ macOS)
12+ exec " ${script_dir} /free-disk-space-mac.sh"
13+ ;;
14+ * )
15+ echo " ::error:: freeing disk space not supported for : '${RUNNER_OS:- unset} '"
16+ exit 1
17+ ;;
18+ esac
You can’t perform that action at this time.
0 commit comments