|
| 1 | +name: 'Maximize Space' |
| 2 | +description: 'Maximize the space available to building' |
| 3 | + |
| 4 | +inputs: |
| 5 | + deep-clean: |
| 6 | + description: 'Perform a deep clean, removing unnecessary packages.' |
| 7 | + required: false |
| 8 | + default: 'false' |
| 9 | + |
| 10 | +runs: |
| 11 | + using: "composite" |
| 12 | + steps: |
| 13 | + - name: Pre |
| 14 | + shell: bash |
| 15 | + run: | |
| 16 | + #!/usr/bin/env bash |
| 17 | + |
| 18 | + echo "Memory and swap:" |
| 19 | + sudo free |
| 20 | + echo |
| 21 | + sudo swapon --show |
| 22 | + echo |
| 23 | +
|
| 24 | + echo "Available storage:" |
| 25 | + sudo df -h |
| 26 | + echo |
| 27 | + - name: Action |
| 28 | + shell: bash |
| 29 | + run: | |
| 30 | + #!/usr/bin/env bash |
| 31 | + |
| 32 | + if [[ ${{ inputs.deep-clean }} == 'true' ]]; then |
| 33 | + echo "Purging unnecessary packages" |
| 34 | + sudo apt-get remove -y '^aspnetcore-.*' || true |
| 35 | + sudo apt-get remove -y '^dotnet-.*' --fix-missing || true |
| 36 | + sudo apt-get remove -y '^llvm-.*' --fix-missing || true |
| 37 | + sudo apt-get remove -y 'php.*' --fix-missing || true |
| 38 | + sudo apt-get remove -y '^mongodb-.*' --fix-missing || true |
| 39 | + sudo apt-get remove -y '^mysql-.*' --fix-missing || true |
| 40 | + sudo apt-get remove -y '^postgresql-.*' --fix-missing || true |
| 41 | + sudo apt-get remove -y --fix-missing \ |
| 42 | + azure-cli \ |
| 43 | + firefox \ |
| 44 | + powershell \ |
| 45 | + mono-devel \ |
| 46 | + libgl1-mesa-dri \ |
| 47 | + microsoft-edge-stable \ |
| 48 | + google-chrome-stable \ |
| 49 | + google-cloud-sdk \ |
| 50 | + google-cloud-cli \ |
| 51 | + apache2 \ |
| 52 | + python3 python3-dev python3-pip python3-venv || true |
| 53 | + sudo apt-get autoremove -y || true |
| 54 | + sudo apt-get clean || true |
| 55 | + fi |
| 56 | + |
| 57 | + echo "Purging unnecessary directories" |
| 58 | + sudo rm -rf /usr/local/.ghcup || true |
| 59 | + sudo rm -rf /usr/local/julia* || true |
| 60 | + sudo rm -rf /usr/local/graalvm || true |
| 61 | + sudo rm -rf /usr/local/lib/android || true |
| 62 | + sudo rm -rf /usr/local/lib/node_modules || true |
| 63 | + sudo rm -rf /usr/local/share/chromium || true |
| 64 | + sudo rm -rf /usr/local/share/powershell || true |
| 65 | + sudo rm -rf /usr/share/dotnet || true |
| 66 | + sudo rm -rf /usr/share/swift || true |
| 67 | + sudo rm -rf /opt/ghc || true |
| 68 | + sudo rm -rf /opt/pipx || true |
| 69 | + sudo rm -rf /opt/google/chrome || true |
| 70 | + sudo rm -rf /opt/microsoft/msedge || true |
| 71 | + sudo rm -rf /opt/microsoft/powershell || true |
| 72 | + sudo rm -rf "${AGENT_TOOLSDIRECTORY:-/opt/hostedtoolcache/CodeQL}" || true |
| 73 | + |
| 74 | + echo "Purging unnecessary images" |
| 75 | + sudo docker image prune --all --force |
| 76 | + - name: Post |
| 77 | + shell: bash |
| 78 | + run: | |
| 79 | + #!/usr/bin/env bash |
| 80 | + |
| 81 | + echo "Memory and swap:" |
| 82 | + sudo free |
| 83 | + echo |
| 84 | + sudo swapon --show |
| 85 | + echo |
| 86 | +
|
| 87 | + echo "Available storage:" |
| 88 | + sudo df -h |
| 89 | + echo |
0 commit comments