From df87fade0e807d709628d5c31d8d4cc512c61eef Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Wed, 1 Oct 2025 16:35:20 +0900 Subject: [PATCH] Add CI (#4) --- .github/workflows/test.yaml | 77 +++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 28 +++++++------- 2 files changed, 91 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..e9d5e82 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,77 @@ +# Copyright 2025 Enactic, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Test +on: + push: + branches: + - '**' + - '!dependabot/**' + tags: + - '**' + pull_request: +concurrency: + group: ${{ github.head_ref || github.sha }}-${{ github.workflow }} + cancel-in-progress: true +jobs: + build: + name: Build + runs-on: ${{ matrix.runs-on }} + timeout-minutes: 5 + strategy: + fail-fast: false + matrix: + runs-on: + - ubuntu-22.04 + steps: + - uses: actions/checkout@v5 + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y -V \ + cmake \ + libkdl-parser-dev \ + liborocos-kdl-dev \ + liburdfdom-headers-dev \ + libyaml-cpp-dev \ + ninja-build + - uses: actions/checkout@v5 + with: + path: openarm_can + repository: enactic/openarm_can + - name: "OpenArm CAN: CMake" + run: | + cmake \ + -B openarm_can.build \ + -S openarm_can \ + -GNinja \ + -DCMAKE_INSTALL_PREFIX=$PWD/install \ + -DCMAKE_BUILD_TYPE=Debug + - name: "OpenArm CAN: Build" + run: | + ninja -C openarm_can.build + - name: "OpenArm CAN: Install" + run: | + ninja -C openarm_can.build install + - name: CMake + run: | + cmake \ + -B build \ + -S . \ + -GNinja \ + -DCMAKE_INSTALL_PREFIX=$PWD/install \ + -DCMAKE_BUILD_TYPE=Debug + - name: Build + run: | + ninja -C build diff --git a/CMakeLists.txt b/CMakeLists.txt index 16fa235..03c241f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,9 @@ find_package(Eigen3 REQUIRED) find_package(urdfdom REQUIRED) find_package(urdfdom_headers REQUIRED) find_package(yaml-cpp REQUIRED) +if(NOT TARGET yaml-cpp::yaml-cpp AND TARGET yaml-cpp) + add_library(yaml-cpp::yaml-cpp ALIAS yaml-cpp) +endif() # ----------------------------- # Create static library @@ -45,18 +48,19 @@ add_library(openarm_teleop_lib STATIC ) target_include_directories( - openarm_teleop_lib PUBLIC - ${EIGEN3_INCLUDE_DIRS} + openarm_teleop_lib + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ) target_link_libraries(openarm_teleop_lib + PUBLIC OpenArmCAN::openarm_can - ${EIGEN3_LIBRARIES} + Eigen3::Eigen ${orocos_kdl_LIBRARIES} - kdl_parser - urdfdom_model - yaml-cpp + ${kdl_parser_LIBRARIES} + urdfdom::urdfdom_model + yaml-cpp::yaml-cpp ) # ----------------------------- @@ -67,11 +71,7 @@ add_executable(comm_test control/openarm_communication_test.cpp) add_executable(unilateral_control control/openarm_unilateral_control.cpp) add_executable(bilateral_control control/openarm_bilateral_control.cpp) -target_link_libraries(gravity_comp openarm_teleop_lib) -target_link_libraries(comm_test openarm_teleop_lib) -target_link_libraries(unilateral_control openarm_teleop_lib) -target_link_libraries(bilateral_control openarm_teleop_lib) - -target_include_directories(gravity_comp PRIVATE ${EIGEN3_INCLUDE_DIRS}) -target_include_directories(unilateral_control PRIVATE ${EIGEN3_INCLUDE_DIRS}) -target_include_directories(bilateral_control PRIVATE ${EIGEN3_INCLUDE_DIRS}) \ No newline at end of file +target_link_libraries(gravity_comp PRIVATE openarm_teleop_lib) +target_link_libraries(comm_test PRIVATE openarm_teleop_lib) +target_link_libraries(unilateral_control PRIVATE openarm_teleop_lib) +target_link_libraries(bilateral_control PRIVATE openarm_teleop_lib)