From 3a41b60496ad9cd45194f00a3c5572244e765ec6 Mon Sep 17 00:00:00 2001 From: Andrei Aaron Date: Mon, 11 Sep 2023 12:59:39 +0000 Subject: [PATCH] ci: clean disk before run and show disk usage Signed-off-by: Andrei Aaron --- .github/actions/clean-runner/action.yaml | 12 ++++++++++++ .github/actions/show-disk-usage/action.yaml | 20 ++++++++++++++++++++ .github/workflows/build.yaml | 10 ++++++++++ 3 files changed, 42 insertions(+) create mode 100644 .github/actions/clean-runner/action.yaml create mode 100644 .github/actions/show-disk-usage/action.yaml diff --git a/.github/actions/clean-runner/action.yaml b/.github/actions/clean-runner/action.yaml new file mode 100644 index 00000000..4c8f552f --- /dev/null +++ b/.github/actions/clean-runner/action.yaml @@ -0,0 +1,12 @@ +name: 'Clean runner' +description: 'Remove unneeded tooling' +runs: + using: "composite" + steps: + - shell: bash + run: | + # To free up ~15 GB of disk space + sudo rm -rf /opt/ghc + sudo rm -rf /usr/local/share/boost + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet diff --git a/.github/actions/show-disk-usage/action.yaml b/.github/actions/show-disk-usage/action.yaml new file mode 100644 index 00000000..c8fb1960 --- /dev/null +++ b/.github/actions/show-disk-usage/action.yaml @@ -0,0 +1,20 @@ +name: 'Show disk usage' +description: 'Show information about disk usage' +runs: + using: "composite" + steps: + - shell: bash + run: | + cd $GITHUB_WORKSPACE + set -x + df -h + sudo ls -lRh /tmp/* || true + sudo du -sh /tmp || true + sudo du -sh /tmp/* || true + sudo find /tmp/ -size +5M | sudo xargs ls -lh + sudo du -sh ./* || true + sudo find ./ -size +5M | xargs ls -lh + sudo du -sh /var/ + sudo du -sh /var/lib/docker/ + sudo du -sh /home/runner/work/ + set +x diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ec4272c1..1168f3f2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -42,6 +42,8 @@ jobs: name: "golang ${{ matrix.go-version }} privilege ${{ matrix.privilege-level }}" steps: - uses: actions/checkout@v3 + - name: Clean disk space + uses: ./.github/actions/clean-runner - uses: benjlevesque/short-sha@v2.1 id: short-sha - name: Set up golang ${{ matrix.go-version }} @@ -70,6 +72,8 @@ jobs: - name: Go-download run: | make go-download + - name: Show disk usage before building the binaries + uses: ./.github/actions/show-disk-usage - name: Build-level1 run: | make show-info @@ -81,6 +85,9 @@ jobs: REGISTRY_URL: localhost:5000 ZOT_HOST: localhost ZOT_PORT: 8080 + - name: Show disk usage before running the tests + if: always() + uses: ./.github/actions/show-disk-usage - name: Test run: | make check VERSION_FULL=${{ inputs.build-id }} PRIVILEGE_LEVEL=${{ matrix.privilege-level }} @@ -88,6 +95,9 @@ jobs: REGISTRY_URL: localhost:5000 ZOT_HOST: localhost ZOT_PORT: 8080 + - name: Show disk usage after running the tests + if: always() + uses: ./.github/actions/show-disk-usage - name: Upload code coverage uses: codecov/codecov-action@v3 - uses: actions/cache@v3