Skip to content

Commit

Permalink
ci: Fix "No space left on device" error (NVIDIA#281)
Browse files Browse the repository at this point in the history
* Add action to free up disk space
* Free up disk space before running lint and format

---------

Signed-off-by: Christian Kadner <ckadner@us.ibm.com>
  • Loading branch information
ckadner authored Mar 5, 2024
1 parent 5302fd5 commit a7ed4d9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/actions/free-up-disk-space/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Free up disk space"
description: "Removes non-essential tools, libraries and cached files from GitHub action runner node"

runs:
using: "composite"
steps:
- name: "Remove non-essential tools and libraries"
shell: bash
run: |
# https://github.com/actions/runner-images/issues/2840#issuecomment-790492173
echo "Disk usage before cleanup:"
df -h
echo "Removing non-essential tools and libraries ..."
sudo rm -rf /opt/ghc
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/share/boost
echo "Deleting libraries for Android (12G), CodeQL (5.3G), PowerShell (1.3G), Swift (1.7G) ..."
sudo rm -rf /usr/local/lib/android
sudo rm -rf "${AGENT_TOOLSDIRECTORY}/CodeQL"
sudo rm -rf /usr/local/share/powershell
sudo rm -rf /usr/share/swift
echo "Disk usage after cleanup:"
df -h
- name: "Prune docker images"
shell: bash
run: |
echo "Pruning docker images ..."
docker image prune -a -f
docker system df
echo "Disk usage after pruning docker images:"
df -h
3 changes: 3 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Free up disk space
uses: ./.github/actions/free-up-disk-space

- name: Set up Python 3.9
uses: actions/setup-python@v4
Expand Down

0 comments on commit a7ed4d9

Please sign in to comment.