From cc43cbcc2d1a89d167254556949ff18080ce1ce3 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Thu, 22 Feb 2024 10:33:50 +0000 Subject: [PATCH] Revert "ci: remove setup.sh" This reverts commit e203229f00620b7a763b3abb3e134de29c75b471. --- .github/workflows/scripts/setup.sh | 23 +++++++++++++++++++++ .github/workflows/ubuntu.yml | 32 ++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100755 .github/workflows/scripts/setup.sh diff --git a/.github/workflows/scripts/setup.sh b/.github/workflows/scripts/setup.sh new file mode 100755 index 0000000..797a9ed --- /dev/null +++ b/.github/workflows/scripts/setup.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -eu + +id + +df -h + +sudo systemd-run --wait rm -rf \ + /usr/share/az* \ + /usr/share/dotnet \ + /usr/share/gradle* \ + /usr/share/miniconda \ + /usr/share/swift \ + /var/lib/gems \ + /var/lib/mysql \ + /var/lib/snapd \ + /opt/hostedtoolcache/CodeQL \ + /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk + +sudo fstrim / + +df -h diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 86fd999..3596917 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -65,6 +65,9 @@ jobs: - uses: actions/checkout@v1 - uses: actions/setup-go@v5 + - name: Setup + run: .github/workflows/scripts/setup.sh + - name: Build run: go build @@ -138,9 +141,38 @@ jobs: ] steps: + - name: Backup docker files + run: | + echo "backup moby/buildkit image" + sudo docker image save -o ${GITHUB_WORKSPACE}/images.tar moby/buildkit + echo "prune docker" + sudo docker system prune -a -f + echo "back up /var/lib/docker folder structure and other files" + sudo rsync -aPq /var/lib/docker/ ${GITHUB_WORKSPACE}/docker + + - name: Maximize build space + uses: easimon/maximize-build-space@master + with: + overprovision-lvm: 'true' + remove-dotnet: 'true' + # instead of using default value to mount to build path, + # /var/lib/docker/ is really the place we need more spaces. + build-mount-path: '/var/lib/docker/' + + - name: Restore docker files + run: | + sudo rsync -aPq ${GITHUB_WORKSPACE}/docker/ /var/lib/docker + sudo rm -rf ${GITHUB_WORKSPACE}/docker + sudo ls ${GITHUB_WORKSPACE} -l + sudo docker image load -i ${GITHUB_WORKSPACE}/images.tar + sudo rm ${GITHUB_WORKSPACE}/images.tar + - uses: actions/checkout@v1 - uses: actions/setup-go@v5 + - name: Setup + run: .github/workflows/scripts/setup.sh + - name: Build run: go build