diff --git a/.github/actions/cleanup/action.yml b/.github/actions/cleanup/action.yml new file mode 100644 index 00000000..96b44357 --- /dev/null +++ b/.github/actions/cleanup/action.yml @@ -0,0 +1,39 @@ +name: "cleanup" +description: "Remove large pre-installed tools to free disk space" + +inputs: + show-before: + description: "Print disk usage before cleanup" + required: false + default: "false" + show-after: + description: "Print disk usage after cleanup" + required: false + default: "true" + +runs: + using: "composite" + steps: + - name: Show disk usage before cleanup + if: ${{ inputs.show-before == 'true' }} + shell: bash + run: | + echo "=== Disk usage before cleanup ===" + df -h + sudo du -sh /home/* /usr/* /var/* /opt/* 2>/dev/null | sort -h | tail -n 40 + + - name: Clean up pre-installed tools + shell: bash + run: | + set -e + sudo rm -rf /usr/local/lib/android + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/hostedtoolcache + df -h + + - name: Show disk usage after cleanup (detailed) + if: ${{ inputs.show-after == 'true' }} + shell: bash + run: | + echo "=== Largest dirs under /usr, /opt, /home ===" + sudo du -sh /usr/* /opt/* /home/* 2>/dev/null | sort -h | tail -n 30 \ No newline at end of file diff --git a/.github/workflows/Tendis-CI.yml b/.github/workflows/Tendis-CI.yml index 9c2fbcfe..9a2df2b5 100644 --- a/.github/workflows/Tendis-CI.yml +++ b/.github/workflows/Tendis-CI.yml @@ -98,6 +98,8 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 + - name: cleanup + uses: ./.github/actions/cleanup/ - name: compile uses: ./.github/actions/compile/ - name: Unit Test @@ -123,6 +125,8 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 + - name: cleanup + uses: ./.github/actions/cleanup/ - name: compile uses: ./.github/actions/compile/ - name: Redis Test @@ -148,6 +152,8 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 + - name: cleanup + uses: ./.github/actions/cleanup/ - name: compile uses: ./.github/actions/compile/ - name: Restore Test @@ -163,6 +169,8 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 + - name: cleanup + uses: ./.github/actions/cleanup/ - name: compile uses: ./.github/actions/compile/ - name: Repl Test @@ -178,6 +186,8 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 + - name: cleanup + uses: ./.github/actions/cleanup/ - name: compile uses: ./.github/actions/compile/ - name: Cluster Test @@ -193,6 +203,8 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 + - name: cleanup + uses: ./.github/actions/cleanup/ - name: compile uses: ./.github/actions/compile/ - name: Cluster Test @@ -204,10 +216,12 @@ jobs: runs-on: ubuntu-latest env: TEST_DIR: build/bin - steps: + steps: - uses: actions/checkout@v3 with: fetch-depth: 2 + - name: cleanup + uses: ./.github/actions/cleanup/ - name: compile uses: ./.github/actions/compile/ - name: GoTest @@ -225,6 +239,8 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 + - name: cleanup + uses: ./.github/actions/cleanup/ - name: compile uses: ./.github/actions/compile/ - name: GoTest @@ -232,6 +248,8 @@ jobs: cd src/tendisplus/integrate_test chmod +x gotest.sh ./gotest.sh normaltest-part2 + rm -rf tmp/ .cache/ + test-gotest-normaltest-part3: needs: [cpplint-check] name: Test-gotest-normaltest-part3 @@ -242,6 +260,8 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 2 + - name: cleanup + uses: ./.github/actions/cleanup/ - name: compile uses: ./.github/actions/compile/ - name: GoTest @@ -262,6 +282,8 @@ jobs: fetch-depth: 2 - name: Checkout code uses: actions/checkout@v3 + - name: cleanup + uses: ./.github/actions/cleanup/ - name: compile uses: ./.github/actions/compile/ - name: GoTest