Skip to content

Commit 5582b50

Browse files
committed
refactor cleanup action to be reusable
1 parent afb2c33 commit 5582b50

4 files changed

Lines changed: 33 additions & 78 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: "Maximize Build Space"
2+
description: "Remove large artifacts to maximize available build space on GitHub Actions runners."
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Clean
7+
shell: bash
8+
run: |
9+
echo "Available storage before:"
10+
sudo df -h
11+
echo
12+
13+
echo "Removing Removes .NET runtime and libraries..."
14+
sudo rm -rf /usr/share/dotnet
15+
16+
echo "Removing Android SDKs and Tools..."
17+
sudo rm -rf /usr/local/lib/android
18+
19+
echo "Removing GHC (Haskell) artifacts..."
20+
sudo rm -rf /opt/ghc
21+
22+
echo "Removing CodeQL Action Bundles..."
23+
sudo rm -rf /opt/hostedtoolcache/CodeQL
24+
25+
echo "Removing cached Docker images..."
26+
sudo docker image prune --all --force
27+
28+
echo "Available storage after:"
29+
sudo df -h
30+
echo

.github/workflows/ci.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,7 @@ jobs:
3232

3333
steps:
3434
- name: Clean
35-
# Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions.
36-
# This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory
37-
# where we need the most space
38-
run: |
39-
echo "Available storage before:"
40-
sudo df -h
41-
echo
42-
43-
echo "Removing Removes .NET runtime and libraries..."
44-
sudo rm -rf /usr/share/dotnet
45-
46-
echo "Removing Android SDKs and Tools..."
47-
sudo rm -rf /usr/local/lib/android
48-
49-
echo "Removing GHC (Haskell) artifacts..."
50-
sudo rm -rf /opt/ghc
51-
52-
echo "Removing CodeQL Action Bundles..."
53-
sudo rm -rf /opt/hostedtoolcache/CodeQL
54-
55-
echo "Removing cached Docker images..."
56-
sudo docker image prune --all --force
57-
58-
echo "Available storage after:"
59-
sudo df -h
60-
echo
35+
uses: ./.github/actions/maximize-build-space
6136

6237
- name: Checkout
6338
uses: actions/checkout@v4

.github/workflows/daily.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,7 @@ jobs:
2929

3030
steps:
3131
- name: Clean
32-
# Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions.
33-
# This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory
34-
# where we need the most space
35-
run: |
36-
echo "Available storage before:"
37-
sudo df -h
38-
echo
39-
40-
echo "Removing Removes .NET runtime and libraries..."
41-
sudo rm -rf /usr/share/dotnet
42-
43-
echo "Removing Android SDKs and Tools..."
44-
sudo rm -rf /usr/local/lib/android
45-
46-
echo "Removing GHC (Haskell) artifacts..."
47-
sudo rm -rf /opt/ghc
48-
49-
echo "Removing CodeQL Action Bundles..."
50-
sudo rm -rf /opt/hostedtoolcache/CodeQL
51-
52-
echo "Removing cached Docker images..."
53-
sudo docker image prune --all --force
54-
55-
echo "Available storage after:"
56-
sudo df -h
57-
echo
32+
uses: ./.github/actions/maximize-build-space
5833

5934
- name: Checkout
6035
uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,7 @@ jobs:
3232

3333
steps:
3434
- name: Clean
35-
# Reserve some space on the / partition to install the needed org.gnome runtimes and their Debug extensions.
36-
# This probably needs around 10-12GB, the rest of the free space on / then gets assigned to the build directory
37-
# where we need the most space
38-
run: |
39-
echo "Available storage before:"
40-
sudo df -h
41-
echo
42-
43-
echo "Removing Removes .NET runtime and libraries..."
44-
sudo rm -rf /usr/share/dotnet
45-
46-
echo "Removing Android SDKs and Tools..."
47-
sudo rm -rf /usr/local/lib/android
48-
49-
echo "Removing GHC (Haskell) artifacts..."
50-
sudo rm -rf /opt/ghc
51-
52-
echo "Removing CodeQL Action Bundles..."
53-
sudo rm -rf /opt/hostedtoolcache/CodeQL
54-
55-
echo "Removing cached Docker images..."
56-
sudo docker image prune --all --force
57-
58-
echo "Available storage after:"
59-
sudo df -h
60-
echo
35+
uses: ./.github/actions/maximize-build-space
6136

6237
- name: Checkout
6338
uses: actions/checkout@v4

0 commit comments

Comments
 (0)