Skip to content

Add Ubuntu Noble - Zenoh github action #621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ci/after_make.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# It's necessary to install the python modules for the test.
make install
make install
4 changes: 3 additions & 1 deletion .github/ci/before_cmake.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Set ROS_DISTRO. This is needed for finding zenoh packages vendored by ROS 2
# Instead of sourcing ros setup script, set only required env variables.
# This is needed for finding zenoh packages vendored by ROS 2.
export ROS_DISTRO="jazzy"
export LD_LIBRARY_PATH="/opt/ros/${ROS_DISTRO}/opt/zenoh_cpp_vendor/lib:$LD_LIBRARY_PATH"
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ jobs:
cppcheck-enabled: true
cpplint-enabled: true
doxygen-enabled: true
noble-ci-zenoh:
runs-on: ubuntu-latest
name: Ubuntu Noble CI - Zenoh
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compile and test
id: ci
uses: gazebo-tooling/action-gz-ci@noble
with:
cmake-args: '-DGZ_TRANSPORT_DEFAULT_IMPLEMENTATION=zenoh'
17 changes: 13 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ gz_find_package(GzProtobuf
#--------------------------------------
# Find ZeroMQ
gz_find_package(ZeroMQ VERSION 4 REQUIRED PRIVATE)
list(APPEND GZ_TRANSPORT_IMPLEMENTATION_LIST "zeromq")

if (UNIX AND NOT APPLE)
execute_process(COMMAND lsb_release -cs
Expand All @@ -97,8 +98,8 @@ gz_find_package(CPPZMQ REQUIRED PRIVATE

########################################
# Find Zenoh
gz_find_package(zenohc PRIVATE)
gz_find_package(zenohcxx PRIVATE)
gz_find_package(zenohc PRIVATE QUIET)
gz_find_package(zenohcxx PRIVATE QUIET)

# If both zenohc and zenohcpp packages are not found then
# look for these pacakages installed by ROS 2 zenoh_cpp_vendor package
Expand All @@ -108,8 +109,8 @@ if (NOT zenohc_FOUND AND NOT zenohcxx_FOUND)
set(ros2_zenoh_cmake_path "/opt/ros/$ENV{ROS_DISTRO}/opt/zenoh_cpp_vendor/lib/cmake")
if (EXISTS ${ros2_zenoh_cmake_path})
list(PREPEND CMAKE_PREFIX_PATH ${ros2_zenoh_cmake_path})
find_package(zenohc QUIET)
find_package(zenohcxx QUIET)
gz_find_package(zenohc PRIVATE QUIET)
gz_find_package(zenohcxx PRIVATE QUIET)
endif()
endif ()

Expand All @@ -123,6 +124,7 @@ else ()
message (STATUS "Looking for zenohcxx and zenohc - found")
set (HAVE_ZENOH ON CACHE BOOL "HAVE ZENOH" FORCE)
list(APPEND EXTRA_TEST_LIB_DEPS "zenohcxx::zenohc")
list(APPEND GZ_TRANSPORT_IMPLEMENTATION_LIST "zenoh")
endif ()

#--------------------------------------
Expand Down Expand Up @@ -168,6 +170,13 @@ gz_find_package(SQLite3
PRIVATE_FOR log
PRETTY sqlite3)

#--------------------------------------
# Check GZ_TRANSPORT_DEFAULT_IMPLEMENTATION value
set(GZ_TRANSPORT_DEFAULT_IMPLEMENTATION "zeromq" CACHE
STRING "Set default gz-transport implementation")
if (NOT ${GZ_TRANSPORT_DEFAULT_IMPLEMENTATION} IN_LIST GZ_TRANSPORT_IMPLEMENTATION_LIST)
message(FATAL_ERROR "Invalid GZ_TRANSPORT_DEFAULT_IMPLEMENTATION value: ${GZ_TRANSPORT_DEFAULT_IMPLEMENTATION}")
endif()

#============================================================================
# Configure the build
Expand Down
4 changes: 4 additions & 0 deletions include/gz/transport/Helpers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ namespace gz
/// \returns id of current process
unsigned int GZ_TRANSPORT_VISIBLE getProcessId();

/// \brief Get the name of the underlying transport implementation
/// \returns Name of the transport implementation, e.g. "zeromq", "zenoh"
std::string GZ_TRANSPORT_VISIBLE getTransportImplementation();

// Use safer functions on Windows
#ifdef _MSC_VER
#define gz_strcat strcat_s
Expand Down
1 change: 1 addition & 0 deletions include/gz/transport/config.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@
#cmakedefine HAVE_IFADDRS 1
#cmakedefine UBUNTU_FOCAL 1
#cmakedefine HAVE_ZENOH 1
#cmakedefine GZ_TRANSPORT_DEFAULT_IMPLEMENTATION "${GZ_TRANSPORT_DEFAULT_IMPLEMENTATION}"

#endif
3 changes: 3 additions & 0 deletions log/src/LogCommandAPI_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "cmd/LogCommandAPI.hh"
#include "gtest/gtest.h"

#include "test_utils.hh"

//////////////////////////////////////////////////
TEST(LogCommandAPI, Version)
{
Expand Down Expand Up @@ -55,6 +57,7 @@ TEST(LogCommandAPI, PlaybackBadRemap)
//////////////////////////////////////////////////
TEST(LogCommandAPI, RecordFailedToOpen)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")
EXPECT_EQ(FAILED_TO_OPEN, recordTopics("!@#$%^&*(:;[{]})?/.'|", ".*"));
}

Expand Down
4 changes: 4 additions & 0 deletions log/src/Recorder_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#include "gz/transport/log/Recorder.hh"
#include "gtest/gtest.h"

#include "test_utils.hh"

using namespace gz;

//////////////////////////////////////////////////
Expand Down Expand Up @@ -85,6 +87,8 @@ TEST(Record, AddInvalidTopic)
//////////////////////////////////////////////////
TEST(Record, AddTopicRegex)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

transport::log::Recorder recorder;
EXPECT_EQ(0, recorder.AddTopic(std::regex("////")));
}
Expand Down
13 changes: 11 additions & 2 deletions log/src/cmd/LogCommandAPI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <gz/transport/log/Export.hh>
#include <gz/transport/log/Playback.hh>
#include <gz/transport/log/Recorder.hh>
#include <gz/transport/Helpers.hh>
#include <gz/transport/Node.hh>
#include <gz/transport/NodeOptions.hh>
#include "../Console.hh"
Expand Down Expand Up @@ -60,8 +61,16 @@ int recordTopics(const char *_file, const char *_pattern)

transport::log::Recorder recorder;

if (recorder.AddTopic(regexPattern) < 0)
return FAILED_TO_SUBSCRIBE;
// Recorder functionality is not working in zenoh implementation yet
// Continue executing the rest of this function for the gz_log_record_* ruby
// test.
// \todo(iche033) Remove this check once supported.
if (gz::transport::getTransportImplementation() != "zenoh")
{
LWRN("Recording is not supported in zenoh\n");
if (recorder.AddTopic(regexPattern) < 0)
return FAILED_TO_SUBSCRIBE;
}

if (recorder.Start(_file) != transport::log::RecorderError::SUCCESS)
return FAILED_TO_OPEN;
Expand Down
14 changes: 14 additions & 0 deletions log/test/integration/playback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ bool ExpectSameMessages(
/// the original.
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayLog))
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

std::vector<MessageInformation> incomingData;
Expand Down Expand Up @@ -202,6 +204,8 @@ TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayNoSuchTopic))
/// the original.
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayLogRegex))
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

