Skip to content

Commit b186caa

Browse files
fix: System.IO.IOException: No space left on device on linux-musl x64 (#4743)
1 parent c9378bb commit b186caa

File tree

2 files changed

+49
-11
lines changed

2 files changed

+49
-11
lines changed

.github/actions/freediskspace/action.yml

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,44 @@ runs:
1515
docker-images: true
1616
swap-storage: true
1717

18-
# TODO: Do we need all of these or just one?
19-
# 514M /usr/lib/llvm-15
20-
# 486M /usr/lib/llvm-14
21-
# 448M /usr/lib/llvm-13
2218
- name: Remove unused applications
2319
if: runner.os == 'Linux'
2420
shell: bash
2521
run: |
26-
df -h /dev/root
27-
sudo rm -rf /usr/local/.ghcup
28-
sudo rm -rf /usr/local/julia1.10.5
29-
sudo rm -rf /usr/lib/heroku
30-
sudo rm -rf /opt/hostedtoolcache/go
31-
sudo rm -rf /opt/hostedtoolcache/Ruby
22+
echo "Disk usage before cleanup:"
23+
df -h /dev/root 2>/dev/null || df -h
24+
25+
# Remove language runtimes and tools
26+
sudo rm -rf /usr/local/.ghcup || echo "::warning::Failed to remove .ghcup"
27+
sudo rm -rf /usr/local/julia1.10.5 || echo "::warning::Failed to remove Julia"
28+
sudo rm -rf /usr/lib/heroku || echo "::warning::Failed to remove Heroku"
29+
sudo rm -rf /opt/hostedtoolcache/go || echo "::warning::Failed to remove Go"
30+
sudo rm -rf /opt/hostedtoolcache/Ruby || echo "::warning::Failed to remove Ruby"
31+
32+
# Remove multiple LLVM versions
33+
sudo rm -rf /usr/lib/llvm-13 || echo "::warning::Failed to remove LLVM 13"
34+
sudo rm -rf /usr/lib/llvm-14 || echo "::warning::Failed to remove LLVM 14"
35+
sudo rm -rf /usr/lib/llvm-15 || echo "::warning::Failed to remove LLVM 15"
36+
37+
# Remove Azure CLI
38+
sudo rm -rf /opt/az || echo "::warning::Failed to remove Azure CLI"
39+
40+
# Remove unnecessary .NET SDKs (keep only what we need)
41+
sudo rm -rf /usr/share/dotnet/sdk/6.* || echo "::warning::Failed to remove .NET SDK 6.x"
42+
sudo rm -rf /usr/share/dotnet/sdk/7.* || echo "::warning::Failed to remove .NET SDK 7.x"
43+
44+
# Remove other large tools
45+
sudo rm -rf /opt/hostedtoolcache/CodeQL || echo "::warning::Failed to remove CodeQL"
46+
sudo rm -rf /usr/local/share/chromium || echo "::warning::Failed to remove Chromium"
47+
sudo rm -rf /usr/local/share/chrome_driver || echo "::warning::Failed to remove Chrome Driver"
48+
sudo rm -rf /usr/local/share/gecko_driver || echo "::warning::Failed to remove Gecko Driver"
49+
50+
# Clean up apt packages
3251
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..."
52+
sudo apt-get remove -y '^postgresql-.*' --fix-missing || echo "::warning::PostgreSQL removal failed"
53+
sudo apt-get remove -y '^mongodb-.*' --fix-missing || echo "::warning::MongoDB removal failed"
3354
sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..."
3455
sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..."
35-
df -h /dev/root
56+
57+
echo "Disk usage after cleanup:"
58+
df -h /dev/root 2>/dev/null || df -h

.github/workflows/build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,21 @@ jobs:
217217
build.binlog
218218
if-no-files-found: ignore
219219

220+
- name: Free disk space before tests
221+
if: ${{ contains(matrix.container.image, 'alpine') }}
222+
run: |
223+
echo "Disk usage before cleanup:"
224+
df -h
225+
226+
# Remove build binlog (can be large, often 100MB+)
227+
rm -f build.binlog || true
228+
229+
# Clean up NuGet HTTP cache (not the packages cache which is needed for pack)
230+
dotnet nuget locals http-cache --clear || true
231+
232+
echo "Disk usage after cleanup:"
233+
df -h
234+
220235
- name: Test
221236
run: dotnet test ${{ matrix.slnf }} -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"
222237

0 commit comments

Comments
 (0)