diff --git a/.github/actions/cleanup-android/action.yaml b/.github/actions/cleanup-android/action.yaml new file mode 100644 index 0000000..0abab82 --- /dev/null +++ b/.github/actions/cleanup-android/action.yaml @@ -0,0 +1,12 @@ +name: "Clean up android sdk/ndk" +description: "Removes Android SDK/NDK to free up disk space on the runner." + +runs: + using: "composite" + steps: + - name: Remove android toolchain + shell: bash + run: | + echo "Removing android toolchain to free up disk space..." + sudo rm -rf /usr/local/lib/android + df -h diff --git a/.github/actions/cleanup-space/action.yaml b/.github/actions/cleanup-space/action.yaml new file mode 100644 index 0000000..cd44fd1 --- /dev/null +++ b/.github/actions/cleanup-space/action.yaml @@ -0,0 +1,48 @@ +name: "Clean up runner disk space" +description: "Removes large, non-essential toolsets to free up disk space on the runner." + +runs: + using: "composite" + steps: + - name: Free up disk space + shell: bash + run: | + echo "Removing large toolsets to free up disk space..." + echo "Disk space before cleanup:" + df -h + + # Remove dotnet to save disk space. + sudo rm -rf /usr/share/dotnet + # Remove ghc to save disk space. + sudo rm -rf /opt/ghc + # Remove large packages. + sudo rm -rf /usr/share/swift + sudo rm -rf /usr/local/julia* + sudo rm -rf /opt/hostedtoolcache + + # Remove docker images to save space. + docker image prune -a -f || true + + # Remove large apt packages. + sudo apt-get remove -y \ + '^aspnetcore-.*' \ + '^dotnet-.*' \ + '^llvm-.*' \ + 'php.*' \ + '^mongodb-.*' \ + '^mysql-.*' \ + azure-cli \ + google-chrome-stable \ + firefox \ + powershell \ + mono-devel \ + libgl1-mesa-dri 2>/dev/null || true + sudo apt-get autoremove -y + sudo apt-get clean + + # Remove caches. + sudo rm -rf /usr/local/share/boost + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + + echo "Disk space after cleanup:" + df -h diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a833af7..151e68b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,10 @@ jobs: runs-on: ubuntu-latest steps: - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 + + - name: Clean up runner space + uses: ./.github/actions/cleanup-space - name: go cache uses: actions/cache@v3 @@ -60,6 +63,9 @@ jobs: - name: wasm compile run: make wasm + - name: Clean up runner space (android) + uses: ./.github/actions/cleanup-android + ######################## # lint code ######################## @@ -68,10 +74,16 @@ jobs: runs-on: ubuntu-latest steps: - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 with: fetch-depth: 0 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + + - name: Clean up runner space (android) + uses: ./.github/actions/cleanup-android + - name: go cache uses: actions/cache@v3 with: @@ -106,7 +118,13 @@ jobs: - unit-race steps: - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 + + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + + - name: Clean up runner space (android) + uses: ./.github/actions/cleanup-android - name: go cache uses: actions/cache@v3 @@ -135,7 +153,13 @@ jobs: runs-on: ubuntu-latest steps: - name: git checkout - uses: actions/checkout@v3 + uses: actions/checkout@v5 + + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + + - name: Clean up runner space (android) + uses: ./.github/actions/cleanup-android - name: go cache uses: actions/cache@v3