Skip to content

[ci] Update github caching to be more similar to drake-blender #451

[ci] Update github caching to be more similar to drake-blender

[ci] Update github caching to be more similar to drake-blender #451

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@v3
# Caching.
# See comments in drake-blender for more details:
# https://github.com/RobotLocomotion/drake-blender/blob/c4a33f80/.github/workflows/main.yml
- uses: actions/cache@v3
with:
path: "/home/runner/.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 /home/runner/.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 ROS tools (like rosdep)
uses: ros-tooling/[email protected]
- name: Update rosdep data
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
- 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
- name: Install ROS tarball's dependencies
# 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
# CI for drake_ros.
- name: Build drake_ros
run: bazel build //...
working-directory: drake_ros
- name: Test drake_ros
run: bazel test //...
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
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