lightning-terminal/.github/actions/cleanup-space/action.yml
Viktor Torstensson 4e72e798e6
docker: improve cleanup of docker space in CI
Mimic `lnd`s cleanup of docker space in CI by adding a new clean-space
job which removes the same docker related artifacts as `lnd` does prior
to running the rest of the docker.yml jobs.
2026-07-01 12:58:42 +02:00

48 lines
1.5 KiB
YAML

name: "Clean up runner disk space"
description: "Removes large, non-essential toolsets to free up disk space."
runs:
using: "composite"
steps:
- name: Free up disk space
shell: bash
run: |
echo "Removing large toolsets to free up disk space..."
echo "Disk space before cleanup:"
df -h
# Remove large language/runtime toolsets that aren't needed for the
# Docker image build on the GitHub-hosted runner.
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf /usr/share/swift
sudo rm -rf /usr/local/julia*
sudo rm -rf /opt/hostedtoolcache
# Reclaim any Docker images that may already be present on the runner.
docker image prune -a -f || true
# Remove large apt packages and clean related caches.
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 additional large caches and tool directories.
sudo rm -rf /usr/local/share/boost
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
echo "Disk space after cleanup:"
df -h