Skip to content

Commit 6bfbed7

Browse files
committed
delete more
1 parent 08e10c4 commit 6bfbed7

File tree

1 file changed

+74
-13
lines changed

1 file changed

+74
-13
lines changed

src/ci/scripts/free-disk-space.sh

+74-13
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ set -euo pipefail
44
# Free disk space on Linux GitHub action runners
55
# Script inspired by https://github.com/jlumbroso/free-disk-space
66

7-
# When updating to a new ubuntu version:
7+
# When updating to a new ubuntu version (e.g. from ubuntu-24.04):
88
# - Check that there are no docker images preinstalled with `docker image ls`
99
# - Check that there are no big packages preinstalled that we aren't using
10+
# - Check that all directores we are removing are still present (look at the warnings)
1011

1112
# print a line of the specified character
1213
printSeparationLine() {
@@ -63,24 +64,62 @@ printDF() {
6364
printSeparationLine "="
6465
}
6566

66-
removeDir() {
67-
dir=${1}
67+
removeRecursive() {
68+
element=${1}
6869

6970
local before
70-
if [ ! -d "$dir" ]; then
71-
echo "::warning::Directory $dir does not exist, skipping."
71+
if [ ! -e "$element" ]; then
72+
echo "::warning::Directory or file $element does not exist, skipping."
7273
else
7374
before=$(getAvailableSpace)
74-
sudo rm -rf "$dir"
75-
printSavedSpace "$before" "Removed $dir"
75+
sudo rm -rf "$element"
76+
printSavedSpace "$before" "Removed $element"
7677
fi
7778
}
7879

79-
removeUnusedDirectories() {
80-
local dirs_to_remove=(
81-
"/usr/local/lib/android"
80+
removeUnusedDirsAndFiles() {
81+
local to_remove=(
8282
"/etc/mysql"
83+
"/usr/local/aws-sam-cli"
84+
"/usr/local/doc/cmake"
85+
"/usr/local/julia"*
86+
"/usr/local/lib/android"
87+
"/usr/local/share/chromedriver-"*
88+
"/usr/local/share/chromium"
89+
"/usr/local/share/cmake-"*
90+
"/usr/local/share/edge_driver"
91+
"/usr/local/share/gecko_driver"
92+
"/usr/local/share/icons"
93+
"/usr/local/share/vim"
94+
"/usr/local/share/emacs"
95+
"/usr/local/share/powershell"
96+
"/usr/local/share/vcpkg"
97+
"/usr/share/apache-maven-"*
98+
"/usr/share/gradle-"*
99+
"/usr/share/java"
100+
"/usr/share/kotlinc"
101+
"/usr/share/miniconda"
83102
"/usr/share/php"
103+
"/usr/share/ri"
104+
"/usr/share/swift"
105+
106+
# binaries
107+
"/usr/local/bin/azcopy"
108+
"/usr/local/bin/bicep"
109+
"/usr/local/bin/ccmake"
110+
"/usr/local/bin/cmake-"*
111+
"/usr/local/bin/cmake"
112+
"/usr/local/bin/cpack"
113+
"/usr/local/bin/ctest"
114+
"/usr/local/bin/helm"
115+
"/usr/local/bin/kind"
116+
"/usr/local/bin/kustomize"
117+
"/usr/local/bin/minikube"
118+
"/usr/local/bin/packer"
119+
"/usr/local/bin/phpunit"
120+
"/usr/local/bin/pulumi-"*
121+
"/usr/local/bin/pulumi"
122+
"/usr/local/bin/stack"
84123

85124
# Haskell runtime
86125
"/usr/local/.ghcup"
@@ -93,11 +132,27 @@ removeUnusedDirectories() {
93132
"$AGENT_TOOLSDIRECTORY"
94133
)
95134

96-
for dir in "${dirs_to_remove[@]}"; do
97-
removeDir "$dir"
135+
for element in "${to_remove[@]}"; do
136+
removeRecursive "$element"
98137
done
99138
}
100139

140+
removeNodeModules() {
141+
sudo npm uninstall -g \
142+
"@bazel/bazelisk" \
143+
"bazel" \
144+
"grunt" \
145+
"gulp" \
146+
"lerna" \
147+
"n" \
148+
"newman" \
149+
"parcel" \
150+
"typescript" \
151+
"webpack-cli" \
152+
"webpack" \
153+
"yarn"
154+
}
155+
101156
execAndMeasureSpaceChange() {
102157
local operation=${1} # Function to execute
103158
local title=${2}
@@ -159,6 +214,10 @@ cleanSwap() {
159214
free -h
160215
}
161216

217+
removePythonPackages() {
218+
sudo pipx uninstall ansible-core
219+
}
220+
162221
# Display initial disk space stats
163222

164223
AVAILABLE_INITIAL=$(getAvailableSpace)
@@ -168,8 +227,10 @@ echo ""
168227

169228
execAndMeasureSpaceChange cleanPackages "Unused packages"
170229
execAndMeasureSpaceChange cleanSwap "Swap storage"
230+
execAndMeasureSpaceChange removeNodeModules "Node modules"
231+
execAndMeasureSpaceChange removePythonPackages "Python Packages"
171232

172-
removeUnusedDirectories
233+
removeUnusedDirsAndFiles
173234

174235
# Output saved space statistic
175236
echo ""

0 commit comments

Comments
 (0)