mirror of https://github.com/bitcoin/bitcoin.git
ci: clear out space on centos job
Clear out space on the centos job be deleteing unnecessary files.
Raised by #33293 which pointed to a solution like b7f04d7822
Only runs when cache provider (runner) is `gha`, and on the CentOS job.
This commit is contained in:
parent
d8fe258cd6
commit
014b9f6268
|
@ -0,0 +1,52 @@
|
||||||
|
name: 'Clear unnecessary files'
|
||||||
|
description: 'Clear out unnecessary files to make space on the VM'
|
||||||
|
runs:
|
||||||
|
using: 'composite'
|
||||||
|
steps:
|
||||||
|
- name: Clear unnecessary files
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
DEBIAN_FRONTEND: noninteractive
|
||||||
|
run: |
|
||||||
|
set +e
|
||||||
|
|
||||||
|
# Skip slow "updating man-db" dpkg step
|
||||||
|
echo 'set man-db/auto-update false' | sudo debconf-communicate; sudo dpkg-reconfigure man-db
|
||||||
|
|
||||||
|
echo "=== Disk space before cleanup ==="
|
||||||
|
df -h
|
||||||
|
BEFORE_AVAIL=$(df / | awk 'NR==2 {print $4}')
|
||||||
|
|
||||||
|
echo "Cleaning up unnecessary packages..."
|
||||||
|
time sudo apt-get remove --purge -y firefox google-chrome-stable powershell
|
||||||
|
time sudo apt-get autoremove -y
|
||||||
|
time sudo apt-get clean
|
||||||
|
|
||||||
|
echo "Removing large directories..."
|
||||||
|
DIRS_TO_REMOVE=(
|
||||||
|
"/usr/share/dotnet/"
|
||||||
|
"/usr/local/.ghcup/"
|
||||||
|
"/usr/local/share/powershell"
|
||||||
|
"/usr/local/share/chromium"
|
||||||
|
"/usr/local/lib/android"
|
||||||
|
"/usr/local/lib/node_modules"
|
||||||
|
)
|
||||||
|
|
||||||
|
for dir in "${DIRS_TO_REMOVE[@]}"; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
echo "Removing $dir"
|
||||||
|
time sudo rm -Rf "$dir"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Disabling swap"
|
||||||
|
sudo swapoff -a
|
||||||
|
sudo rm -f /swapfile
|
||||||
|
|
||||||
|
echo "=== Disk space after cleanup ==="
|
||||||
|
df -h
|
||||||
|
|
||||||
|
AFTER_AVAIL=$(df / | awk 'NR==2 {print $4}')
|
||||||
|
SPACE_SAVED=$((AFTER_AVAIL - BEFORE_AVAIL))
|
||||||
|
SPACE_SAVED_GB=$((SPACE_SAVED / 1024 / 1024))
|
||||||
|
echo "Space freed: ${SPACE_SAVED_GB}GB (${SPACE_SAVED}KB)"
|
|
@ -482,6 +482,7 @@ jobs:
|
||||||
fallback-runner: 'ubuntu-24.04'
|
fallback-runner: 'ubuntu-24.04'
|
||||||
timeout-minutes: 120
|
timeout-minutes: 120
|
||||||
file-env: './ci/test/00_setup_env_native_centos.sh'
|
file-env: './ci/test/00_setup_env_native_centos.sh'
|
||||||
|
freeup-space: ${{ needs.runners.outputs.provider == 'gha' && true || false }} # Only needed on hosted GH runners (forks)
|
||||||
|
|
||||||
- name: 'tidy'
|
- name: 'tidy'
|
||||||
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
|
cirrus-runner: 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-md'
|
||||||
|
@ -516,6 +517,10 @@ jobs:
|
||||||
with:
|
with:
|
||||||
cache-provider: ${{ matrix.provider || needs.runners.outputs.provider }}
|
cache-provider: ${{ matrix.provider || needs.runners.outputs.provider }}
|
||||||
|
|
||||||
|
- name: Clear unnecessary files
|
||||||
|
if: ${{ matrix.freeup-space == true }}
|
||||||
|
uses: ./.github/actions/clear-files
|
||||||
|
|
||||||
- name: Enable bpfcc script
|
- name: Enable bpfcc script
|
||||||
if: ${{ env.CONTAINER_NAME == 'ci_native_asan' }}
|
if: ${{ env.CONTAINER_NAME == 'ci_native_asan' }}
|
||||||
# In the image build step, no external environment variables are available,
|
# In the image build step, no external environment variables are available,
|
||||||
|
|
Loading…
Reference in New Issue