std::vector<MessageInformation> incomingData;
Expand Down Expand Up @@ -269,6 +273,8 @@ TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayLogRegex))
/// that the playback matches the original.
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(RemoveTopic))
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

std::vector<MessageInformation> incomingData;
Expand Down Expand Up @@ -378,6 +384,8 @@ TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(RemoveTopic))
/// the original.
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayLogMoveInstances))
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

std::vector<MessageInformation> incomingData;
Expand Down Expand Up @@ -448,6 +456,8 @@ TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayLogMoveInstances))
/// methods to control the playback flow.
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayPauseResume))
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

std::vector<MessageInformation> incomingData;
Expand Down Expand Up @@ -570,6 +580,8 @@ TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplayPauseResume))
/// the playback workflow.
TEST(playback, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(ReplayStep))
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

std::vector<MessageInformation> incomingData;
Expand Down Expand Up @@ -686,6 +698,8 @@ TEST(playback, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(ReplayStep))
/// the playback workflow.
TEST(playback, GZ_UTILS_TEST_DISABLED_ON_MAC(ReplaySeek))
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

std::vector<std::string> topics = {"/foo", "/bar", "/baz"};

std::vector<MessageInformation> incomingData;
Expand Down
18 changes: 18 additions & 0 deletions log/test/integration/recorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ void VerifyMessage(const gz::transport::log::Message &_msg,
TEST(recorder,
GZ_UTILS_TEST_DISABLED_ON_MAC(BeginRecordingTopicsBeforeAdvertisement))
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

// Remember to include a leading slash so that the VerifyTopic lambda below
// will work correctly. gz-transport automatically adds a leading slash to
// topics that don't specify one.
Expand Down Expand Up @@ -146,6 +148,8 @@ TEST(recorder,
/// so we only test to see that we received the very last message.
TEST(recorder, BeginRecordingTopicsAfterAdvertisement)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

std::vector<std::string> topics = {"/foo", "/bar"};

const std::string logName =
Expand Down Expand Up @@ -272,12 +276,16 @@ void RecordPatternBeforeAdvertisement(const std::regex &_pattern)
//////////////////////////////////////////////////
TEST(recorder, BeginRecordingPatternBeforeAdvertisement)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

RecordPatternBeforeAdvertisement(std::regex(".*foo.*"));
}

//////////////////////////////////////////////////
TEST(recorder, BeginRecordingAllBeforeAdvertisement)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

RecordPatternBeforeAdvertisement(std::regex(".*"));
}

Expand All @@ -287,6 +295,8 @@ TEST(recorder, BeginRecordingAllBeforeAdvertisement)
/// data queue.
TEST(recorder, DataWriterQueue)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

