From 782a9569ebcf0cbab0833ccfb3b50b18e809fc77 Mon Sep 17 00:00:00 2001 From: Viktor Torstensson Date: Tue, 9 Dec 2025 19:31:39 +0100 Subject: [PATCH 1/3] main.yml: bump `actions/checkout` to v5 --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a833af7..a729083 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: runs-on: ubuntu-latest steps: - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 - name: go cache uses: actions/cache@v3 @@ -68,7 +68,7 @@ jobs: runs-on: ubuntu-latest steps: - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 with: fetch-depth: 0 @@ -106,7 +106,7 @@ jobs: - unit-race steps: - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 - name: go cache uses: actions/cache@v3 @@ -135,7 +135,7 @@ jobs: runs-on: ubuntu-latest steps: - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 - name: go cache uses: actions/cache@v3 From 62bbc22593674298222ec503f137a9185bd8c92c Mon Sep 17 00:00:00 2001 From: Viktor Torstensson Date: Tue, 9 Dec 2025 19:21:17 +0100 Subject: [PATCH 2/3] ci: add GitHub action(s) to clean up runner disk space Define composite actions to remove large toolsets, unused packages, Docker images, and caches from the GitHub runner, freeing up disk space for builds. Note that the content of the cleanup-space/actions.yaml file is copied from the following `tapd` PR: https://github.com/lightninglabs/taproot-assets/pull/1878 There's one distinct difference from the `tapd` file. In this repo, we separate the cleanup of the android folder into a separate action. The reason for this separation is that we need to be able to control when the android folder is cleaned up, during the job, as some jobs will fail if the android folder is removed in the beginning of the job. Not all of the targeted files when running the script, should ever have been used when building the binaries for LNC, but we keep the script consistent between the repos for simplicity. --- .github/actions/cleanup-android/action.yaml | 12 ++++++ .github/actions/cleanup-space/action.yaml | 48 +++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .github/actions/cleanup-android/action.yaml create mode 100644 .github/actions/cleanup-space/action.yaml diff --git a/.github/actions/cleanup-android/action.yaml b/.github/actions/cleanup-android/action.yaml new file mode 100644 index 0000000..0abab82 --- /dev/null +++ b/.github/actions/cleanup-android/action.yaml @@ -0,0 +1,12 @@ +name: "Clean up android sdk/ndk" +description: "Removes Android SDK/NDK to free up disk space on the runner." + +runs: + using: "composite" + steps: + - name: Remove android toolchain + shell: bash + run: | + echo "Removing android toolchain to free up disk space..." + sudo rm -rf /usr/local/lib/android + df -h diff --git a/.github/actions/cleanup-space/action.yaml b/.github/actions/cleanup-space/action.yaml new file mode 100644 index 0000000..cd44fd1 --- /dev/null +++ b/.github/actions/cleanup-space/action.yaml @@ -0,0 +1,48 @@ +name: "Clean up runner disk space" +description: "Removes large, non-essential toolsets to free up disk space on the runner." + +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 dotnet to save disk space. + sudo rm -rf /usr/share/dotnet + # 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 4bff74960f0be6fc507f5ddf5bd4204d028d4f7b Mon Sep 17 00:00:00 2001 From: Viktor Torstensson Date: Tue, 9 Dec 2025 19:33:29 +0100 Subject: [PATCH 3/3] ci: execute cleanup commands in CI jobs Update workflows to use the new `cleanup-space` composite action for clearing runner disk space. Note that in the "build package and wasm" job, the cleanup of the android build folder is done after the rest of the step is completed, as the contents of the folder are needed during the "android compile" step. --- .github/workflows/main.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a729083..151e68b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -29,6 +29,9 @@ jobs: - name: git checkout uses: actions/checkout@v5 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + - name: go cache uses: actions/cache@v3 with: @@ -60,6 +63,9 @@ jobs: - name: wasm compile run: make wasm + - name: Clean up runner space (android) + uses: ./.github/actions/cleanup-android + ######################## # lint code ######################## @@ -72,6 +78,12 @@ jobs: with: fetch-depth: 0 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + + - name: Clean up runner space (android) + uses: ./.github/actions/cleanup-android + - name: go cache uses: actions/cache@v3 with: @@ -108,6 +120,12 @@ jobs: - name: git checkout uses: actions/checkout@v5 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + + - name: Clean up runner space (android) + uses: ./.github/actions/cleanup-android + - name: go cache uses: actions/cache@v3 with: @@ -137,6 +155,12 @@ jobs: - name: git checkout uses: actions/checkout@v5 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + + - name: Clean up runner space (android) + uses: ./.github/actions/cleanup-android + - name: go cache uses: actions/cache@v3 with: