Merge pull request #10306 from Roasbeef/free-release-space

build: fix disk space exhaustion in release builds
This commit is contained in:
Olaoluwa Osuntokun
2025-10-21 17:21:12 +01:00
committed by GitHub
3 changed files with 26 additions and 1 deletions

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

View File

@@ -28,7 +28,7 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: cleanup space - name: cleanup space
run: rm -rf /opt/hostedtoolcache && mkdir -p /opt/hostedtoolcache/go uses: ./.github/actions/cleanup-space
- name: setup go ${{ env.GO_VERSION }} - name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5 uses: actions/setup-go@v5

View File

@@ -193,6 +193,9 @@ required Go version ($goversion)."
env CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags="${ldflags}" -tags="${buildtags}" ${PKG}/cmd/lncli env CGO_ENABLED=0 GOOS=$os GOARCH=$arch GOARM=$arm go build -v -trimpath -ldflags="${ldflags}" -tags="${buildtags}" ${PKG}/cmd/lncli
popd popd
# Clear Go build cache to prevent disk space issues during multi-platform builds.
go clean -cache
# Add the hashes for the individual binaries as well for easy verification # Add the hashes for the individual binaries as well for easy verification
# of a single installed binary. # of a single installed binary.
shasum -a 256 "${dir}/"* >> "manifest-$tag.txt" shasum -a 256 "${dir}/"* >> "manifest-$tag.txt"