Skip to content

Commit

Permalink
Free more disk space on GitHub actions runner
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Dec 7, 2023
1 parent 414ecf3 commit d7a415f
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 75 deletions.
43 changes: 43 additions & 0 deletions .github/reclaim-disk-space.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

echo "Free disk space before space reclaimed"
df -h /

echo "Reclaiming disk space..."

# Unwanted development SDKs
sudo rm -rf /opt/ghc \
rm -rf /opt/pipx \
rm -rf /usr/local/go \
rm -rf /usr/local/lib/android \
rm -rf /usr/local/share/boost \
rm -rf /usr/share/dotnet \
rm -rf /usr/share/rust \
rm -rf /usr/share/swift

# Remove unwanted container images
CONTAINER_IMAGES_TO_REMOVE=(node)
for IMAGE in ${CONTAINER_IMAGES_TO_REMOVE[@]}; do
if [[ $(docker images ${IMAGE} -q | wc -l) > 0 ]]; then
docker rmi -f $(docker images ${IMAGE} -q)
fi
done

echo "Free disk space after space reclaimed"
df -h /
28 changes: 3 additions & 25 deletions .github/workflows/camel-master-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,6 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.initial-mvn-install.outputs.matrix) }}
steps:
- name: Reclaim Disk Space
run: |
df -h /
echo "Reclaiming disk space..."
sudo rm -rf /opt/ghc \
rm -rf /opt/pipx \
rm -rf /usr/local/go \
rm -rf /usr/local/lib/android \
rm -rf /usr/local/share/boost \
rm -rf /usr/share/dotnet \
rm -rf /usr/share/rust \
rm -rf /usr/share/swift
df -h /
- name: Download Maven Repo
uses: actions/download-artifact@v3
with:
Expand All @@ -157,6 +144,8 @@ jobs:
with:
ref: camel-main
fetch-depth: 0
- name: Reclaim Disk Space
run: .github/reclaim-disk-space.sh
- name: Rebase branch main onto camel-main
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down Expand Up @@ -347,18 +336,7 @@ jobs:
ref: camel-main
fetch-depth: 0
- name: Reclaim Disk Space
run: |
df -h /
echo "Reclaiming disk space..."
sudo rm -rf /opt/ghc \
rm -rf /opt/pipx \
rm -rf /usr/local/go \
rm -rf /usr/local/lib/android \
rm -rf /usr/local/share/boost \
rm -rf /usr/share/dotnet \
rm -rf /usr/share/rust \
rm -rf /usr/share/swift
df -h /
run: .github/reclaim-disk-space.sh
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
Expand Down
28 changes: 3 additions & 25 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,24 +214,13 @@ jobs:
if: github.ref == 'refs/heads/quarkus-main' || github.base_ref == 'quarkus-main'
run: |
echo "BRANCH_OPTIONS=-Poss-snapshots -Dquarkus.version=999-SNAPSHOT" >> $GITHUB_ENV
- name: Reclaim Disk Space
run: |
df -h /
echo "Reclaiming disk space..."
sudo rm -rf /opt/ghc \
rm -rf /opt/pipx \
rm -rf /usr/local/go \
rm -rf /usr/local/lib/android \
rm -rf /usr/local/share/boost \
rm -rf /usr/share/dotnet \
rm -rf /usr/share/rust \
rm -rf /usr/share/swift
df -h /
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ env.CHECKOUT_REF }}
fetch-depth: 0
- name: Reclaim Disk Space
run: .github/reclaim-disk-space.sh
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -417,18 +406,7 @@ jobs:
ref: ${{ env.CHECKOUT_REF }}
fetch-depth: 0
- name: Reclaim Disk Space
run: |
df -h /
echo "Reclaiming disk space..."
sudo rm -rf /opt/ghc \
rm -rf /opt/pipx \
rm -rf /usr/local/go \
rm -rf /usr/local/lib/android \
rm -rf /usr/local/share/boost \
rm -rf /usr/share/dotnet \
rm -rf /usr/share/rust \
rm -rf /usr/share/swift
df -h /
run: .github/reclaim-disk-space.sh
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
Expand Down
28 changes: 3 additions & 25 deletions .github/workflows/quarkus-master-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,6 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.initial-mvn-install.outputs.matrix) }}
steps:
- name: Reclaim Disk Space
run: |
df -h /
echo "Reclaiming disk space..."
sudo rm -rf /opt/ghc \
rm -rf /opt/pipx \
rm -rf /usr/local/go \
rm -rf /usr/local/lib/android \
rm -rf /usr/local/share/boost \
rm -rf /usr/share/dotnet \
rm -rf /usr/share/rust \
rm -rf /usr/share/swift
df -h /
- name: Download Maven Repo
uses: actions/download-artifact@v3
with:
Expand All @@ -158,6 +145,8 @@ jobs:
with:
ref: quarkus-main
fetch-depth: 0
- name: Reclaim Disk Space
run: .github/reclaim-disk-space.sh
- name: Rebase branch main onto quarkus-main
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
Expand Down Expand Up @@ -348,18 +337,7 @@ jobs:
ref: quarkus-main
fetch-depth: 0
- name: Reclaim Disk Space
run: |
df -h /
echo "Reclaiming disk space..."
sudo rm -rf /opt/ghc \
rm -rf /opt/pipx \
rm -rf /usr/local/go \
rm -rf /usr/local/lib/android \
rm -rf /usr/local/share/boost \
rm -rf /usr/share/dotnet \
rm -rf /usr/share/rust \
rm -rf /usr/share/swift
df -h /
run: .github/reclaim-disk-space.sh
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
Expand Down

0 comments on commit d7a415f

Please sign in to comment.