File tree Expand file tree Collapse file tree 4 files changed +55
-0
lines changed
github-actions/reclaim-storage Expand file tree Collapse file tree 4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ jobs:
159159 steps :
160160 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
161161 - uses : ./tools/github-actions/setup-deps
162+ - uses : ./tools/github-actions/reclaim-storage
162163
163164 - name : Download EG Binaries
164165 uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
Original file line number Diff line number Diff line change 1+ name : reclaim-storage
2+ description : Remove unnecessary packages and artifacts from GitHub Actions Runner
3+
4+ runs :
5+ using : composite
6+ steps :
7+ - shell : bash
8+ run : make reclaim-storage
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ log () { echo " ==> $* " ; }
5+
6+ log " Initial disk usage:"
7+ df -h || true
8+
9+ # Remove large, unused language/tool runtimes
10+ TO_DELETE=(
11+ /usr/local/lib/android
12+ /usr/share/dotnet
13+ /opt/ghc
14+ /usr/local/.ghcup
15+ /usr/share/swift
16+ )
17+
18+ for path in " ${TO_DELETE[@]} " ; do
19+ if [ -d " $path " ]; then
20+ log " Removing $path "
21+ sudo rm -rf " $path "
22+ fi
23+ done
24+
25+ log " Removing large packages..."
26+ EXTRA_PKGS=" azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri google-cloud-sdk google-cloud-cli"
27+
28+ sudo apt-get remove -y " $EXTRA_PKGS " --fix-missing || true
29+ sudo apt-get autoremove -y || true
30+ sudo apt-get clean || true
31+
32+ # Swap removal
33+ if [ -f /mnt/swapfile ]; then
34+ log " Disabling and removing swapfile"
35+ sudo swapoff -a || true
36+ sudo rm -f /mnt/swapfile || true
37+ fi
38+
39+ log " Final disk usage:"
40+ df -h || true
41+
42+ log " Completed disk space reclamation."
Original file line number Diff line number Diff line change @@ -54,3 +54,7 @@ tools.clean: # Remove all tools
5454.PHONY : clean
5555clean : # # Remove all files that are created during builds.
5656clean : tools.clean
57+
58+ .PHONY : reclaim-storage
59+ reclaim-storage : # # Removes unnecessary packages and artifacts from GitHub Actions Runner
60+ bash ./tools/hack/reclaim-storage.sh
You can’t perform that action at this time.
0 commit comments