Skip to content

Commit 17820b5

Browse files
committed
micro-ROS Kilted add CI
Signed-off-by: David Laseca Perez <davidlaseca@eprosima.com>
1 parent 77f16ec commit 17820b5

31 files changed

Lines changed: 483 additions & 166 deletions

‎.github/workflows/ubuntu-ci.yml‎

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: ubuntu CI micro-ROS rcl
2+
3+
# The container image is derived from the branch under test, which works
4+
# because the branch names are the distro names:
5+
# - kilted -> ros:kilted-ros-base (Ubuntu 24.04 noble)
6+
# - lyrical -> ros:lyrical-ros-base (Ubuntu 26.04 resolute)
7+
# - rolling -> ros:rolling-ros-base (Ubuntu 26.04 resolute)
8+
#
9+
# Besides push and pull_request, this is callable via workflow_call so a scheduled
10+
# workflow on the default branch can run it once per distro branch. Note that
11+
# `uses: ./.github/workflows/ci.yml` always resolves to the *caller's* copy of this
12+
# file, so the default branch's copy is what runs for every branch it tests; only
13+
# the checked-out source and the container image follow `inputs.branch`.
14+
15+
on:
16+
push:
17+
branches:
18+
- kilted
19+
- lyrical
20+
- rolling
21+
pull_request:
22+
branches:
23+
- kilted
24+
- lyrical
25+
- rolling
26+
workflow_call:
27+
inputs:
28+
branch:
29+
description: >
30+
Distro branch to check out and test. Leave unset for push and
31+
pull_request, where the triggering ref is used instead.
32+
type: string
33+
required: false
34+
default: ''
35+
# To enable manual trigger
36+
workflow_dispatch:
37+
38+
concurrency:
39+
group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.branch }}
40+
cancel-in-progress: true
41+
42+
env:
43+
# Single source of truth for what gets built and tested.
44+
TESTED_PACKAGES: rcl rcl_action rcl_lifecycle
45+
46+
defaults:
47+
run:
48+
shell: bash
49+
50+
jobs:
51+
rcl_microros_ci:
52+
runs-on: ubuntu-latest
53+
# inputs.branch is used when this workflow is called
54+
# github.base_ref covers pull requests
55+
# github.ref_name is the branch on a push
56+
container: ros:${{ inputs.branch || github.base_ref || github.ref_name }}-ros-base
57+
timeout-minutes: 90
58+
59+
steps:
60+
- uses: actions/checkout@v5
61+
with:
62+
# Empty on push and pull_request, which leaves checkout's own behaviour
63+
# intact — importantly the PR merge ref, so PRs keep testing the merge
64+
# result rather than the base branch.
65+
ref: ${{ inputs.branch }}
66+
path: src/rcl
67+
68+
- name: Download dependencies
69+
run: |
70+
: "${ROS_DISTRO:?not set — is the container a ros:<distro>-ros-base image?}"
71+
. /opt/ros/$ROS_DISTRO/setup.bash
72+
73+
# The image ships no apt lists (every layer of its Dockerfile ends in
74+
# `rm -rf /var/lib/apt/lists/*`) and rosdep does not refresh them itself,
75+
# so this is required before rosdep can install anything.
76+
apt-get update
77+
78+
# Every rcl test dependency (mimick_vendor, osrf_testing_tools_cpp,
79+
# test_msgs, launch_testing_ament_cmake, ...) is a released binary.
80+
# rosdep is already initialised in the image; only its cache is stale.
81+
rosdep update --rosdistro $ROS_DISTRO
82+
rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -r -y
83+
84+
- name: Build
85+
# GitHub replaces the image's entrypoint for container jobs, so
86+
# /ros_entrypoint.sh never runs and each step must source ROS itself.
87+
run: |
88+
. /opt/ros/$ROS_DISTRO/setup.bash
89+
colcon --log-base /dev/null build \
90+
--event-handlers console_direct+ \
91+
--packages-up-to $TESTED_PACKAGES \
92+
--cmake-args -DCMAKE_BUILD_TYPE=Release -DRCL_MICROROS=ON
93+
94+
- name: Test
95+
run: |
96+
. /opt/ros/$ROS_DISTRO/setup.bash
97+
colcon --log-base /dev/null test \
98+
--event-handlers console_direct+ \
99+
--return-code-on-test-failure \
100+
--packages-select $TESTED_PACKAGES
101+
102+
- name: Test results
103+
# The per-package tallies colcon prints are not a cross-package summary;
104+
# this step is. It runs even when the test step failed.
105+
if: ${{ !cancelled() }}
106+
run: |
107+
. /opt/ros/$ROS_DISTRO/setup.bash
108+
colcon test-result --verbose
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Weekly ubuntu CI micro-ROS rcl
2+
3+
on:
4+
schedule:
5+
# Mondays at 02:00 UTC
6+
- cron: '0 2 * * 1'
7+
# To enable manual trigger
8+
workflow_dispatch:
9+
10+
jobs:
11+
ubuntu_ci:
12+
name: ${{ matrix.branch }}
13+
strategy:
14+
# Without this, one distro failing would cancel the others and
15+
# hide if they are fine
16+
fail-fast: false
17+
matrix:
18+
branch:
19+
- kilted
20+
- lyrical
21+
- rolling
22+
uses: ./.github/workflows/ubuntu-ci.yml
23+
with:
24+
branch: ${{ matrix.branch }}

