-
Notifications
You must be signed in to change notification settings - Fork 709
ci: add script to free disk space #7534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| name: reclaim-storage | ||
| description: Remove unnecessary packages and artifacts from GitHub Actions Runner | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - shell: bash | ||
| run: make reclaim-storage |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| log() { echo "==> $*"; } | ||
|
|
||
| log "Initial disk usage:" | ||
| df -h || true | ||
|
|
||
| # Remove large, unused language/tool runtimes | ||
| TO_DELETE=( | ||
| /usr/local/lib/android | ||
| /usr/share/dotnet | ||
| /opt/ghc | ||
| /usr/local/.ghcup | ||
| /usr/share/swift | ||
|
Comment on lines
+11
to
+15
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shreealt Is there a reference somewhere for the dirs being removed here or a list of others we may want to consider?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ) | ||
|
|
||
| for path in "${TO_DELETE[@]}"; do | ||
| if [ -d "$path" ]; then | ||
| log "Removing $path" | ||
| sudo rm -rf "$path" | ||
| fi | ||
| done | ||
|
|
||
| log "Removing large packages..." | ||
| EXTRA_PKGS="azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri google-cloud-sdk google-cloud-cli" | ||
|
|
||
| sudo apt-get remove -y "$EXTRA_PKGS" --fix-missing || true | ||
| sudo apt-get autoremove -y || true | ||
| sudo apt-get clean || true | ||
|
|
||
| # Swap removal | ||
| if [ -f /mnt/swapfile ]; then | ||
| log "Disabling and removing swapfile" | ||
| sudo swapoff -a || true | ||
| sudo rm -f /mnt/swapfile || true | ||
| fi | ||
|
|
||
| log "Final disk usage:" | ||
| df -h || true | ||
|
|
||
| log "Completed disk space reclamation." | ||
Uh oh!
There was an error while loading. Please reload this page.