Skip to content

Commit b0a9958

Browse files
[skip ci] Save disk space on GitHub-hosted macOS runner
1 parent 8f0ee52 commit b0a9958

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

.github/scripts/build-matrix.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"run_e2e_test": true,
9595
"build_hello_wasm": true,
9696
"clean_build_dir": true,
97+
"free_disk_space": true,
9798
"only_swift_sdk": false,
9899
},
99100
{

.github/workflows/build-toolchain.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
runs-on: ${{ matrix.agent_query }}
122122
steps:
123123
- name: Free disk space
124-
if: ${{ matrix.free_disk_space }}
124+
if: ${{ matrix.free_disk_space && !startsWith(matrix.build_os, 'macos-') }}
125125
run: |
126126
df -h
127127
sudo rm -rf /opt/hostedtoolcache
@@ -133,6 +133,18 @@ jobs:
133133
fi
134134
df -h
135135
136+
- name: Free disk space by removing unused Xcode
137+
if: ${{ matrix.free_disk_space && startsWith(matrix.build_os, 'macos-') }}
138+
run: |
139+
IN_USE_XCODE=$(xcode-select -p)
140+
echo "Removing all Xcode installations except $IN_USE_XCODE"
141+
for xcode in /Applications/Xcode*.app; do
142+
if [[ $IN_USE_XCODE != "$xcode"* ]]; then
143+
echo "Removing $xcode"
144+
rm -rf $xcode
145+
fi
146+
done
147+
136148
- uses: actions/checkout@v4
137149
with:
138150
path: swiftwasm-build

0 commit comments

Comments
 (0)