Skip to content

fix ubuntu CI #963

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 7 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
22 changes: 11 additions & 11 deletions .github/workflows/cmake_ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: cmake Ubuntu

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand All @@ -15,22 +20,17 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]

steps:
- uses: actions/checkout@v2

- name: Install Conan
id: conan
uses: turtlebrowser/get-conan@main
with:
version: 1.59.0

- name: Create default profile
run: conan profile new default --detect

- name: Update profile
run: conan profile update settings.compiler.libcxx=libstdc++11 default
run: conan profile detect

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
Expand All @@ -44,16 +44,16 @@ jobs:
- name: Configure CMake
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
run: cmake ${{github.workspace}} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake

- name: Build
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake --build . --config ${{env.BUILD_TYPE}}

- name: run test (Linux)
working-directory: ${{github.workspace}}/build
run: ./tests/behaviortree_cpp_test
working-directory: ${{github.workspace}}/build/tests
run: ctest

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
7 changes: 6 additions & 1 deletion .github/workflows/cmake_windows.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: cmake Windows

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/pixi.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Pixi (conda)

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
pixi_conda_build:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: pre-commit

on:
pull_request:
push:
branches: [master]
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
pre-commit:
Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/ros1.yaml

This file was deleted.

7 changes: 6 additions & 1 deletion .github/workflows/ros2-rolling.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: ros2-rolling

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
industrial_ci:
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ros2.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: ros2

on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
industrial_ci:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sonarcube.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Sonarcube Scan

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
name: Build
Expand Down
18 changes: 5 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(BTCPP_SHARED_LIBS "Build shared libraries" ON)
option(BTCPP_BUILD_TOOLS "Build commandline tools" ON)
option(BTCPP_EXAMPLES "Build tutorials and examples" ON)
option(BTCPP_UNIT_TESTS "Build the unit tests" ON)
option(BUILD_TESTING "Build the unit tests" ON)
option(BTCPP_GROOT_INTERFACE "Add Groot2 connection. Requires ZeroMQ" ON)
option(BTCPP_SQLITE_LOGGING "Add SQLite logging." ON)

Expand Down Expand Up @@ -82,15 +82,6 @@ if ( ament_cmake_FOUND )
message(STATUS "BehaviorTree is being built using AMENT.")
message(STATUS "------------------------------------------")
include(cmake/ament_build.cmake)

elseif( CATKIN_DEVEL_PREFIX OR CATKIN_BUILD_BINARY_PACKAGE)

add_definitions( -DUSING_ROS )
message(STATUS "------------------------------------------")
message(STATUS "BehaviorTree is being built using CATKIN.")
message(STATUS "------------------------------------------")
include(cmake/catkin_build.cmake)
set(catkin_FOUND TRUE)
else()
message(STATUS "------------------------------------------")
message(STATUS "BehaviorTree is being built with conan.")
Expand Down Expand Up @@ -229,15 +220,16 @@ endif()
#############################################################
message( STATUS "BTCPP_LIB_DESTINATION: ${BTCPP_LIB_DESTINATION} " )
message( STATUS "BTCPP_INCLUDE_DESTINATION: ${BTCPP_INCLUDE_DESTINATION} " )
message( STATUS "BTCPP_UNIT_TESTS: ${BTCPP_UNIT_TESTS} " )

if (BTCPP_UNIT_TESTS OR BTCPP_EXAMPLES)
if (BUILD_TESTING OR BTCPP_EXAMPLES)
add_subdirectory(sample_nodes)
endif()

######################################################

if (BTCPP_UNIT_TESTS)
include(CTest)
message( STATUS "BUILD_TESTING: ${BUILD_TESTING} " )
if (BUILD_TESTING)
add_subdirectory(tests)
endif()

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ If you are looking for a more fancy graphical user interface (and I know you do)

Three build systems are supported:

- **catkin**, if you use ROS
- **colcon (ament)**, if you use ROS2
- **conan** otherwise (Linux/Windows).
- **straight cmake** if you want to be personally responsible for dependencies :)
Expand Down
40 changes: 0 additions & 40 deletions cmake/catkin_build.cmake

This file was deleted.

3 changes: 1 addition & 2 deletions include/behaviortree_cpp/bt_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,8 @@ class BehaviorTreeFactory
/**
* @brief registerFromROSPlugins finds all shared libraries that export ROS plugins for behaviortree_cpp, and calls registerFromPlugin for each library.
* @throws If not compiled with ROS support or if the library cannot load for any reason
*
*/
void registerFromROSPlugins();
[[deprecated("Removed support for ROS1")]] void registerFromROSPlugins();

