Skip to content

Commit 41265b1

Browse files
committed
micro-ROS Rolling add CI
Signed-off-by: David Laseca Perez <davidlaseca@eprosima.com>
1 parent 43012ea commit 41265b1

33 files changed

Lines changed: 434 additions & 175 deletions

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

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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+
apt-get dist-upgrade -y
78+
79+
# Every rcl test dependency (mimick_vendor, osrf_testing_tools_cpp,
80+
# test_msgs, launch_testing_ament_cmake, ...) is a released binary.
81+
# rosdep is already initialised in the image; only its cache is stale.
82+
rosdep update --rosdistro $ROS_DISTRO
83+
rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -r -y
84+
85+
- name: Build
86+
# GitHub replaces the image's entrypoint for container jobs, so
87+
# /ros_entrypoint.sh never runs and each step must source ROS itself.
88+
run: |
89+
. /opt/ros/$ROS_DISTRO/setup.bash
90+
colcon --log-base /dev/null build \
91+
--event-handlers console_direct+ \
92+
--packages-up-to $TESTED_PACKAGES \
93+
--cmake-args -DCMAKE_BUILD_TYPE=Release -DRCL_MICROROS=ON
94+
95+
- name: Test
96+
run: |
97+
. /opt/ros/$ROS_DISTRO/setup.bash
98+
colcon --log-base /dev/null test \
99+
--event-handlers console_direct+ \
100+
--return-code-on-test-failure \
101+
--packages-select $TESTED_PACKAGES
102+
103+
- name: Test results
104+
# The per-package tallies colcon prints are not a cross-package summary;
105+
# this step is. It runs even when the test step failed.
106+
if: ${{ !cancelled() }}
107+
run: |
108+
. /opt/ros/$ROS_DISTRO/setup.bash
109+
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
@@ -124,9 +124,9 @@ if(NOT RCL_MICROROS)
124124
endif()
125125

126126
if(NOT RCL_MICROROS)
127-
target_compile_definitions(${PROJECT_NAME}
128-
PUBLIC
129-
RCL_MICROROS_COMPLETE_IMPL
127+
target_compile_definitions(${PROJECT_NAME}
128+
PUBLIC
129+
RCL_MICROROS_COMPLETE_IMPL
130130
)
131131
endif()
132132

‎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/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"
@@ -189,7 +189,7 @@ rcl_client_init(
189189
goto destroy_client;
190190
}
191191
client->impl->type_hash = *hash;
192-
#endif // RCL_MICROROS_COMPLETE_IMPL
192+
#endif // RCL_MICROROS_COMPLETE_IMPL
193193

194194
RCUTILS_LOG_DEBUG_NAMED(ROS_PACKAGE_NAME, "Client initialized");
195195
TRACETOOLS_TRACEPOINT(
@@ -259,7 +259,7 @@ rcl_client_fini(rcl_client_t * client, rcl_node_t * node)
259259
RCUTILS_SAFE_FWRITE_TO_STDERR(rcl_get_error_string().str);
260260
result = RCL_RET_ERROR;
261261
}
262-
#endif // RCL_MICROROS_COMPLETE_IMPL
262+
#endif // RCL_MICROROS_COMPLETE_IMPL
263263
allocator.deallocate(client->impl->remapped_service_name, allocator.state);
264264
client->impl->remapped_service_name = NULL;
265265

‎rcl/src/rcl/client_impl.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct rcl_client_impl_s
3131
char * remapped_service_name;
3232
#ifdef RCL_MICROROS_COMPLETE_IMPL
3333
rosidl_type_hash_t type_hash;
34-
#endif // RCL_MICROROS_COMPLETE_IMPL
34+
#endif // RCL_MICROROS_COMPLETE_IMPL
3535
bool in_use_by_waitset;
3636
};
3737

