Skip to content

Commit

Permalink
Free some space on Mac CI runners
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbanes committed Sep 15, 2024
1 parent 2f21db3 commit 3f7d4ab
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/actions/disk-cleanup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Disk cleanup
description: "Cleanup disk space"
runs:
using: composite
steps:
- name: Free up disk space
shell: bash
run: |
echo "Disk space before cleanup..."
df -h /
echo "Removing unnecessary files to free up disk space..."
# https://github.com/actions/runner-images/issues/2840
sudo rm -rf \
/opt/hostedtoolcache \
/opt/google/chrome \
/opt/microsoft/msedge \
/opt/microsoft/powershell \
/opt/pipx \
/usr/lib/mono \
/usr/local/julia* \
/usr/local/lib/node_modules \
/usr/local/share/chromium \
/usr/local/share/powershell \
/usr/share/dotnet \
/usr/share/swift
echo "Searching for Xcode versions:"
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1
echo "Removing old Xcode versions..."
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1 | grep -v `cat .xcode-version` | xargs rm -rf
echo "Available Xcode versions after removal:"
find /Applications -name "Xcode_*" -maxdepth 1 -mindepth 1
echo "Disk space after cleanup..."
df -h /
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Cleanup Disk space in runner
uses: .github/actions/disk-cleanup

- name: set up JDK
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -204,6 +207,9 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Cleanup Disk space in runner
uses: .github/actions/disk-cleanup

- name: set up JDK
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -260,6 +266,9 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Cleanup Disk space in runner
uses: .github/actions/disk-cleanup

- name: set up JDK
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -302,6 +311,9 @@ jobs:
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4

- name: Cleanup Disk space in runner
uses: .github/actions/disk-cleanup

- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
Expand Down

0 comments on commit 3f7d4ab

Please sign in to comment.