Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 34 additions & 7 deletions .github/actions/freediskspace/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,40 @@ runs:
if: runner.os == 'Linux'
shell: bash
run: |
df -h /dev/root
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
echo "Disk usage before cleanup:"
df -h /dev/root 2>/dev/null || df -h

# 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..."
df -h /dev/root

Comment on lines +50 to +56
Copy link
Member

@Flash0ver Flash0ver Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: We get these warnings during the build:

# .NET (linux-musl-x64)
The command [sudo apt-get clean] failed to complete successfully. Proceeding...
# .NET (linux-musl-x64)
The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding...
# .NET (linux-musl-x64)
MongoDB removal failed
# .NET (linux-musl-x64)
PostgreSQL removal failed
# .NET (linux-musl-x64)
The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding...

# .NET (linux-musl-arm64)
The command [sudo apt-get clean] failed to complete successfully. Proceeding...
# .NET (linux-musl-arm64)
The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding...
# .NET (linux-musl-arm64)
MongoDB removal failed
# .NET (linux-musl-arm64)
PostgreSQL removal failed
# .NET (linux-musl-arm64)
The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding...

Can we if-Condition to only run on supported platforms / not run on non-supported platforms (linux-musl-x64 and linux-musl-arm64)?
Maybe by splitting it into a step that does sudo rm, and another step that does the sudo apt-get (but not for Alpine Linux)?

Maybe something like:

- name: Remove unused packages
  if: ${{ !contains(matrix.container.image, 'alpine') }}
  run: |
    # Clean up apt packages
    sudo apt-get ...
    ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's pretty much what we had before:
image

I'll put that bit back since the freediskspace action is ineffective on the containers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I meant to just execute thesudo apt-get conditionally, since they produce the ::warning:: messages.
But keep the sudo rm on all Linux runners, since they seem to work just fine.

Copy link
Collaborator Author

@jamescrosswell jamescrosswell Dec 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah OK, we can tidy up the non-container runners in another PR if need be 👍🏻

echo "Disk usage after cleanup:"
df -h /dev/root 2>/dev/null || df -h
16 changes: 15 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -217,6 +216,21 @@ jobs:
build.binlog
if-no-files-found: ignore

- name: Free disk space before tests
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Cleanup action runs inside container, not on runner

The condition if: ${{ !matrix.container }} was removed from the "Remove unused applications" step. This causes the freediskspace action to run inside Alpine containers rather than being skipped. Since the PR aims to free space on the runner (not the container), running cleanup inside the container won't achieve the intended goal. Additionally, the freediskspace action uses Ubuntu-specific commands (apt-get) that don't exist in Alpine Linux (which uses apk). The original condition correctly prevented this action from running when a container is specified.

Fix in Cursor Fix in Web

if: ${{ contains(matrix.container.image, 'alpine') }}
run: |
echo "Disk usage before cleanup:"
df -h

# Remove build binlog (can be large, often 100MB+)
rm -f build.binlog || 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

- name: Test
run: dotnet test ${{ matrix.slnf }} -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"

Expand Down
Loading