Skip to content

Commit 97cac31

Browse files
committed
CI: fix new ROS2 rolling ubuntu OS
1 parent 957eccb commit 97cac31

1 file changed

Lines changed: 57 additions & 31 deletions

File tree

.github/workflows/build-ros.yml

Lines changed: 57 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,13 @@ on: [ push ]
55

66
jobs:
77
build_docker:
8-
# On Linux, iterates on all ROS 1 and ROS 2 distributions.
8+
# On Linux, iterates on all ROS 2 distributions.
99
runs-on: ubuntu-latest
1010
env:
1111
DEBIAN_FRONTEND: noninteractive
12+
continue-on-error: ${{ matrix.allow_failure == true }}
1213
strategy:
1314
matrix:
14-
# Define the Docker image(s) associated with each ROS distribution.
15-
# The include syntax allows additional variables to be defined, like
16-
# docker_image in this case. See documentation:
17-
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-configurations-in-a-matrix-build
18-
#
19-
# Platforms are defined in REP 3 and REP 2000:
20-
# https://ros.org/reps/rep-0003.html
21-
# https://ros.org/reps/rep-2000.html
2215
include:
2316
# Humble Hawksbill (May 2022 - May 2027)
2417
- docker_image: ubuntu:jammy
@@ -37,20 +30,31 @@ jobs:
3730
- docker_image: ubuntu:noble
3831
ros_distribution: jazzy
3932
use_ros_testing: true
33+
coverage_run: true
4034

4135
# Rolling Ridley (No End-Of-Life)
42-
- docker_image: ubuntu:noble
43-
ros_distribution: rolling
44-
use_ros_testing: false
45-
46-
- docker_image: ubuntu:noble
47-
ros_distribution: rolling
48-
use_ros_testing: true
49-
50-
- docker_image: ubuntu:noble
51-
ros_distribution: rolling
52-
use_ros2-testing: true
53-
coverage_run: true
36+
# TODO: migrate to ubuntu:resolute once rolling packages are published there.
37+
# Track: https://discourse.openrobotics.org/t/preparing-for-rolling-sync-2026-04-23/54223
38+
#- docker_image: ubuntu:noble
39+
# ros_distribution: rolling
40+
# use_ros_testing: false
41+
42+
#- docker_image: ubuntu:noble
43+
# ros_distribution: rolling
44+
# use_ros_testing: true
45+
46+
#- docker_image: ubuntu:noble
47+
# ros_distribution: rolling
48+
# use_ros_testing: true
49+
# coverage_run: true
50+
51+
# Lyrical Luth (May 2026 - May 2031, LTS)
52+
# Beta packages available on resolute; GA release expected May 22, 2026.
53+
# allow_failure until GA is released.
54+
#- docker_image: ubuntu:resolute
55+
# ros_distribution: lyrical
56+
# use_ros_testing: true
57+
# allow_failure: true
5458

5559
container:
5660
image: ${{ matrix.docker_image }}
@@ -61,18 +65,49 @@ jobs:
6165
TOKEN: ${{ secrets.GITHUB_TOKEN }}
6266
run: |
6367
apt-get -y update
64-
apt-get -y install git
68+
apt-get -y install git curl gnupg2 ca-certificates
6569
git clone https://$TOKEN@github.com/$GITHUB_REPOSITORY.git --recursive "$GITHUB_WORKSPACE"
6670
git config --global --add safe.directory "$GITHUB_WORKSPACE"
6771
git checkout $GITHUB_SHA
6872
git submodule update --init --recursive
6973
74+
# apt-key was removed in Ubuntu 26.04 (Resolute Raccoon). For resolute-based
75+
# builds we set up the ROS repo manually before setup-ros runs, which would
76+
# otherwise call apt-key internally and fail.
77+
- name: Setup ROS apt repository (Ubuntu 26.04+)
78+
if: matrix.docker_image == 'ubuntu:resolute'
79+
run: |
80+
curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \
81+
-o /usr/share/keyrings/ros-archive-keyring.gpg
82+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] \
83+
http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" \
84+
| tee /etc/apt/sources.list.d/ros2.list > /dev/null
85+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] \
86+
http://packages.ros.org/ros2-testing/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" \
87+
| tee /etc/apt/sources.list.d/ros2-testing.list > /dev/null
88+
apt-get update
89+
7090
- name: setup ROS environment
91+
if: matrix.docker_image != 'ubuntu:resolute'
7192
uses: ros-tooling/setup-ros@v0.7
7293
with:
7394
required-ros-distributions: ${{ matrix.ros_distribution }}
7495
use-ros2-testing: ${{ matrix.use_ros_testing }}
7596

97+
# On resolute, setup-ros can't be used (calls apt-key which is gone).
98+
# Install the equivalent packages manually instead.
99+
- name: Setup ROS environment (Ubuntu 26.04+)
100+
if: matrix.docker_image == 'ubuntu:resolute'
101+
run: |
102+
apt-get install -y \
103+
ros-${{ matrix.ros_distribution }}-ros-base \
104+
python3-rosdep \
105+
python3-colcon-common-extensions \
106+
python3-colcon-mixin \
107+
ros-dev-tools
108+
rosdep init || true
109+
rosdep update
110+
76111
- name: Install rosdep dependencies
77112
run: |
78113
. /opt/ros/*/setup.sh
@@ -93,7 +128,6 @@ jobs:
93128
# Inject Coverage Build Type
94129
if [ "${{ matrix.coverage_run }}" = "true" ]; then
95130
echo "Enabling Coverage build type..."
96-
# This flag forces the use of the gcov flags defined in CMakeLists.txt
97131
EXTRA_CMAKE_ARGS="$EXTRA_CMAKE_ARGS -DCMAKE_BUILD_TYPE=Coverage"
98132
fi
99133
@@ -107,24 +141,16 @@ jobs:
107141
- name: Run unit tests
108142
run: |
109143
. /opt/ros/*/setup.sh
110-
# Run tests regardless of coverage setting, as they are required to generate the .gcda files
111144
colcon test --event-handlers console_direct+
112145
colcon test-result --verbose
113146
114147
- name: Generate coverage report
115148
if: matrix.coverage_run == true
116149
run: |
117-
# 1. Capture coverage data across the entire workspace.
118-
# --ignore-errors mismatch fixes geninfo parsing errors
119-
# --rc geninfo_unexecuted_blocks=1 fixes warnings about unexecuted blocks
120150
lcov --capture --directory . --output-file coverage.info \
121151
--ignore-errors mismatch --rc geninfo_unexecuted_blocks=1
122-
123-
# 2. Filter the report: Remove all files outside of your source code
124152
lcov --remove coverage.info '/opt/ros/*' '/usr/*' \
125153
--ignore-errors unused --output-file coverage_filtered.info
126-
127-
# 3. Print a summary to the log
128154
echo "--- Coverage Summary for mola-state-estimation ---"
129155
lcov --list coverage_filtered.info
130156
echo "------------------------------------------"

0 commit comments

Comments
 (0)