Skip to content

Commit ebde613

Browse files
committed
github: free disk space in the test workflow runner
The test runner is running out of disk space. This is a hack for freeing up disk space in a workflow. Signed-off-by: Martin Hickey <[email protected]>
1 parent 6167374 commit ebde613

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: 'Free Disk Space'
2+
description: 'Frees disk space on the runner'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Print disk space before cleanup
7+
run: |
8+
df -h
9+
shell: bash
10+
- name: Free Disk Space Linux
11+
if: runner.os == 'Linux'
12+
run: |
13+
sudo docker rmi "$(docker image ls -aq)" >/dev/null 2>&1 || true
14+
sudo rm -rf \
15+
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
16+
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
17+
/usr/lib/jvm || true
18+
sudo apt install aptitude -y >/dev/null 2>&1
19+
sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1
20+
sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1
21+
sudo apt-get autoremove -y >/dev/null 2>&1
22+
sudo apt-get autoclean -y >/dev/null 2>&1
23+
shell: bash
24+
- name: Print disk space after cleanup
25+
run: |
26+
df -h
27+
shell: bash

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ jobs:
5959
# https://github.com/actions/checkout/issues/249
6060
fetch-depth: 0
6161

62+
- name: Free disk space
63+
uses: ./.github/actions/free-disk-space
64+
6265
- name: Setup Python ${{ matrix.python }}
6366
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
6467
with:

0 commit comments

Comments
 (0)