Skip to content

Instantly share code, notes, and snippets.

@zfdang
Last active May 27, 2020 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zfdang/7d3d29fb0fe7559ef8798ec28d128659 to your computer and use it in GitHub Desktop.
Save zfdang/7d3d29fb0fe7559ef8798ec28d128659 to your computer and use it in GitHub Desktop.
Ubuntu Runner Disk Cleanup Script - Github Workflow Actions
name: Build_x86_64
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-18.04
steps :
- name: Disk Space cleanup
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt-get update
docker rmi `docker images -q`
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php*
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
echo "======================="
echo "Space usage:"
df -h
@zfdang
Copy link
Author

zfdang commented May 26, 2020

50G is available for runner, which should be sufficient for most jobs.

=======================
Space usage:
Filesystem Size Used Avail Use% Mounted on
udev 3.4G 0 3.4G 0% /dev
tmpfs 693M 928K 692M 1% /run
/dev/sda1 84G 34G 50G 41% /
tmpfs 3.4G 8.0K 3.4G 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.4G 0 3.4G 0% /sys/fs/cgroup
/dev/loop0 40M 40M 0 100% /snap/hub/43
/dev/loop1 94M 94M 0 100% /snap/core/9066
/dev/sda15 105M 3.6M 101M 4% /boot/efi
/dev/sdb1 14G 41M 13G 1% /mnt

@zfdang
Copy link
Author

zfdang commented May 27, 2020

Right now, the GitHub-hosted runners only have 14GB of disk space available , making it insufficient to build larger projects without resorting to using a self-hosted runner

But we can remove unused packages and folder to save disk size for our jobs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment