From a83dcaffae42b13b722c5e05e48139ef470d9360 Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Fri, 4 Jul 2025 14:54:05 +0300 Subject: [PATCH] .github: add new action `cleanup-space` --- .github/actions/cleanup-space/action.yml | 16 +++++ .github/workflows/main.yml | 81 ++++++++---------------- 2 files changed, 43 insertions(+), 54 deletions(-) create mode 100644 .github/actions/cleanup-space/action.yml diff --git a/.github/actions/cleanup-space/action.yml b/.github/actions/cleanup-space/action.yml new file mode 100644 index 000000000..037435f98 --- /dev/null +++ b/.github/actions/cleanup-space/action.yml @@ -0,0 +1,16 @@ +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..." + # Remove dotnet to save disk space. + sudo rm -rf /usr/share/dotnet + # Remove android to save disk space. + sudo rm -rf /usr/local/lib/android + # Remove ghc to save disk space. + sudo rm -rf /opt/ghc diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9ff98ccb0..d1fa4b52a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,18 +47,15 @@ jobs: name: Static Checks runs-on: ubuntu-latest steps: - - name: cleanup space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - - name: Git checkout uses: actions/checkout@v4 with: # Needed for some checks. fetch-depth: 0 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + - name: Setup Go ${{ env.GO_VERSION }} uses: ./.github/actions/setup-go with: @@ -117,17 +114,14 @@ jobs: name: check commits runs-on: ubuntu-latest steps: - - name: cleanup space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - - name: git checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + - name: setup go ${{ env.GO_VERSION }} uses: ./.github/actions/setup-go with: @@ -146,17 +140,14 @@ jobs: name: lint code runs-on: ubuntu-latest steps: - - name: cleanup space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - - name: git checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + - name: setup go ${{ env.GO_VERSION }} uses: ./.github/actions/setup-go with: @@ -183,15 +174,12 @@ jobs: - name: arm sys: darwin-arm64 freebsd-arm linux-armv6 linux-armv7 linux-arm64 windows-arm steps: - - name: cleanup space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - - name: git checkout uses: actions/checkout@v4 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + - name: setup go ${{ env.GO_VERSION }} uses: ./.github/actions/setup-go with: @@ -223,17 +211,14 @@ jobs: - unit-module steps: - - name: cleanup space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - - name: git checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + - name: fetch and rebase on ${{ github.base_ref }} if: github.event_name == 'pull_request' uses: ./.github/actions/rebase @@ -295,17 +280,14 @@ jobs: - name: neutrino args: backend=neutrino cover=1 steps: - - name: cleanup space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - - name: git checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + - name: fetch and rebase on ${{ github.base_ref }} if: github.event_name == 'pull_request' uses: ./.github/actions/rebase @@ -378,17 +360,14 @@ jobs: - name: bitcoind-postgres-nativesql-experiment args: backend=bitcoind dbbackend=postgres nativesql=true tags=test_native_sql steps: - - name: cleanup space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - - name: git checkout uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + - name: fetch and rebase on ${{ github.base_ref }} if: github.event_name == 'pull_request' uses: ./.github/actions/rebase @@ -531,15 +510,12 @@ jobs: - github.com/golang/protobuf v1.5.3 steps: - - name: cleanup space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - - name: git checkout uses: actions/checkout@v4 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + - name: ensure dependencies at correct version run: if ! grep -q "${{ matrix.pinned_dep }}" go.mod; then echo dependency ${{ matrix.pinned_dep }} should not be altered ; exit 1 ; fi @@ -551,15 +527,12 @@ jobs: runs-on: ubuntu-latest if: '!contains(github.event.pull_request.labels.*.name, ''no-changelog'')' steps: - - name: cleanup space - run: | - sudo rm -rf /usr/share/dotnet - sudo rm -rf /usr/local/lib/android - sudo rm -rf /opt/ghc - - name: git checkout uses: actions/checkout@v4 + - name: Clean up runner space + uses: ./.github/actions/cleanup-space + - name: release notes check run: scripts/check-release-notes.sh