/**
* @brief registerBehaviorTreeFromFile.
Expand Down
3 changes: 0 additions & 3 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

<build_depend>ros_environment</build_depend>

<buildtool_depend condition="$ROS_VERSION == 1">catkin</buildtool_depend>
<depend condition="$ROS_VERSION == 1">roslib</depend>

<buildtool_depend condition="$ROS_VERSION == 2">ament_cmake</buildtool_depend>
<depend condition="$ROS_VERSION == 2">rclcpp</depend>
Expand All @@ -27,7 +25,6 @@
<test_depend condition="$ROS_VERSION == 2">ament_cmake_gtest</test_depend>

<export>
<build_type condition="$ROS_VERSION == 1">catkin</build_type>
<build_type condition="$ROS_VERSION == 2">ament_cmake</build_type>
</export>

Expand Down
58 changes: 0 additions & 58 deletions src/bt_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@
#include "behaviortree_cpp/xml_parsing.h"
#include "wildcards/wildcards.hpp"

#ifdef USING_ROS
#include <ros/package.h>
#endif

namespace BT
{

Expand Down Expand Up @@ -196,66 +192,12 @@ void BehaviorTreeFactory::registerFromPlugin(const std::string& file_path)
}
}

#ifdef USING_ROS

#ifdef _WIN32
const char os_pathsep(';'); // NOLINT
#else
const char os_pathsep(':'); // NOLINT
#endif

// This function is a copy from the one in class_loader_imp.hpp in ROS pluginlib
// package, licensed under BSD.
// https://github.com/ros/pluginlib
std::vector<std::string> getCatkinLibraryPaths()
{
std::vector<std::string> lib_paths;
const char* env = std::getenv("CMAKE_PREFIX_PATH");
if(env)
{
const std::string env_catkin_prefix_paths(env);
std::vector<BT::StringView> catkin_prefix_paths =
splitString(env_catkin_prefix_paths, os_pathsep);
for(BT::StringView catkin_prefix_path : catkin_prefix_paths)
{
std::filesystem::path path(static_cast<std::string>(catkin_prefix_path));
std::filesystem::path lib("lib");
lib_paths.push_back((path / lib).string());
}
}
return lib_paths;
}

void BehaviorTreeFactory::registerFromROSPlugins()
{
std::vector<std::string> plugins;
ros::package::getPlugins("behaviortree_cpp", "bt_lib_plugin", plugins, true);
std::vector<std::string> catkin_lib_paths = getCatkinLibraryPaths();

for(const auto& plugin : plugins)
{
auto filename = std::filesystem::path(plugin + BT::SharedLibrary::suffix());
for(const auto& lib_path : catkin_lib_paths)
{
const auto full_path = std::filesystem::path(lib_path) / filename;
if(std::filesystem::exists(full_path))
{
std::cout << "Registering ROS plugins from " << full_path.string() << std::endl;
registerFromPlugin(full_path.string());
break;
}
}
}
}
#else

void BehaviorTreeFactory::registerFromROSPlugins()
{
throw RuntimeError("Using attribute [ros_pkg] in <include>, but this library was "
"compiled without ROS support. Recompile the BehaviorTree.CPP "
"using catkin");
}
#endif

void BehaviorTreeFactory::registerBehaviorTreeFromFile(
const std::filesystem::path& filename)
Expand Down
8 changes: 1 addition & 7 deletions src/xml_parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
#include "tinyxml2/tinyxml2.h"
#include <filesystem>

#ifdef USING_ROS
#include <ros/package.h>
#endif

#ifdef USING_ROS2
#include <ament_index_cpp/get_package_share_directory.hpp>
#endif
Expand Down Expand Up @@ -283,9 +279,7 @@ void XMLParser::PImpl::loadDocImpl(XMLDocument* doc, bool add_includes)
else
{
std::string ros_pkg_path;
#ifdef USING_ROS
ros_pkg_path = ros::package::getPath(ros_pkg_relative_path);
#elif defined USING_ROS2
#if defined USING_ROS2
ros_pkg_path =
ament_index_cpp::get_package_share_directory(ros_pkg_relative_path);
#else
Expand Down
Loading
Loading