From 5613410a833e0c591af9a716d83060ae893f1a07 Mon Sep 17 00:00:00 2001 From: Tyler Mayoff Date: Fri, 4 Jul 2025 18:26:38 -0400 Subject: [PATCH] moved the disk space to it's own action --- .github/actions/disk_space/action.yml | 45 +++++++++++++++++++++++++++ .github/workflows/main.yml | 19 +---------- 2 files changed, 46 insertions(+), 18 deletions(-) create mode 100644 .github/actions/disk_space/action.yml diff --git a/.github/actions/disk_space/action.yml b/.github/actions/disk_space/action.yml new file mode 100644 index 0000000..23def79 --- /dev/null +++ b/.github/actions/disk_space/action.yml @@ -0,0 +1,45 @@ +name: "Clear disk space" +description: "Frees disk space in the GHA runner" +inputs: + debug: + description: Enabling this will print before and after disk sizes + default: false + required: false + +runs: + using: "composite" + steps: + - name: Get disk usage + shell: bash + run: | + echo "used use%" + df -h | grep /\$ | cut -d ' ' -f 5,9 + + - name: Detailed usage + run: | + du -h -d2 / 2>/dev/null | sort -hr | head -n 20 || true + + - name: Clear + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /usr/share/swift + sudo rm -rf /usr/lib/jvm + sudo rm -rf /usr/local/.ghcup + sudo rm -rf /home/runner/.rustup + sudo rm -rf /usr/local/share/chromium + sudo rm -rf /usr/local/lib/android + sudo rm -rf /opt/ghc + sudo rm -rf /opt/hostedtoolcache/CodeQL + sudo docker system prune -af || true + sudo docker image prune -af || true + sudo docker builder prune -af || true + + - name: Get disk usage + shell: bash + run: | + echo "used use%" + df -h | grep /\$ | cut -d ' ' -f 5,9 + + - name: Detailed usage + run: | + du -h -d2 / 2>/dev/null | sort -hr | head -n 20 || true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 126cb3b..3825db0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,24 +19,7 @@ jobs: steps: - name: Maximize build space if: runner.os == 'Linux' - shell: bash - run: | - df -h - du -h -d2 / 2>/dev/null | sort -hr | head -n 20 || true - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/share/swift - sudo rm -rf /usr/lib/jvm - sudo rm -rf /usr/local/.ghcup - sudo rm -rf /home/runner/.rustup - sudo rm -rf /usr/local/share/chromium - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - sudo rm -rf /opt/hostedtoolcache/CodeQL - sudo docker system prune -af || true - sudo docker image prune -af || true - sudo docker builder prune -af || true - df -h - du -h -d2 / 2>/dev/null | sort -hr | head -n 20 || true + uses: ./.github/actions/build - uses: actions/checkout@v4