Skip to content

Migrate drake-ros to Bzlmod #1363

Migrate drake-ros to Bzlmod

Migrate drake-ros to Bzlmod #1363

Workflow file for this run

name: drake-ros continuous integration
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}-${{ github.ref == 'refs/heads/main' && github.sha || ''}}
cancel-in-progress: true
jobs:
bazel_ros2_rules_test:
name: Build and test bazel_ros2_rules modules with bazel
runs-on: ubuntu-latest
container:
image: ubuntu:noble
# This is required for lldb and network isolation.
# See https://stackoverflow.com/a/73613377/7829525
options: --privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
steps:
- name: Fix container environment
# See https://github.com/actions/runner/issues/863
run: |
USER=`id -un`
HOME=`getent passwd $USER | cut -d: -f6`
echo HOME=$HOME >> "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@v5
- name: Configure bazel_ros2_rules workspace for CI
run: ln -s ../.github/ci.bazelrc ./user.bazelrc
working-directory: bazel_ros2_rules
- name: Configure ros2_example_bazel_installed workspace for CI
run: ln -s ../.github/ci.bazelrc ./user.bazelrc
working-directory: ros2_example_bazel_installed
- name: Persist Bazel caches
uses: actions/cache@v3
with:
path: /root/.cache/bazel_ci
key: bazel_ci-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
bazel_ci-${{ github.ref }}-
bazel_ci-refs/heads/main-
- name: Persist apt caches
uses: actions/cache@v3
with:
path: /var/cache/apt
key: apt_bazel-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
apt_bazel-${{ github.ref }}-
apt_bazel-refs/heads/main-
- name: Install repository prereqs
run: |
echo 'APT::Get::Assume-Yes "true";' | tee /etc/apt/apt.conf.d/90yes
echo "debconf debconf/frontend select Noninteractive" | debconf-set-selections
yes | ./setup/install_prereqs -C /tmp --with-bazel
- name: Build bazel_ros2_rules workspace
run: bazel build //...
working-directory: bazel_ros2_rules
- name: Test bazel_ros2_rules workspace
run: bazel test //...
working-directory: bazel_ros2_rules
- name: Build ros2_example_bazel_installed workspace
run: bazel build //...
working-directory: ros2_example_bazel_installed
- name: Test ros2_example_installed workspace
run: bazel test //... @ros2//...
working-directory: ros2_example_bazel_installed
if: "! contains(github.event.pull_request.labels.*.name, 'status: defer ci')"
bazel_drake_ros_test:
name: Build and test drake_ros modules with bazel
runs-on: ubuntu-latest
needs: bazel_ros2_rules_test
container:
image: ubuntu:noble
# This is required for lldb and network isolation.
# See https://stackoverflow.com/a/73613377/7829525
options: --privileged --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
steps:
- name: Fix container environment
# See https://github.com/actions/runner/issues/863
run: |
USER=`id -un`
HOME=`getent passwd $USER | cut -d: -f6`
echo HOME=$HOME >> "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@v5
- name: Persist Bazel caches
uses: actions/cache@v3
with:
path: /root/.cache/bazel_ci
key: bazel_ci-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
bazel_ci-${{ github.ref }}-
bazel_ci-refs/heads/main-
- name: Persist apt caches
uses: actions/cache@v3
with:
path: /var/cache/apt
key: apt_bazel-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
apt_bazel-${{ github.ref }}-
apt_bazel-refs/heads/main-
- name: Install repository prereqs
run: |
echo 'APT::Get::Assume-Yes "true";' | tee /etc/apt/apt.conf.d/90yes
echo "debconf debconf/frontend select Noninteractive" | debconf-set-selections
yes | ./setup/install_prereqs -C /tmp --with-bazel
- name: Purge GCC 14
# Note(#385): drake's mkdoc script loads gcc14 C++ std libraries if
# installed, which causes the build to fail because it expects gcc13 to
# be used.
run: apt purge -y gcc-14 libgcc-14-dev
- name: Configure drake_ros workspace for CI
run: ln -s ../.github/ci.bazelrc ./user.bazelrc
working-directory: drake_ros
- name: Build drake_ros workspace
run: bazel build //...
working-directory: drake_ros
- name: Test drake_ros workspace
run: bazel test //...
working-directory: drake_ros
- name: Configure drake_ros_examples workspace for CI
run: ln -s ../.github/ci.bazelrc ./user.bazelrc
working-directory: drake_ros_examples
- name: Build drake_ros_examples workspace
run: bazel build //...
working-directory: drake_ros_examples
- name: Test drake_ros_examples workspace
run: bazel test //...
if: "! contains(github.event.pull_request.labels.*.name, 'status: defer ci')"
colcon_drake_ros_test:
name: Build and test drake_ros packages with colcon
runs-on: ubuntu-latest
container:
image: ubuntu:noble
steps:
- name: Fix container environment
# See https://github.com/actions/runner/issues/863
run: |
USER=`id -un`
HOME=`getent passwd $USER | cut -d: -f6`
echo HOME=$HOME >> "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@v5
- name: Persist apt caches
uses: actions/cache@v3
with:
path: /var/cache/apt
key: apt_colcon-${{ github.ref }}-${{ github.run_number }}-${{ github.run_attempt }}
restore-keys: |
apt_colcon-${{ github.ref }}-
apt_colcon-refs/heads/main-
- name: Install repository prereqs
run: |
echo 'APT::Get::Assume-Yes "true";' | tee /etc/apt/apt.conf.d/90yes
echo "debconf debconf/frontend select Noninteractive" | debconf-set-selections
yes | ./setup/install_prereqs -C /tmp --with-colcon
- name: Cope with Python 2 pollution
run: apt update && apt install -y python-is-python3
- name: Build drake_ros packages
run: . /opt/ros/jazzy/setup.sh && colcon build
- name: Test drake_ros packages
run: |
. colcon-install/setup.sh && colcon test --event-handlers=console_cohesion+
colcon test-result --test-result-base colcon-build
if: "! contains(github.event.pull_request.labels.*.name, 'status: defer ci')"