‎rcl/CMakeLists.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ if(NOT RCL_MICROROS)
128128
endif()
129129

130130
if(NOT RCL_MICROROS)
131-
target_compile_definitions(${PROJECT_NAME}
132-
PUBLIC
133-
RCL_MICROROS_COMPLETE_IMPL
131+
target_compile_definitions(${PROJECT_NAME}
132+
PUBLIC
133+
RCL_MICROROS_COMPLETE_IMPL
134134
)
135135
endif()
136136

‎rcl/include/rcl/arguments.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "rcl_yaml_param_parser/types.h"
2727
#else
2828
typedef bool rcl_params_t;
29-
#endif // RCL_MICROROS_COMPLETE_IMPL
29+
#endif // RCL_MICROROS_COMPLETE_IMPL
3030

3131
#ifdef __cplusplus
3232
extern "C"

‎rcl/include/rcl/context.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C"
2727
#include "rcl/allocator.h"
2828
#ifdef RCL_MICROROS_COMPLETE_IMPL
2929
#include "rcl/arguments.h"
30-
#endif // RCL_MICROROS_COMPLETE_IMPL
30+
#endif // RCL_MICROROS_COMPLETE_IMPL
3131
#include "rcl/init_options.h"
3232
#include "rcl/macros.h"
3333
#include "rcl/types.h"
@@ -118,7 +118,7 @@ typedef struct rcl_context_s
118118
/// Global arguments for all nodes which share this context.
119119
/** Typically generated by the parsing of argc/argv in rcl_init(). */
120120
rcl_arguments_t global_arguments;
121-
#endif // RCL_MICROROS_COMPLETE_IMPL
121+
#endif // RCL_MICROROS_COMPLETE_IMPL
122122

123123
/// Implementation specific pointer.
124124
rcl_context_impl_t * impl;

‎rcl/include/rcl/node.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extern "C"
2727
#include "rcl/allocator.h"
2828
#ifdef RCL_MICROROS_COMPLETE_IMPL
2929
#include "rcl/arguments.h"
30-
#endif // RCL_MICROROS_COMPLETE_IMPL
30+
#endif // RCL_MICROROS_COMPLETE_IMPL
3131
#include "rcl/context.h"
3232
#include "rcl/guard_condition.h"
3333
#include "rcl/macros.h"

‎rcl/include/rcl/node_options.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extern "C"
2525
#include "rcl/allocator.h"
2626
#ifdef RCL_MICROROS_COMPLETE_IMPL
2727
#include "rcl/arguments.h"
28-
#endif // RCL_MICROROS_COMPLETE_IMPL
28+
#endif // RCL_MICROROS_COMPLETE_IMPL
2929
#include "rcl/macros.h"
3030

3131
#include "rcl/domain_id.h"
@@ -52,7 +52,7 @@ typedef struct rcl_node_options_s
5252
#ifdef RCL_MICROROS_COMPLETE_IMPL
5353
/// Command line arguments that apply only to this node.
5454
rcl_arguments_t arguments;
55-
#endif // RCL_MICROROS_COMPLETE_IMPL
55+
#endif // RCL_MICROROS_COMPLETE_IMPL
5656

5757
/// Flag to enable rosout for this node
5858
bool enable_rosout;

‎rcl/src/rcl/arguments_impl.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "rcl_yaml_param_parser/types.h"
2222
#else
2323
typedef bool rcl_params_t;
24-
#endif // RCL_MICROROS_COMPLETE_IMPL
24+
#endif // RCL_MICROROS_COMPLETE_IMPL
2525
#include "./remap_impl.h"
2626

2727
#ifdef __cplusplus

‎rcl/src/rcl/client.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extern "C"
2626
#include "rcl/node.h"
2727
#ifdef RCL_MICROROS_COMPLETE_IMPL
2828
#include "rcl/node_type_cache.h"
29-
#endif // RCL_MICROROS_COMPLETE_IMPL
29+
#endif // RCL_MICROROS_COMPLETE_IMPL
3030
#include "rcl/publisher.h"
3131
#include "rcl/time.h"
3232
#include "rcutils/logging_macros.h"
@@ -201,7 +201,7 @@ rcl_client_init(
201201
goto destroy_client;
202202
}
203203
client->impl->type_hash = *hash;
204-
#endif // RCL_MICROROS_COMPLETE_IMPL
204+
#endif // RCL_MICROROS_COMPLETE_IMPL
205205

206206
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client initialized");
207207
TRACETOOLS_TRACEPOINT(
@@ -271,7 +271,7 @@ rcl_client_fini(rcl_client_t * client, rcl_node_t * node)
271271
RCUTILS_SAFE_FWRITE_TO_STDERR(rcl_get_error_string().str);
272272
result = RCL_RET_ERROR;
273273
}
274-
#endif // RCL_MICROROS_COMPLETE_IMPL
274+
#endif // RCL_MICROROS_COMPLETE_IMPL
275275
allocator.deallocate(client->impl->remapped_service_name, allocator.state);
276276
client->impl->remapped_service_name = NULL;
277277

‎rcl/src/rcl/client_impl.h‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2025 cellumation GmbH
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef RCL__CLIENT_IMPL_H_
16+
#define RCL__CLIENT_IMPL_H_
17+
18+
#include "rcl/client.h"
19+
#include "rcutils/stdatomic_helper.h"
20+
#include "rmw/rmw.h"
21+
#include "./service_event_publisher.h"
22+
23+
struct rcl_client_impl_s
24+
{
25+
rcl_client_options_t options;
26+
rmw_qos_profile_t actual_request_publisher_qos;
27+
rmw_qos_profile_t actual_response_subscription_qos;
28+
rmw_client_t * rmw_handle;
29+
atomic_int_least64_t sequence_number;
30+
rcl_service_event_publisher_t * service_event_publisher;
31+
char * remapped_service_name;
32+
#ifdef RCL_MICROROS_COMPLETE_IMPL
33+
rosidl_type_hash_t type_hash;
34+
#endif // RCL_MICROROS_COMPLETE_IMPL
35+
bool in_use_by_waitset;
36+
};
37+
38+
#endif // RCL__CLIENT_IMPL_H_

0 commit comments

Comments
 (0)