From e4d08c41959d577ba5e56d42c35a6141940df273 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 14 Jun 2024 14:40:02 -0500 Subject: [PATCH] try an action --- .github/actions/clean-disk/action.yml | 53 +++++++++++++++++++++++++++ .github/workflows/checks.yml | 25 +++++++------ 2 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 .github/actions/clean-disk/action.yml diff --git a/.github/actions/clean-disk/action.yml b/.github/actions/clean-disk/action.yml new file mode 100644 index 0000000..feff264 --- /dev/null +++ b/.github/actions/clean-disk/action.yml @@ -0,0 +1,53 @@ +name: 'Maximize build disk space' +description: 'Maximize the available disk space by removing unneeded software' + +runs: + using: "composite" + steps: + - name: Disk space report before modification + shell: bash + run: | + echo "==> Available space before cleanup" + echo + df -h + # sudo du /usr/local -h --max-depth=1 | sort -rh || true + + - name: Maximize build disk space + shell: bash + run: | + set -euo pipefail + + echo "Removing unwanted software... " + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/.ghcup + sudo rm -rf /opt/hostedtoolcache + sudo docker image prune --all --force > /dev/null + sudo rm -rf /usr/local + + sudo apt-get remove -y '^aspnetcore-.*' > /dev/null + sudo apt-get remove -y '^dotnet-.*' > /dev/null + sudo apt-get remove -y '^llvm-.*' > /dev/null + sudo apt-get remove -y 'php.*' > /dev/null + sudo apt-get remove -y '^mongodb-.*' > /dev/null + sudo apt-get remove -y '^mysql-.*' > /dev/null + sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing > /dev/null + sudo apt-get remove -y google-cloud-sdk --fix-missing > /dev/null + sudo apt-get remove -y google-cloud-cli --fix-missing > /dev/null + sudo apt-get autoremove -y > /dev/null + sudo apt-get clean > /dev/null + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + + sudo swapoff -a + sudo rm -f /mnt/swapfile + free -h + echo "... done" + + - name: Disk space report after modification + shell: bash + run: | + echo "==> Available space after cleanup" + echo + df -h diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 2f052c5..c48ebea 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -18,20 +18,21 @@ jobs: steps: # The default disk size of these runners is ~14GB # Cleanup the disk, see upstream discussion https://github.com/actions/runner-images/issues/2840. - - name: Cleanup Disk Space - run: | - echo "Before removing files:" - df -h - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf /opt - sudo rm -rf "/usr/local/share/boost" - sudo rm -rf "$AGENT_TOOLSDIRECTORY" - echo "After removing files:" - df -h - + # - name: Cleanup Disk Space + # run: | + # echo "Before removing files:" + # df -h + # sudo rm -rf /usr/share/dotnet + # sudo rm -rf /opt/ghc + # sudo rm -rf /opt + # sudo rm -rf "/usr/local/share/boost" + # sudo rm -rf "$AGENT_TOOLSDIRECTORY" + # echo "After removing files:" + # df -h - uses: actions/checkout@v4 + - uses: ./.github/actions/clean-disk + - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@v7