-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Joe Runde <[email protected]>
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: "Free up disk space" | ||
description: "Removes non-essential tools, libraries and cached files from GitHub action runner node" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "Remove non-essential tools and libraries" | ||
shell: bash | ||
run: | | ||
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173 | ||
echo "Disk usage before cleanup:" | ||
df -h | ||
echo "Removing non-essential tools and libraries ..." | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf /usr/local/.ghcup | ||
sudo rm -rf /usr/share/dotnet | ||
# sudo rm -rf /usr/local/share/boost | ||
echo "Deleting libraries for Android (12G), CodeQL (5.3G), PowerShell (1.3G), Swift (1.7G) ..." | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf "${AGENT_TOOLSDIRECTORY}/CodeQL" | ||
sudo rm -rf /usr/local/share/powershell | ||
sudo rm -rf /usr/share/swift | ||
# ref: https://github.com/jlumbroso/free-disk-space/blob/main/action.yml | ||
echo "Deleting some larger apt packages:" | ||
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing || echo "::warning::The command [sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing] failed to complete successfully. Proceeding..." | ||
echo "Disk usage after cleanup:" | ||
df -h | ||
- name: "Prune docker images" | ||
shell: bash | ||
run: | | ||
echo "Pruning docker images ..." | ||
docker image prune -a -f | ||
docker system df | ||
echo "Disk usage after pruning docker images:" | ||
df -h |