‎rcl/src/rcl/context.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ rcl_get_zero_initialized_context(void)
3535
// this is not constexpr so it cannot be in the struct initialization
3636
#ifdef RCL_MICROROS_COMPLETE_IMPL
3737
context.global_arguments = rcl_get_zero_initialized_arguments();
38-
#endif // RCL_MICROROS_COMPLETE_IMPL
38+
#endif // RCL_MICROROS_COMPLETE_IMPL
3939
return context;
4040
}
4141

@@ -121,7 +121,7 @@ __cleanup_context(rcl_context_t * context)
121121
rcl_reset_error();
122122
}
123123
}
124-
#endif // RCL_MICROROS_COMPLETE_IMPL
124+
#endif // RCL_MICROROS_COMPLETE_IMPL
125125

126126
// if impl is null, nothing else can be cleaned up
127127
if (NULL != context->impl) {

‎rcl/src/rcl/init.c‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ extern "C"
2929

3030
#ifdef RCL_MICROROS_COMPLETE_IMPL
3131
#include "rcl/arguments.h"
32-
#endif // RCL_MICROROS_COMPLETE_IMPL
32+
#endif // RCL_MICROROS_COMPLETE_IMPL
3333
#include "rcl/discovery_options.h"
3434
#include "rcl/domain_id.h"
3535
#include "rcl/error_handling.h"
3636
#ifdef RCL_MICROROS_COMPLETE_IMPL
3737
#include "rcl/logging.h"
38-
#endif // RCL_MICROROS_COMPLETE_IMPL
38+
#endif // RCL_MICROROS_COMPLETE_IMPL
3939
#include "rcl/security.h"
4040
#include "rcl/validate_enclave_name.h"
4141

4242
#ifdef RCL_MICROROS_COMPLETE_IMPL
4343
#include "./arguments_impl.h"
44-
#endif // RCL_MICROROS_COMPLETE_IMPL
44+
#endif // RCL_MICROROS_COMPLETE_IMPL
4545
#include "./common.h"
4646
#include "./context_impl.h"
4747
#include "./init_options_impl.h"
@@ -88,7 +88,7 @@ rcl_init(
8888
#ifdef RCL_MICROROS_COMPLETE_IMPL
8989
// Zero initialize global arguments.
9090
context->global_arguments = rcl_get_zero_initialized_arguments();
91-
#endif // RCL_MICROROS_COMPLETE_IMPL
91+
#endif // RCL_MICROROS_COMPLETE_IMPL
9292

9393
// Setup impl for context.
9494
// use zero_allocate so the cleanup function will not try to clean up uninitialized parts later
@@ -138,7 +138,7 @@ rcl_init(
138138
RCUTILS_LOG_ERROR_NAMED(ROS_PACKAGE_NAME, "Failed to parse global arguments");
139139
goto fail;
140140
}
141-
#endif // RCL_MICROROS_COMPLETE_IMPL
141+
#endif // RCL_MICROROS_COMPLETE_IMPL
142142

143143
// Set the instance id.
144144
static uint32_t next_instance_id = 0;
@@ -229,6 +229,10 @@ rcl_init(
229229
context->impl->init_options.impl->rmw_init_options.enclave = rcutils_strdup(
230230
"/", context->impl->allocator);
231231
}
232+
#else
233+
context->impl->init_options.impl->rmw_init_options.enclave = rcutils_strdup(
234+
"/", context->impl->allocator);
235+
#endif // RCL_MICROROS_COMPLETE_IMPL
232236

233237
if (!context->impl->init_options.impl->rmw_init_options.enclave) {
234238
RCL_SET_ERROR_MSG("failed to set context name");
@@ -266,7 +270,6 @@ rcl_init(
266270
fail_ret = ret;
267271
goto fail;
268272
}
269-
#endif //RCL_MICROROS
270273

271274
// Initialize rmw_init.
272275
rmw_ret_t rmw_ret = rmw_init(

0 commit comments

Comments
 (0)