diff --git a/.github/actions/prep-go-runner/action.yaml b/.github/actions/prep-go-runner/action.yaml index 434db0e8649..e7e02cff57a 100644 --- a/.github/actions/prep-go-runner/action.yaml +++ b/.github/actions/prep-go-runner/action.yaml @@ -20,19 +20,45 @@ runs: run: | echo "Before clearing disk space:" df -h + docker system df -v - # https://github.com/actions/virtual-environments/issues/709 - sudo apt-get clean - + # https://github.com/actions/runner-images/discussions/3242 github runners are bad at cleanup + echo "Removing large packages" + sudo apt-get remove -y '^dotnet-.*' || true + sudo apt-get remove -y '^llvm-.*' || true + sudo apt-get remove -y 'php.*' || true + sudo apt-get remove -y '^mongodb-.*' || true + sudo apt-get remove -y '^mysql-.*' || true + sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri || true + sudo apt-get autoremove -y || true + sudo apt-get clean -y || true + echo "Done removing large packages" + # Clean up pre-installed tools - # https://github.com/actions/virtual-environments/issues/1918 - sudo rm -rf /usr/share/dotnet - sudo rm -rf /opt/ghc - sudo rm -rf /usr/local/share/boost - sudo rm -rf $AGENT_TOOLSDIRECTORY + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /usr/local/graalvm || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /usr/local/share/boost || true + sudo rm -rf /usr/local/share/powershell || true + sudo rm -rf /usr/local/share/chromium || true + sudo rm -rf $AGENT_TOOLSDIRECTORY || true + + # Clean up images + docker image rm node:16 || true + docker image rm node:16-alpine || true + docker image rm node:18 || true + docker image rm node:18-alpine || true + docker image rm node:20 || true + docker image rm node:20-alpine || true + # remove the dangling images and containers + docker images | tail -n +2 | awk '$1 == "" {print $3}' | xargs --no-run-if-empty docker rmi + docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $1}' | xargs --no-run-if-empty docker rm --volumes=true echo "After clearing disk space:" df -h + docker system df -v - name: Set up Go id: setup-go uses: actions/setup-go@v5 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3c919e06c36..976d3756a33 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -39,7 +39,6 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set the release related variables id: set_vars run: | @@ -79,6 +78,9 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Prep Go Runner + uses: ./.github/actions/prep-go-runner + - name: Helm login to ${{ env.IMAGE_REGISTRY }} if: ${{ github.event_name != 'pull_request' }} run: echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ${{ env.IMAGE_REGISTRY }} -u ${{ github.repository_owner }} --password-stdin @@ -105,11 +107,8 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" - cache: true + - name: Prep Go Runner + uses: ./.github/actions/prep-go-runner # We publish a rolling main release for every commit to main. Deleting the release # ensures that the tagged commit is not stale. Goreleaser will create a new tag @@ -151,10 +150,8 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - - uses: actions/setup-go@v5 - with: - go-version-file: "go.mod" + - name: Prep Go Runner + uses: ./.github/actions/prep-go-runner - name: Login to ghcr.io if: ${{ github.event_name != 'pull_request' }}