Skip to content

Commit 771ff77

Browse files
epaganonprabhakk-mw
authored andcommitted
Free up space in runner before building Docker image.
1 parent a9a54b9 commit 771ff77

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# GitHub runners come preinstalled with a lot of software that
2+
# is not needed for this workflow. To increase available space
3+
# these packages are removed.
4+
# https://github.com/actions/runner-images/issues/2840
5+
6+
# Copyright 2025 The MathWorks, Inc.
7+
8+
name: Cleanup Runner
9+
description: This action removes unnecessary software from the GitHub runner to free up disk space.
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Cleanup
15+
shell: bash
16+
run: |
17+
sudo rm -rf \
18+
"$AGENT_TOOLSDIRECTORY" \
19+
/opt/google/chrome \
20+
/opt/microsoft/msedge \
21+
/opt/microsoft/powershell \
22+
/opt/pipx \
23+
/usr/lib/mono \
24+
/usr/local/julia* \
25+
/usr/local/lib/android \
26+
/usr/local/lib/node_modules \
27+
/usr/local/share/chromium \
28+
/usr/local/share/powershell \
29+
/usr/share/dotnet \
30+
/usr/share/swift
31+
df -h /

.github/workflows/build-test-publish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ jobs:
4545
- name: Checkout repo
4646
uses: actions/checkout@v4
4747

48+
- name: Cleanup runner
49+
uses: ./.github/actions/cleanup-runner
50+
4851
- name: Login to GitHub Container Registry
4952
uses: docker/login-action@v3
5053
with:

.github/workflows/from-matlab-docker-build-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
- name: Checkout repo
4444
uses: actions/checkout@v4
4545

46+
- name: Cleanup runner
47+
uses: ./.github/actions/cleanup-runner
48+
4649
- name: Set up Docker Buildx
4750
uses: docker/setup-buildx-action@v3
4851

.github/workflows/matlab-container-offline-install-build-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ jobs:
4949
- name: Checkout repo
5050
uses: actions/checkout@v4
5151

52+
- name: Cleanup runner
53+
uses: ./.github/actions/cleanup-runner
54+
5255
- name: Set up Docker Buildx
5356
uses: docker/setup-buildx-action@v3
5457
with:

.github/workflows/matlab-installer-build-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ jobs:
4747
steps:
4848
- name: Checkout repo
4949
uses: actions/checkout@v4
50+
51+
- name: Cleanup runner
52+
uses: ./.github/actions/cleanup-runner
5053

5154
- name: Move matlab-install mock to right location
5255
run: |

.github/workflows/non-interactive-build-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ jobs:
4545
- name: Checkout repo
4646
uses: actions/checkout@v4
4747

48+
- name: Cleanup runner
49+
uses: ./.github/actions/cleanup-runner
50+
4851
- name: Login to GitHub Container Registry
4952
uses: docker/login-action@v3
5053
with:

0 commit comments

Comments
 (0)