From 7a18aae070a873ec8308c01830b83a6235313269 Mon Sep 17 00:00:00 2001 From: Filippo Brizzi Date: Fri, 2 Feb 2024 12:58:19 +0000 Subject: [PATCH] Fix: CI (#17) # Description - Update zenohc and zenohcxx to the version that fixes the cmake istall - Fix some clang-tidy warning ## Type of change - Bug fix (non-breaking change which fixes an issue)\ ## Checklist before requesting a review - [ ] I have performed a self-review of my code. - [ ] If it is a core feature, I have added thorough tests. - [ ] If this is a new component I have added examples. - [ ] I updated the README and related documentation. --- CMakePresets.json | 19 ++++++++++++++++--- cmake/06_packager_config.cmake | 2 +- docker/Dockerfile_deps | 3 ++- docker/build.sh | 2 +- docker/build_deps.sh | 6 +++--- docker/version.sh | 4 ++-- external/CMakeLists.txt | 12 ++++++++---- .../cli/include/eolo/cli/program_options.h | 10 +++++----- modules/ipc/examples/zenoh_sub.cpp | 1 + modules/ipc/include/eolo/ipc/zenoh/utils.h | 16 ++++++++-------- modules/utils/src/version_impl.h | 4 ++-- 11 files changed, 49 insertions(+), 30 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 238f4750..115d9d09 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -2,7 +2,7 @@ "version": 7, "configurePresets": [ { - "name": "preferred", + "name": "default", "description": "Configuration setting for all modules with preferred toolchain", "generator": "Ninja", "binaryDir": "${sourceDir}/build", @@ -12,6 +12,19 @@ "BUILD_MODULES": "all" } }, + { + "name": "fast", + "description": "Configuration setting for all modules with preferred toolchain", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build", + "installDir": "/install", + "toolchainFile": "${sourceDir}/toolchains/toolchain_clang.cmake", + "cacheVariables": { + "BUILD_MODULES": "all", + "ENABLE_LINTER": "OFF", + "CMAKE_BUILD_TYPE": "Release" + } + }, { "name": "deps-docker", "description": "Configuration setting for all modules with preferred toolchain", @@ -42,9 +55,9 @@ ], "buildPresets": [ { - "name": "preferred", + "name": "default", "description": "Preferred build settings", - "configurePreset": "preferred" + "configurePreset": "default" } ] } diff --git a/cmake/06_packager_config.cmake b/cmake/06_packager_config.cmake index a0b443bb..a958f4e6 100644 --- a/cmake/06_packager_config.cmake +++ b/cmake/06_packager_config.cmake @@ -4,7 +4,7 @@ set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) set(CPACK_PACKAGE_VERSION ${EOLO_VERSION}) -set(CPACK_PACKAGE_VENDOR "Vilas Kumar Chitrakaran") +set(CPACK_PACKAGE_VENDOR "Filippo Brizzi") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") set(CPACK_GENERATOR "DEB") diff --git a/docker/Dockerfile_deps b/docker/Dockerfile_deps index ee11a596..eb5a9ae7 100644 --- a/docker/Dockerfile_deps +++ b/docker/Dockerfile_deps @@ -12,6 +12,7 @@ RUN . "$HOME/.cargo/env" && cmake ../ --preset deps-docker RUN ninja all && \ ninja install -RUN cd / && rm -rf /tmp/eolo +# Remove all eolo install +RUN cd / && rm -rf /tmp/eolo && rm -rf /install/include/eolo && rm -rf /install/lib/libeolo* && rm -rf /install/lib/cmake/eolo* && rm -rf /install/share/eolo* WORKDIR / diff --git a/docker/build.sh b/docker/build.sh index a62ec90d..af4598d7 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -20,7 +20,7 @@ fi ncores=$(cat /proc/cpuinfo | grep processor | wc -l) -IMAGE_NAME="ghcr.io/filippobrizzi/${ARCH}/${IMAGE}" +IMAGE_NAME="${HOST}/${ARCH}/${IMAGE}" function docker_tag_exists() { docker manifest inspect ${IMAGE_NAME}:${VERSION} > /dev/null diff --git a/docker/build_deps.sh b/docker/build_deps.sh index 699f8926..f7014a46 100755 --- a/docker/build_deps.sh +++ b/docker/build_deps.sh @@ -8,14 +8,14 @@ if [ "${ARCH}" == "aarch64" ]; then ARCH = "arm64" fi -BASE_IMAGE=ghcr.io/filippobrizzi/${ARCH}/${IMAGE}:${VERSION} +BASE_IMAGE=${HOST}/${ARCH}/${IMAGE}:${VERSION} docker pull ${BASE_IMAGE} SUFFIX=deps -IMAGE_NAME="ghcr.io/filippobrizzi/${ARCH}/${IMAGE}_${SUFFIX}" +IMAGE_NAME="${HOST}/${ARCH}/${IMAGE}_${SUFFIX}" function docker_tag_exists() { - docker manifest inspect ${IMAGE_NAME}:${VERSION} > /dev/null + docker manifest inspect ${IMAGE_NAME}:${DEPS_VERSION} > /dev/null } if docker_tag_exists; then diff --git a/docker/version.sh b/docker/version.sh index 653e668a..d2778afc 100644 --- a/docker/version.sh +++ b/docker/version.sh @@ -1,6 +1,6 @@ - +HOST=ghcr.io/filippobrizzi VERSION=1.0.2 IMAGE=eolo-dev # This is the version of the dep image. Increase this number everytime you change `external/CMakeLists.txt` -DEPS_VERSION=1.0.2 +DEPS_VERSION=1.0.3 diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index e9f726ec..d28be9e1 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -93,8 +93,10 @@ if(zenohcxx IN_LIST EXTERNAL_PROJECTS_LIST) ExternalProject_Add( zenohc DEPENDS zenohd - GIT_REPOSITORY "https://github.com/eclipse-zenoh/zenoh-c.git" - GIT_TAG d1ec83dee421054bed034e0e60abc98a526bae0a # v${zenohc_VERION_REQUIRED} + GIT_REPOSITORY https://github.com/filippobrizzi/zenoh-c.git + GIT_TAG df4682bd397723a62853dae62cdf65305c08958d + # GIT_REPOSITORY "https://github.com/eclipse-zenoh/zenoh-c.git" + # GIT_TAG d1ec83dee421054bed034e0e60abc98a526bae0a # v${zenohc_VERION_REQUIRED} GIT_SHALLOW true CMAKE_ARGS ${EP_CMAKE_EXTRA_ARGS} -DCMAKE_VERBOSE_MAKEFILE=ON) endif() @@ -110,8 +112,10 @@ if(zenohcxx IN_LIST EXTERNAL_PROJECTS_LIST) ExternalProject_Add( zenohcxx DEPENDS zenohc - GIT_REPOSITORY "https://github.com/eclipse-zenoh/zenoh-cpp.git" - GIT_TAG 10ced293dd72ed5ec55c36b57672e0cc21932761 # v${zenohcxx_VERION_REQUIRED} + GIT_REPOSITORY "https://github.com/filippobrizzi/zenoh-cpp.git" + GIT_TAG 457775eecc2b4fab15349464c373e59127896c28 + # GIT_REPOSITORY "https://github.com/eclipse-zenoh/zenoh-cpp.git" + # GIT_TAG 10ced293dd72ed5ec55c36b57672e0cc21932761 # v${zenohcxx_VERION_REQUIRED} GIT_SHALLOW true SOURCE_SUBDIR install # configure the 'install' sub-project to avoid # building zenoh-c again diff --git a/modules/cli/include/eolo/cli/program_options.h b/modules/cli/include/eolo/cli/program_options.h index d15f65b0..294fabfc 100644 --- a/modules/cli/include/eolo/cli/program_options.h +++ b/modules/cli/include/eolo/cli/program_options.h @@ -190,15 +190,15 @@ constexpr auto ProgramDescription::defineOption(const std::string& key, char sho } template -inline constexpr auto ProgramDescription::defineOption(const std::string& key, const std::string& description, - const T& default_value) -> ProgramDescription& { +constexpr auto ProgramDescription::defineOption(const std::string& key, const std::string& description, + const T& default_value) -> ProgramDescription& { return defineOption(key, '\0', description, default_value); } template -inline constexpr auto ProgramDescription::defineOption(const std::string& key, char short_key, - const std::string& description, - const T& default_value) -> ProgramDescription& { +constexpr auto ProgramDescription::defineOption(const std::string& key, char short_key, + const std::string& description, + const T& default_value) -> ProgramDescription& { checkOptionAlreadyExists(key, short_key); options_.emplace_back(key, short_key, description, utils::getTypeName(), diff --git a/modules/ipc/examples/zenoh_sub.cpp b/modules/ipc/examples/zenoh_sub.cpp index 934ca4ec..3b30e59c 100644 --- a/modules/ipc/examples/zenoh_sub.cpp +++ b/modules/ipc/examples/zenoh_sub.cpp @@ -40,6 +40,7 @@ auto main(int argc, const char* argv[]) -> int { }; auto subscriber = eolo::ipc::subscribe( session, std::move(config), std::move(cb)); + (void)subscriber; while (true) { std::this_thread::sleep_for(std::chrono::seconds{ 1 }); diff --git a/modules/ipc/include/eolo/ipc/zenoh/utils.h b/modules/ipc/include/eolo/ipc/zenoh/utils.h index 69a59dad..520aa8a1 100644 --- a/modules/ipc/include/eolo/ipc/zenoh/utils.h +++ b/modules/ipc/include/eolo/ipc/zenoh/utils.h @@ -15,11 +15,11 @@ #include "eolo/ipc/common.h" namespace eolo::ipc::zenoh { -[[nodiscard]] inline static constexpr auto messageCounterKey() -> const char* { +[[nodiscard]] static constexpr auto messageCounterKey() -> const char* { return "msg_counter"; } -[[nodiscard]] inline static constexpr auto sessionIdKey() -> const char* { +[[nodiscard]] static constexpr auto sessionIdKey() -> const char* { return "session_id"; } @@ -28,7 +28,7 @@ inline auto toString(const zenohc::Id& id) -> std::string { [](const std::string& s, uint8_t v) { return std::format("{:02x}", v) + s; }); } -inline constexpr auto toString(const zenohc::WhatAmI& me) -> std::string_view { +constexpr auto toString(const zenohc::WhatAmI& me) -> std::string_view { switch (me) { case zenohc::WhatAmI::Z_WHATAMI_ROUTER: return "Router"; @@ -39,7 +39,7 @@ inline constexpr auto toString(const zenohc::WhatAmI& me) -> std::string_view { } } -inline constexpr auto toString(const Mode& mode) -> std::string_view { +constexpr auto toString(const Mode& mode) -> std::string_view { switch (mode) { case Mode::ROUTER: return "Router"; @@ -50,7 +50,7 @@ inline constexpr auto toString(const Mode& mode) -> std::string_view { } } -inline constexpr auto toMode(const zenohc::WhatAmI& me) -> Mode { +constexpr auto toMode(const zenohc::WhatAmI& me) -> Mode { switch (me) { case zenohc::WhatAmI::Z_WHATAMI_ROUTER: return Mode::ROUTER; @@ -95,7 +95,7 @@ inline auto toChrono(const zenohc::Timestamp& ts) -> std::chrono::nanoseconds { } template -inline constexpr auto expect(std::variant&& v) -> T { +constexpr auto expect(std::variant&& v) -> T { if (std::holds_alternative(v)) { const auto msg = std::get(v).as_string_view(); throwException(std::format("zenoh error: {}", msg)); @@ -105,7 +105,7 @@ inline constexpr auto expect(std::variant&& v) -> T { } template -inline constexpr auto expectAsSharedPtr(std::variant&& v) -> std::shared_ptr { +constexpr auto expectAsSharedPtr(std::variant&& v) -> std::shared_ptr { if (std::holds_alternative(v)) { const auto msg = std::get(v).as_string_view(); throwException(std::format("zenoh error: {}", msg)); @@ -115,7 +115,7 @@ inline constexpr auto expectAsSharedPtr(std::variant&& } template -inline constexpr auto expectAsUniquePtr(std::variant&& v) -> std::unique_ptr { +constexpr auto expectAsUniquePtr(std::variant&& v) -> std::unique_ptr { if (std::holds_alternative(v)) { const auto msg = std::get(v).as_string_view(); throwException(std::format("zenoh error: {}", msg)); diff --git a/modules/utils/src/version_impl.h b/modules/utils/src/version_impl.h index 30c5fe58..79e611ad 100644 --- a/modules/utils/src/version_impl.h +++ b/modules/utils/src/version_impl.h @@ -17,8 +17,8 @@ static constexpr std::uint8_t VERSION_MAJOR = 0; static constexpr std::uint8_t VERSION_MINOR = 0; static constexpr std::uint16_t VERSION_PATCH = 0; -static constexpr std::string_view REPO_BRANCH = "github_actions"; +static constexpr std::string_view REPO_BRANCH = "fix_ci"; static constexpr std::string_view BUILD_PROFILE = "Release"; -static constexpr std::string_view REPO_HASH = "54ca190"; +static constexpr std::string_view REPO_HASH = "b858d03"; } // namespace eolo::utils