From 2ccf4b98064afa1e5520d62dd5209cfbcd42b882 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 20 Oct 2025 15:58:27 +0100 Subject: [PATCH 1/3] 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 From b82ed88be58c06c78085021c47c190d5f27468a3 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 20 Oct 2025 15:58:42 +0100 Subject: [PATCH 2/3] ci: use enhanced cleanup action in release workflow In this commit, we replace the basic inline cleanup command in the release workflow with the comprehensive cleanup-space action that was previously only used in the main CI workflow. The previous release workflow cleanup simply removed the hostedtoolcache directory, which freed only a few gigabytes and proved insufficient for multi-platform release builds. By switching to the cleanup-space action (now enhanced to free 20-25GB), the release workflow will have substantially more disk space available before beginning the build process. This should resolve the disk space exhaustion issues that were occurring during the Windows ARM build phase, which is one of the final platforms in the 15-platform build sequence. --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 974ff84ae..0e450de38 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -28,7 +28,7 @@ jobs: fetch-depth: 0 - name: cleanup space - run: rm -rf /opt/hostedtoolcache && mkdir -p /opt/hostedtoolcache/go + uses: ./.github/actions/cleanup-space - name: setup go ${{ env.GO_VERSION }} uses: actions/setup-go@v5 From dfee57023ce87d3c2dd21ead02285a4bbc41de76 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 20 Oct 2025 15:58:56 +0100 Subject: [PATCH 3/3] build: clear Go cache between platform builds in release script In this commit, we add a call to "go clean -cache" after each platform build in the release script to prevent the Go build cache from accumulating unbounded disk space during the sequential 15-platform build process. When building for multiple platforms in sequence with "go build -v", Go creates intermediate build artifacts and caches compiled packages for each target platform. While this caching improves build performance within a single platform build, it causes the cache to grow substantially when building for many platforms sequentially. With 15 different platform/ architecture combinations, each with their own cached artifacts, this accumulation was contributing to the disk space exhaustion. By clearing the build cache after each platform completes, we prevent this unbounded growth while still allowing each individual platform build to benefit from caching during its own compilation. The module cache is preserved (we only clear the build cache), so dependencies don't need to be re-downloaded between platforms. --- scripts/release.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/release.sh b/scripts/release.sh index 3ae8c1ec7..56b7c3cb3 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -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 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 # of a single installed binary. shasum -a 256 "${dir}/"* >> "manifest-$tag.txt"