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.
This commit is contained in:
Olaoluwa Osuntokun
2025-10-20 15:58:27 +01:00
parent a315ad3b50
commit 2ccf4b9806

View File

@@ -8,9 +8,31 @@ runs:
shell: bash shell: bash
run: | run: |
echo "Removing large toolsets to free up disk space..." echo "Removing large toolsets to free up disk space..."
echo "Disk space before cleanup:"
df -h
# Remove dotnet to save disk space. # Remove dotnet to save disk space.
sudo rm -rf /usr/share/dotnet sudo rm -rf /usr/share/dotnet
# Remove android to save disk space. # Remove android to save disk space.
sudo rm -rf /usr/local/lib/android sudo rm -rf /usr/local/lib/android
# Remove ghc to save disk space. # Remove ghc to save disk space.
sudo rm -rf /opt/ghc 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