From 6e2d04b86000775a7d54b6ff60dd08c2cec258f5 Mon Sep 17 00:00:00 2001 From: Jayant Shrivastava Date: Thu, 20 Nov 2025 16:33:58 -0500 Subject: [PATCH] free up disk space in CI runners This change frees up disk space in CI runners. See https://github.com/apache/flink/blob/02d30ace69dc18555a5085eccf70ee884e73a16e/tools/azure-pipelines/free_disk_space.sh Before ``` Filesystem Size Used Avail Use% Mounted on /dev/root 72G 66G 5.8G 93% / tmpfs 7.9G 84K 7.9G 1% /dev/shm tmpfs 3.2G 1.2M 3.2G 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock /dev/sda16 881M 62M 758M 8% /boot /dev/sda15 105M 6.2M 99M 6% /boot/efi /dev/sdb1 74G 4.1G 66G 6% /mnt tmpfs 1.6G 12K 1.6G 1% /run/user/1001 ``` After ``` Filesystem Size Used Avail Use% Mounted on /dev/root 72G 47G 25G 66% / tmpfs 7.9G 84K 7.9G 1% /dev/shm tmpfs 3.2G 1.1M 3.2G 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock /dev/sdb16 881M 62M 758M 8% /boot /dev/sdb15 105M 6.2M 99M 6% /boot/efi /dev/sda1 74G 4.1G 66G 6% /mnt tmpfs 1.6G 12K 1.6G 1% /run/user/1001 ``` --- .github/actions/setup/action.yml | 3 +++ .github/actions/setup/free_disk_space.sh | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100755 .github/actions/setup/free_disk_space.sh diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 101ea138..e7969434 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -12,6 +12,9 @@ inputs: runs: using: 'composite' steps: + - name: Free up disk space + shell: bash + run: ${{ github.action_path }}/free_disk_space.sh - shell: bash run: | echo $HOME diff --git a/.github/actions/setup/free_disk_space.sh b/.github/actions/setup/free_disk_space.sh new file mode 100755 index 00000000..15524194 --- /dev/null +++ b/.github/actions/setup/free_disk_space.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Script to free up disk space on CI systems +# Source: https://github.com/apache/flink/blob/02d30ace69dc18555a5085eccf70ee884e73a16e/tools/azure-pipelines/free_disk_space.sh + +echo "Freeing up disk space on CI system" + +echo "Listing 100 largest packages" +dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100 +df -h + +echo "Removing large packages" +sudo apt-get remove -y '^ghc-8.*' +sudo apt-get remove -y '^dotnet-.*' +sudo apt-get remove -y '^llvm-.*' +sudo apt-get remove -y 'php.*' +sudo apt-get remove -y azure-cli google-cloud-sdk hhvm google-chrome-stable firefox powershell mono-devel +sudo apt-get autoremove -y +sudo apt-get clean +df -h + +echo "Removing large directories" +rm -rf /usr/share/dotnet/ +df -h \ No newline at end of file