Skip to content

Commit fac59e6

Browse files
committed
micro-ROS Lyrical add CI
Signed-off-by: David Laseca Perez <davidlaseca@eprosima.com>
1 parent 4e92a88 commit fac59e6

33 files changed

Lines changed: 420 additions & 178 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
@@ -130,9 +130,9 @@ if(NOT RCL_MICROROS)
130130
endif()
131131

132132
if(NOT RCL_MICROROS)
133-
target_compile_definitions(${PROJECT_NAME}
134-
PUBLIC
135-
RCL_MICROROS_COMPLETE_IMPL
133+
target_compile_definitions(${PROJECT_NAME}
134+
PUBLIC
135+
RCL_MICROROS_COMPLETE_IMPL
136136
)
137137
endif()
138138

‎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 & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,23 @@ 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"
4848

49-
<<<<<<< HEAD
50-
#if defined(_WIN32) && !defined(__MINGW64__)
51-
static atomic_uint_least64_t __rcl_next_unique_id = {1};
52-
#else
53-
static atomic_uint_least64_t __rcl_next_unique_id = 1;
54-
#endif
55-
56-
=======
57-
>>>>>>> 4daed64 (micro-ROS Lyrical patch)
5849
rcl_ret_t
5950
rcl_init(
6051
int argc,
@@ -97,7 +88,7 @@ rcl_init(
9788
#ifdef RCL_MICROROS_COMPLETE_IMPL
9889
// Zero initialize global arguments.
9990
context->global_arguments = rcl_get_zero_initialized_arguments();
100-
#endif // RCL_MICROROS_COMPLETE_IMPL
91+
#endif // RCL_MICROROS_COMPLETE_IMPL
10192

10293
// Setup impl for context.
10394
// use zero_allocate so the cleanup function will not try to clean up uninitialized parts later
@@ -147,7 +138,7 @@ rcl_init(
147138
RCUTILS_LOG_ERROR_NAMED(ROS_PACKAGE_NAME, "Failed to parse global arguments");
148139
goto fail;
149140
}
150-
#endif // RCL_MICROROS_COMPLETE_IMPL
141+
#endif // RCL_MICROROS_COMPLETE_IMPL
151142

152143
// Set the instance id.
153144
static uint32_t next_instance_id = 0;
@@ -238,6 +229,10 @@ rcl_init(
238229
context->impl->init_options.impl->rmw_init_options.enclave = rcutils_strdup(
239230
"/", context->impl->allocator);
240231
}
232+
#else
233+
context->impl->init_options.impl->rmw_init_options.enclave = rcutils_strdup(
234+
"/", context->impl->allocator);
235+
#endif // RCL_MICROROS_COMPLETE_IMPL
241236

242237
if (!context->impl->init_options.impl->rmw_init_options.enclave) {
243238
RCL_SET_ERROR_MSG("failed to set context name");
@@ -275,7 +270,6 @@ rcl_init(
275270
fail_ret = ret;
276271
goto fail;
277272
}
278-
#endif //RCL_MICROROS
279273

280274
// Initialize rmw_init.
281275
rmw_ret_t rmw_ret = rmw_init(

0 commit comments

Comments
 (0)