Skip to content

Commit

Permalink
[ci] Free up disk space on GitHub CI runner (#309)
Browse files Browse the repository at this point in the history
Removes:
- docker images
- dotnet
- android
- haskell
- powershell
- swift
- jvm

This frees up about 30G of disk space
This also removes /var/lib/apt/lists after `apt-et install`
  • Loading branch information
EricCousineau-TRI authored Oct 30, 2023
1 parent dc2f2e4 commit 058f09b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .github/runner_free_space.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -eux

# Adapted from https://stackoverflow.com/a/76211564
# TODO(eric.cousineau): Try using
# https://github.com/easimon/maximize-build-space

df -h
sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1
df -h /
sudo rm -rf \
/usr/share/dotnet /usr/local/lib/android /opt/ghc \
/usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \
/usr/lib/jvm
df -h /
14 changes: 11 additions & 3 deletions .github/workflows/bazelized_drake_ros.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Free up space
run: .github/runner_free_space.sh

# Caching.
# See comments in drake-blender for more details:
Expand Down Expand Up @@ -43,7 +45,9 @@ jobs:
run: rosdep update
- name: Install bazel_ros2_rules dependencies
# TODO(sloretz) make bazel_ros2_rules/setup/install_prereqs.sh
run: sudo apt install python3 python3-toposort
run: |
sudo apt install python3 python3-toposort
sudo rm -rf /var/lib/apt/lists/*
- name: Download Drake
run: bazel build @drake//:module_py
working-directory: drake_ros
Expand All @@ -54,7 +58,9 @@ jobs:
# TODO(sloretz) can't use rosdep here because we need the archive downloaded,
# but can't download the archive with bazel until we have the dependencies installed
# so bazel_ros2_rules can inspect it.
run: sudo apt-get install -y libconsole-bridge-dev
run: |
sudo apt-get install -y libconsole-bridge-dev
sudo rm -rf /var/lib/apt/lists/*
# CI for drake_ros.
- name: Build drake_ros
run: bazel build //...
Expand All @@ -67,7 +73,9 @@ jobs:
working-directory: drake_ros
# CI for drake_ros_examples.
- name: Install additional ROS dependencies for drake_ros_examples
run: yes | sudo ./setup/install_prereqs.sh
run: |
yes | sudo ./setup/install_prereqs.sh
sudo rm -rf /var/lib/apt/lists/*
working-directory: drake_ros_examples
- name: Configure drake_ros_examples Bazel for CI
run: ln -s ../.github/ci.bazelrc ./user.bazelrc
Expand Down
1 change: 1 addition & 0 deletions drake_ros_examples/setup/install_prereqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ apt_install () {
apt-get -q install --no-install-recommends "$@"
}

apt-get update
apt_install $(cat_without_comments packages-ros2.txt)

0 comments on commit 058f09b

Please sign in to comment.