This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
forked from stacks-network/actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
99 lines (91 loc) · 2.78 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# ref: https://github.com/easimon/maximize-build-space/blob/master/action.yml
# this should be good enough, but in the future we may want to setup LVM like in the linked action (they do note it may break in the future, and is hacky)
name: "Maximize build disk space"
description: "Maximize the available disk space for your build job"
branding:
icon: "trash"
color: "gray-dark"
inputs:
remove-dotnet:
description: "Removes .NET runtime and libraries. (frees ~17 GB)"
required: false
default: "true"
remove-android:
description: "Removes Android SDKs and Tools. (frees ~11 GB)"
required: false
default: "true"
remove-haskell:
description: "Removes GHC (Haskell) artifacts. (frees ~2.7 GB)"
required: false
default: "true"
remove-codeql:
description: "Removes CodeQL Action Bundles. (frees ~5.4 GB)"
required: false
default: "true"
remove-docker-images:
description: "Removes cached Docker images. (frees ~3 GB)"
required: false
default: "true"
runs:
using: "composite"
steps:
- name: Disk space report before modification
shell: bash
run: |
echo "Memory and swap:"
free
echo
swapon --show
echo
echo "Available storage:"
df -h
echo
- name: Maximize build disk space
shell: bash
run: |
set -euo pipefail
echo -n " Removing: "
if [[ ${{ inputs.remove-dotnet }} == 'true' ]]; then
echo -n "dotnet "
fi
if [[ ${{ inputs.remove-android }} == 'true' ]]; then
echo -n "android "
fi
if [[ ${{ inputs.remove-haskell }} == 'true' ]]; then
echo -n "haskell "
fi
if [[ ${{ inputs.remove-codeql }} == 'true' ]]; then
echo -n "codeql "
fi
if [[ ${{ inputs.remove-docker-images }} == 'true' ]]; then
echo -n "docker "
fi
echo
echo "Removing unwanted software... "
if [[ ${{ inputs.remove-dotnet }} == 'true' ]]; then
sudo rm -rf /usr/share/dotnet
fi
if [[ ${{ inputs.remove-android }} == 'true' ]]; then
sudo rm -rf /usr/local/lib/android
fi
if [[ ${{ inputs.remove-haskell }} == 'true' ]]; then
sudo rm -rf /opt/ghc
fi
if [[ ${{ inputs.remove-codeql }} == 'true' ]]; then
sudo rm -rf /opt/hostedtoolcache/CodeQL
fi
if [[ ${{ inputs.remove-docker-images }} == 'true' ]]; then
sudo docker image prune --all --force
fi
sudo apt-get clean
echo "... done"
- name: Disk space report after modification
shell: bash
run: |
echo "Memory and swap:"
free
echo
swapon --show
echo
echo "Available storage:"
df -h