Skip to content

[ci] Stop using ros-tooling/setup-ros #717

[ci] Stop using ros-tooling/setup-ros

[ci] Stop using ros-tooling/setup-ros #717

name: Bazel Drake-ROS Continuous Integration
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
bazel_build_and_test:
if: "! contains(github.event.pull_request.labels.*.name, 'status: defer ci')"
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Free up space
run: .github/runner_free_space.sh
# Caching.
# See comments in drake-blender for more details:
# https://github.com/RobotLocomotion/drake-blender/blob/c4a33f80/.github/workflows/main.yml
- uses: actions/cache/restore@v3
with:
path: "~/.cache/bazel_ci"
# We want this key to change to ensure we store the updated cache.
key: bazel_ci-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
bazel_ci-${{ github.ref }}-
bazel_ci-refs/heads/main-
- name: Check cache
run: du -hs $(readlink -f ~/.cache/bazel_ci) || true
# Setup.
- name: Simplify apt upgrades
run: .github/simplify_apt_and_upgrades.sh
- name: Configure drake_ros Bazel for CI
run: ln -s ../.github/ci.bazelrc ./user.bazelrc
working-directory: drake_ros
- name: Install bazel_ros2_rules dependencies
# TODO(sloretz) make bazel_ros2_rules/setup/install_prereqs.sh
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
- name: Install Drake's dependencies
run: yes | sudo ./bazel-drake_ros/external/drake/setup/ubuntu/install_prereqs.sh
working-directory: drake_ros
# CI for drake_ros.
- name: Install drake_ros's dependencies
run: yes | sudo ./setup/install_prereqs.sh
working-directory: drake_ros
- name: Build drake_ros
run: export ROS_DISTRO=humble; bazel build //...
working-directory: drake_ros
- name: Test drake_ros
run: export ROS_DISTRO=humble; bazel test //...
working-directory: drake_ros
- name: Clean up drake_ros
run: bazel clean
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
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
working-directory: drake_ros_examples
- name: Build drake_ros_examples
run: bazel build //...
working-directory: drake_ros_examples
- name: Test drake_ros_examples
run: bazel test //...
working-directory: drake_ros_examples
- name: Clean up drake_ros_examples
run: bazel clean
working-directory: drake_ros_examples
# Save the updated cache snapshots, so we never do the same work twice.
# By default, actions/cache only saves after a successful workflow, but
# our caches are bags of files where we only ever add new files (not change
# an existing files), so it's always safe to snapshot.
- uses: actions/cache/save@v3
if: always()
with:
path: "~/.cache/bazel_ci"
key: bazel_ci-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}