Skip to content

Commit 07135af

Browse files
committed
ci: extract "free disk space" action
We likely need this for the release workflow as well. Ref #186.
1 parent 907b76e commit 07135af

File tree

3 files changed

+41
-28
lines changed

3 files changed

+41
-28
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
name: Free Disk Space
3+
description: Delete a bunch of unnecessary data from the pre-built GitHub runner images.
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Free Disk Space
8+
run: ${{ github.action_path }}/free.sh
9+
shell: bash
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
df -h
6+
7+
to_delete=(
8+
"/lib/firefox"
9+
"/lib/google-cloud-sdk"
10+
"/lib/jvm"
11+
"/lib/llvm-16"
12+
"/lib/llvm-17"
13+
"/opt/az"
14+
"/opt/google"
15+
"/opt/hostedtoolcache/CodeQL"
16+
"/opt/hostedtoolcache/PyPy"
17+
"/opt/hostedtoolcache/Ruby"
18+
"/opt/hostedtoolcache/go"
19+
"/opt/hostedtoolcache/node"
20+
"/opt/microsoft"
21+
"/opt/pipx"
22+
"/usr/share/swift"
23+
)
24+
for d in "${to_delete[@]}"; do
25+
echo "delete $d"
26+
sudo rm -rf "$d"
27+
done
28+
29+
df -h

.github/workflows/ci.yml

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,6 @@ jobs:
1515
check:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- name: Free disk space
19-
run: |
20-
df -h
21-
22-
to_delete=(
23-
"/lib/firefox"
24-
"/lib/google-cloud-sdk"
25-
"/lib/jvm"
26-
"/lib/llvm-16"
27-
"/lib/llvm-17"
28-
"/opt/az"
29-
"/opt/google"
30-
"/opt/hostedtoolcache/CodeQL"
31-
"/opt/hostedtoolcache/PyPy"
32-
"/opt/hostedtoolcache/Ruby"
33-
"/opt/hostedtoolcache/go"
34-
"/opt/hostedtoolcache/node"
35-
"/opt/microsoft"
36-
"/opt/pipx"
37-
"/usr/share/swift"
38-
)
39-
for d in "${to_delete[@]}"; do
40-
echo "delete $d"
41-
sudo rm -rf "$d"
42-
done
43-
44-
df -h
45-
4618
- name: Checkout
4719
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
4820
with:
@@ -51,6 +23,9 @@ jobs:
5123
- name: Fetch main branch
5224
run: git fetch --depth=1 origin main
5325

26+
- name: Free disk space
27+
uses: ./.github/actions/free-disk-space
28+
5429
- name: Install `yamllint`
5530
run: pip install --requirement=.github/workflows/requirements.txt
5631

0 commit comments

Comments
 (0)