From 3532d9bc33fadf228272d3a2aff62cd2ece11037 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 17 Nov 2025 12:52:16 +1300 Subject: [PATCH 01/10] Try reintroducing free disk space task for containers --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e14ccf55e..5dc42333de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -127,7 +127,6 @@ jobs: fetch-depth: 2 # default is 1 and codecov needs > 1 - name: Remove unused applications - if: ${{ !matrix.container }} uses: ./.github/actions/freediskspace - name: Setup Environment From f3838b2061cc9a66825e7607c77849d5d5815288 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Mon, 17 Nov 2025 13:29:31 +1300 Subject: [PATCH 02/10] relax `df` so it will work on containers --- .github/actions/freediskspace/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/freediskspace/action.yml b/.github/actions/freediskspace/action.yml index f7fd4ce241..10baac98dc 100644 --- a/.github/actions/freediskspace/action.yml +++ b/.github/actions/freediskspace/action.yml @@ -23,7 +23,7 @@ runs: if: runner.os == 'Linux' shell: bash run: | - df -h /dev/root + df -h /dev/root 2>/dev/null || df -h sudo rm -rf /usr/local/.ghcup sudo rm -rf /usr/local/julia1.10.5 sudo rm -rf /usr/lib/heroku @@ -32,4 +32,4 @@ runs: sudo apt-get remove -y '^mysql-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding..." sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..." sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..." - df -h /dev/root + df -h /dev/root 2>/dev/null || df -h From e0831caa66b4bcb36d564d1f68943fd82424be26 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 9 Dec 2025 13:47:59 +1300 Subject: [PATCH 03/10] Clean unused native builds when building for Alpine containers --- .github/workflows/build.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5dc42333de..38972a696f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -195,6 +195,27 @@ jobs: fail-on-cache-miss: true enableCrossOsArchive: true + # To avoid disk space issues on the alpine containers, we clean unused native builds + - name: Clean up unused native builds + if: ${{ contains(matrix.container.image, 'alpine') }} + run: | + echo "Disk usage before cleanup:" + df -h + echo "Native build sizes:" + du -sh src/Sentry/Platforms/Native/sentry-native/build-* 2>/dev/null || echo "No builds found yet" + + # Keep only the current RID's native build, remove all others + if [ "${{ matrix.rid }}" = "linux-musl-x64" ]; then + find src/Sentry/Platforms/Native/sentry-native -type d -name "build-*" ! -name "*musl-x64*" -exec rm -rf {} + || true + elif [ "${{ matrix.rid }}" = "linux-musl-arm64" ]; then + find src/Sentry/Platforms/Native/sentry-native -type d -name "build-*" ! -name "*musl-arm64*" -exec rm -rf {} + || true + fi + + echo "Disk usage after cleanup:" + df -h + echo "Remaining native builds:" + ls -lh src/Sentry/Platforms/Native/sentry-native/ 2>/dev/null || echo "Directory not found" + - name: Build Native Dependencies if: ${{ !matrix.container }} uses: ./.github/actions/buildnative From d6f5edf5ee0a544a227ef0f5f0a17998f0adc24a Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 9 Dec 2025 15:24:10 +1300 Subject: [PATCH 04/10] . --- .github/actions/freediskspace/action.yml | 37 +++++++++++++++++++--- .github/workflows/build.yml | 39 +++++++++++------------- 2 files changed, 50 insertions(+), 26 deletions(-) diff --git a/.github/actions/freediskspace/action.yml b/.github/actions/freediskspace/action.yml index 10baac98dc..1f8c8430e5 100644 --- a/.github/actions/freediskspace/action.yml +++ b/.github/actions/freediskspace/action.yml @@ -23,13 +23,40 @@ runs: if: runner.os == 'Linux' shell: bash run: | + echo "Disk usage before cleanup:" df -h /dev/root 2>/dev/null || df -h - sudo rm -rf /usr/local/.ghcup - sudo rm -rf /usr/local/julia1.10.5 - sudo rm -rf /usr/lib/heroku - sudo rm -rf /opt/hostedtoolcache/go - sudo rm -rf /opt/hostedtoolcache/Ruby + + # Remove language runtimes and tools + sudo rm -rf /usr/local/.ghcup || echo "::warning::Failed to remove .ghcup" + sudo rm -rf /usr/local/julia1.10.5 || echo "::warning::Failed to remove Julia" + sudo rm -rf /usr/lib/heroku || echo "::warning::Failed to remove Heroku" + sudo rm -rf /opt/hostedtoolcache/go || echo "::warning::Failed to remove Go" + sudo rm -rf /opt/hostedtoolcache/Ruby || echo "::warning::Failed to remove Ruby" + + # Remove multiple LLVM versions (keep only one if needed) + sudo rm -rf /usr/lib/llvm-13 || echo "::warning::Failed to remove LLVM 13" + sudo rm -rf /usr/lib/llvm-14 || echo "::warning::Failed to remove LLVM 14" + sudo rm -rf /usr/lib/llvm-15 || echo "::warning::Failed to remove LLVM 15" + + # Remove Azure CLI + sudo rm -rf /opt/az || echo "::warning::Failed to remove Azure CLI" + + # Remove unnecessary .NET SDKs (keep only what we need) + sudo rm -rf /usr/share/dotnet/sdk/6.* || echo "::warning::Failed to remove .NET SDK 6.x" + sudo rm -rf /usr/share/dotnet/sdk/7.* || echo "::warning::Failed to remove .NET SDK 7.x" + + # Remove other large tools + sudo rm -rf /opt/hostedtoolcache/CodeQL || echo "::warning::Failed to remove CodeQL" + sudo rm -rf /usr/local/share/chromium || echo "::warning::Failed to remove Chromium" + sudo rm -rf /usr/local/share/chrome_driver || echo "::warning::Failed to remove Chrome Driver" + sudo rm -rf /usr/local/share/gecko_driver || echo "::warning::Failed to remove Gecko Driver" + + # Clean up apt packages sudo apt-get remove -y '^mysql-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding..." + sudo apt-get remove -y '^postgresql-.*' --fix-missing || echo "::warning::PostgreSQL removal failed" + sudo apt-get remove -y '^mongodb-.*' --fix-missing || echo "::warning::MongoDB removal failed" sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..." sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..." + + echo "Disk usage after cleanup:" df -h /dev/root 2>/dev/null || df -h diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38972a696f..81de26a5b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -195,27 +195,6 @@ jobs: fail-on-cache-miss: true enableCrossOsArchive: true - # To avoid disk space issues on the alpine containers, we clean unused native builds - - name: Clean up unused native builds - if: ${{ contains(matrix.container.image, 'alpine') }} - run: | - echo "Disk usage before cleanup:" - df -h - echo "Native build sizes:" - du -sh src/Sentry/Platforms/Native/sentry-native/build-* 2>/dev/null || echo "No builds found yet" - - # Keep only the current RID's native build, remove all others - if [ "${{ matrix.rid }}" = "linux-musl-x64" ]; then - find src/Sentry/Platforms/Native/sentry-native -type d -name "build-*" ! -name "*musl-x64*" -exec rm -rf {} + || true - elif [ "${{ matrix.rid }}" = "linux-musl-arm64" ]; then - find src/Sentry/Platforms/Native/sentry-native -type d -name "build-*" ! -name "*musl-arm64*" -exec rm -rf {} + || true - fi - - echo "Disk usage after cleanup:" - df -h - echo "Remaining native builds:" - ls -lh src/Sentry/Platforms/Native/sentry-native/ 2>/dev/null || echo "Directory not found" - - name: Build Native Dependencies if: ${{ !matrix.container }} uses: ./.github/actions/buildnative @@ -237,6 +216,24 @@ jobs: build.binlog if-no-files-found: ignore + - name: Free disk space before tests + if: ${{ contains(matrix.container.image, 'alpine') }} + run: | + echo "Disk usage before cleanup:" + df -h + + # Remove build binlog (can be large) + rm -f build.binlog || true + + # Clean NuGet cache to free space + dotnet nuget locals all --clear || true + + # Remove obj directories (not needed for tests since we built with --no-build) + find . -type d -name "obj" -exec rm -rf {} + 2>/dev/null || true + + echo "Disk usage after cleanup:" + df -h + - name: Test run: dotnet test ${{ matrix.slnf }} -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage" From a6fce276452dfb9b9ee1ae6f371dc20938363ca3 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Tue, 9 Dec 2025 16:43:41 +1300 Subject: [PATCH 05/10] . --- .github/workflows/build.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81de26a5b6..4788d26fd2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -222,14 +222,11 @@ jobs: echo "Disk usage before cleanup:" df -h - # Remove build binlog (can be large) + # Remove build binlog (can be large, often 100MB+) rm -f build.binlog || true - # Clean NuGet cache to free space - dotnet nuget locals all --clear || true - - # Remove obj directories (not needed for tests since we built with --no-build) - find . -type d -name "obj" -exec rm -rf {} + 2>/dev/null || true + # Clean up NuGet HTTP cache (not the packages cache which is needed for pack) + dotnet nuget locals http-cache --clear || true echo "Disk usage after cleanup:" df -h From 10374359bd896b68fbc0a355bf35a6ba5d50f623 Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Wed, 10 Dec 2025 20:51:13 +1300 Subject: [PATCH 06/10] Update .github/actions/freediskspace/action.yml --- .github/actions/freediskspace/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/freediskspace/action.yml b/.github/actions/freediskspace/action.yml index 1f8c8430e5..01fd1dc335 100644 --- a/.github/actions/freediskspace/action.yml +++ b/.github/actions/freediskspace/action.yml @@ -33,7 +33,7 @@ runs: sudo rm -rf /opt/hostedtoolcache/go || echo "::warning::Failed to remove Go" sudo rm -rf /opt/hostedtoolcache/Ruby || echo "::warning::Failed to remove Ruby" - # Remove multiple LLVM versions (keep only one if needed) + # Remove multiple LLVM versions sudo rm -rf /usr/lib/llvm-13 || echo "::warning::Failed to remove LLVM 13" sudo rm -rf /usr/lib/llvm-14 || echo "::warning::Failed to remove LLVM 14" sudo rm -rf /usr/lib/llvm-15 || echo "::warning::Failed to remove LLVM 15" From 2dc7ca622cba68202312fcfbeb7052fcfabcf23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6lz?= <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 10 Dec 2025 08:57:53 +0100 Subject: [PATCH 07/10] ci: cleanup obsolete comment --- .github/actions/freediskspace/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/freediskspace/action.yml b/.github/actions/freediskspace/action.yml index 01fd1dc335..f623c39662 100644 --- a/.github/actions/freediskspace/action.yml +++ b/.github/actions/freediskspace/action.yml @@ -19,7 +19,9 @@ runs: # 514M /usr/lib/llvm-15 # 486M /usr/lib/llvm-14 # 448M /usr/lib/llvm-13 - - name: Remove unused applications +swap-storage: true + +- name: Remove unused applications if: runner.os == 'Linux' shell: bash run: | From b4486c3c9a7b29a8e2b1055b9eb53f083e17e708 Mon Sep 17 00:00:00 2001 From: Flash0ver <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 10 Dec 2025 09:00:03 +0100 Subject: [PATCH 08/10] Revert "ci: cleanup obsolete comment" This reverts commit 2dc7ca622cba68202312fcfbeb7052fcfabcf23b. --- .github/actions/freediskspace/action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/freediskspace/action.yml b/.github/actions/freediskspace/action.yml index f623c39662..01fd1dc335 100644 --- a/.github/actions/freediskspace/action.yml +++ b/.github/actions/freediskspace/action.yml @@ -19,9 +19,7 @@ runs: # 514M /usr/lib/llvm-15 # 486M /usr/lib/llvm-14 # 448M /usr/lib/llvm-13 -swap-storage: true - -- name: Remove unused applications + - name: Remove unused applications if: runner.os == 'Linux' shell: bash run: | From 499e7e1e9eb84ffe3e36615198cb2c2e05a3eac9 Mon Sep 17 00:00:00 2001 From: Flash0ver <38893694+Flash0ver@users.noreply.github.com> Date: Wed, 10 Dec 2025 09:00:33 +0100 Subject: [PATCH 09/10] ci: cleanup obsolete comment --- .github/actions/freediskspace/action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/actions/freediskspace/action.yml b/.github/actions/freediskspace/action.yml index 01fd1dc335..e1db6f647c 100644 --- a/.github/actions/freediskspace/action.yml +++ b/.github/actions/freediskspace/action.yml @@ -15,10 +15,6 @@ runs: docker-images: true swap-storage: true - # TODO: Do we need all of these or just one? - # 514M /usr/lib/llvm-15 - # 486M /usr/lib/llvm-14 - # 448M /usr/lib/llvm-13 - name: Remove unused applications if: runner.os == 'Linux' shell: bash From 7970193935df918218209720eaf2ad102f9bc65d Mon Sep 17 00:00:00 2001 From: James Crosswell Date: Thu, 11 Dec 2025 08:47:42 +1300 Subject: [PATCH 10/10] . --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4788d26fd2..d7c0ac7db6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -127,6 +127,7 @@ jobs: fetch-depth: 2 # default is 1 and codecov needs > 1 - name: Remove unused applications + if: ${{ !matrix.container }} uses: ./.github/actions/freediskspace - name: Setup Environment