// Remember to include a leading slash so that the VerifyTopic lambda below
// will work correctly. gz-transport automatically adds a leading slash to
// topics that don't specify one.
Expand Down Expand Up @@ -376,6 +386,8 @@ TEST(recorder, DataWriterQueue)
/// Test that clock is properly recorded
TEST(recorder, DataWriterQueueClockUpdates)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

// Remember to include a leading slash so that the VerifyTopic lambda below
// will work correctly. gz-transport automatically adds a leading slash to
// topics that don't specify one.
Expand Down Expand Up @@ -517,13 +529,17 @@ void TestBufferSizeSettings(const std::optional<std::size_t> &_bufferSize,
/// Test default buffer size setting
TEST(recorder, DataWriterQueueDefaultBufferSize)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

TestBufferSizeSettings(std::nullopt, 50);
}

//////////////////////////////////////////////////
/// Test infinite buffer size setting
TEST(recorder, DataWriterQueueInfiniteBufferSize)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

TestBufferSizeSettings(0, 50);
}

Expand All @@ -532,6 +548,8 @@ TEST(recorder, DataWriterQueueInfiniteBufferSize)
/// still get recorded
TEST(recorder, DataWriterQueueLargeMessages)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")

TestBufferSizeSettings(1, 1);
}

Expand Down
2 changes: 1 addition & 1 deletion parameters/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endif()
gz_build_tests(
TYPE "UNIT"
SOURCES ${gtest_sources}
LIB_DEPS ${param_lib_target} ${EXTRA_TEST_LIB_DEPS}
LIB_DEPS ${param_lib_target} ${EXTRA_TEST_LIB_DEPS} test_config
)

if(NOT WIN32)
Expand Down
4 changes: 4 additions & 0 deletions parameters/src/cmd/ParamCommandAPI_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#include "gtest/gtest.h"

#include "test_utils.hh"

using namespace gz;
using namespace transport;
using namespace transport::parameters;
Expand Down Expand Up @@ -137,6 +139,7 @@ TEST_F(ParametersClientTest, cmdParameterGet)
//////////////////////////////////////////////////
TEST_F(ParametersClientTest, SetParameter)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")
{
CaptureCoutScoped coutCapture;
CaptureCerrScoped cerrCapture;
Expand Down Expand Up @@ -187,6 +190,7 @@ TEST_F(ParametersClientTest, SetParameter)
//////////////////////////////////////////////////
TEST_F(ParametersClientTest, ListParameters)
{
CHECK_UNSUPPORTED_IMPLEMENTATION("zenoh")
{
CaptureCoutScoped coutCapture;
CaptureCerrScoped cerrCapture;
Expand Down
15 changes: 10 additions & 5 deletions python/src/transport/_gz_transport_pybind11.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include <google/protobuf/message.h>
#include <gz/transport/Node.hh>
#include <gz/transport/Helpers.hh>

#include <pybind11/functional.h>
#include <pybind11/pybind11.h>
Expand Down Expand Up @@ -68,7 +69,7 @@ PYBIND11_MODULE(BINDINGS_MODULE_NAME, m) {
&AdvertiseMessageOptions::MsgsPerSec,
&AdvertiseMessageOptions::SetMsgsPerSec,
"The maximum number of messages per second to be published")
.def("__copy__",
.def("__copy__",
[](const AdvertiseMessageOptions &self)
{
return AdvertiseMessageOptions(self);
Expand Down Expand Up @@ -110,9 +111,9 @@ PYBIND11_MODULE(BINDINGS_MODULE_NAME, m) {
},
py::arg("from_topic"),
"Get a topic remapping. Returns a pair with the result of the method"
"and the remapped name of the topic. The topic name remains empty if"
"and the remapped name of the topic. The topic name remains empty if"
"there isn't any remap for the topic")
.def("__copy__",
.def("__copy__",
[](const NodeOptions &self)
{
return NodeOptions(self);
Expand All @@ -135,7 +136,7 @@ PYBIND11_MODULE(BINDINGS_MODULE_NAME, m) {
&SubscribeOptions::MsgsPerSec,
&SubscribeOptions::SetMsgsPerSec,
"Set the maximum number of messages per second received per topic")
.def("__copy__",
.def("__copy__",
[](const SubscribeOptions &self)
{
return SubscribeOptions(self);
Expand Down Expand Up @@ -304,7 +305,7 @@ PYBIND11_MODULE(BINDINGS_MODULE_NAME, m) {
"Get the current statistics for a topic. Statistics must"
"have been enabled using the EnableStats function, otherwise"
"the return value will be null.");

// Register Node::Publisher as a subclass of Node
py::class_<gz::transport::Node::Publisher>(node, "Publisher",
"A class that is used to store information about an"
Expand All @@ -323,6 +324,10 @@ PYBIND11_MODULE(BINDINGS_MODULE_NAME, m) {
.def("has_connections",
&gz::transport::Node::Publisher::HasConnections,
"Return true if this publisher has subscribers");

m.def("transport_implementation", &getTransportImplementation,
"Get the name of the underlying transport implementation.");

} // gz-transport module

} // python
Expand Down
Loading