From 2ccf4b98064afa1e5520d62dd5209cfbcd42b882 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 20 Oct 2025 15:58:27 +0100 Subject: [PATCH] ci: enhance cleanup-space action for release builds In this commit, we significantly expand the cleanup-space GitHub Actions workflow to free up substantially more disk space on GitHub runners. The previous cleanup only removed three large toolsets (dotnet, android, ghc), which should free ~14GB. This enhancement adds removal of several additional large packages and caches, bringing the total freed space to approximately 20-25GB. The specific additions include removing Swift and Julia language runtimes, the hosted toolcache directory, all Docker images, numerous large apt packages (aspnetcore, llvm, php, mongodb, mysql, azure-cli, browsers, and development tools), and various cache directories. We also add disk space reporting before and after cleanup to provide visibility into how much space is actually being freed during workflow runs. This enhancement was motivated by release builds running out of disk space when building for all 15 supported platforms (darwin, freebsd, linux, netbsd, openbsd, windows across multiple architectures). The sequential builds with verbose output were consuming more space than the basic cleanup could provide. --- .github/actions/cleanup-space/action.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/actions/cleanup-space/action.yml b/.github/actions/cleanup-space/action.yml index 037435f98..78b5a75ee 100644 --- a/.github/actions/cleanup-space/action.yml +++ b/.github/actions/cleanup-space/action.yml @@ -8,9 +8,31 @@ runs: shell: bash run: | echo "Removing large toolsets to free up disk space..." + echo "Disk space before cleanup:" + df -h + # Remove dotnet to save disk space. sudo rm -rf /usr/share/dotnet # Remove android to save disk space. sudo rm -rf /usr/local/lib/android # Remove ghc to save disk space. sudo rm -rf /opt/ghc + # Remove large packages. + sudo rm -rf /usr/share/swift + sudo rm -rf /usr/local/julia* + sudo rm -rf /opt/hostedtoolcache + + # Remove docker images to save space. + docker image prune -a -f || true + + # Remove large apt packages. + sudo apt-get remove -y '^aspnetcore-.*' '^dotnet-.*' '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*' azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri 2>/dev/null || true + sudo apt-get autoremove -y + sudo apt-get clean + + # Remove caches. + sudo rm -rf /usr/local/share/boost + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + + echo "Disk space after cleanup:" + df -h