From 4fa13960093da1122c4058e9df25b300d9b46d5a Mon Sep 17 00:00:00 2001 From: RMcVelia Date: Tue, 3 Dec 2024 10:06:08 +0000 Subject: [PATCH] Disk cleanup tests --- .github/workflows/cleanup-test.yml | 67 ++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/cleanup-test.yml diff --git a/.github/workflows/cleanup-test.yml b/.github/workflows/cleanup-test.yml new file mode 100644 index 00000000000..b82f193768c --- /dev/null +++ b/.github/workflows/cleanup-test.yml @@ -0,0 +1,67 @@ +name: Disk cleanup test + +on: + push: + branches: + - cleanup-tests + +jobs: + cleanup: + name: Disk cleanup + runs-on: ubuntu-latest + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: postgres + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - uses: actions/checkout@v4 + + - name: Disk cleanup + shell: bash + run: | + echo "Disk space before cleanup:" + df -h + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /opt/hostedtoolcache/CodeQL || true + sudo rm -rf /usr/local/share/boost || true + sudo docker image prune --all --force || true + sudo apt-get remove -y '^aspnetcore-.*' || true + sudo apt-get remove -y '^dotnet-.*' --fix-missing || true + sudo apt-get remove -y '^llvm-.*' --fix-missing || true + sudo apt-get remove -y 'php.*' --fix-missing || true + sudo apt-get remove -y '^mongodb-.*' --fix-missing || true + sudo apt-get remove -y '^mysql-.*' --fix-missing || true + sudo apt-get remove -y google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing || true + sudo apt-get remove -y google-cloud-sdk --fix-missing || true + sudo apt-get remove -y google-cloud-cli --fix-missing || true + sudo rm -rf "$AGENT_TOOLSDIRECTORY"/PyPy || true + sudo rm -rf "$AGENT_TOOLSDIRECTORY"/Python || true + sudo rm -rf "$AGENT_TOOLSDIRECTORY"/go || true + sudo rm -rf "$AGENT_TOOLSDIRECTORY"/node || true + sudo apt-get autoremove -y || true + sudo apt-get clean + echo "Disk space after cleanup:" + df -h + + # - name: Disk cleanup 2 + # shell: bash + # run: | + # echo "Disk space before cleanup 2:" + # df -h + # sudo rm -rf "$AGENT_TOOLSDIRECTORY"/PyPy || true + # sudo rm -rf "$AGENT_TOOLSDIRECTORY"/Python || true + # sudo rm -rf "$AGENT_TOOLSDIRECTORY"/go || true + # sudo rm -rf "$AGENT_TOOLSDIRECTORY"/node || true + # sudo apt-get autoremove -y || true + # echo "Disk space after cleanup 2:" + # df -h