Skip to content

Commit

Permalink
Addes devices tests
Browse files Browse the repository at this point in the history
  • Loading branch information
randaz81 committed Dec 30, 2024
1 parent 5bc85fc commit e25d058
Show file tree
Hide file tree
Showing 12 changed files with 1,471 additions and 7 deletions.
294 changes: 294 additions & 0 deletions .github/workflows/conda-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
name: CI Workflow

on:
push:
pull_request:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
# Execute a "nightly" build at 2 AM UTC
- cron: '0 2 * * *'

jobs:

check-style:
name: 'Check Style'
runs-on: ubuntu-20.04
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install Dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq -y perl
- name: Check Style
run: |
perl tests/misc/check_style.pl
check-license:
name: 'Check License'
runs-on: ubuntu-20.04
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install Dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq -y perl
- name: Check License
run: |
perl tests/misc/check_license.pl
check-tests:
name: 'Check Devices Tests'
runs-on: ubuntu-20.04
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Install Dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -qq -y python3
- name: Check Devices Tests
run: |
python3 tests/misc/check_tests.py
build:
name: '[${{ matrix.os }}@${{ matrix.build_type }}@conda]'
runs-on: ${{ matrix.os }}
strategy:
matrix:
build_type: [Release]
os: [ubuntu-latest, macos-latest, windows-2019]
fail-fast: true

steps:
- uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest

- name: Dependencies
shell: bash -l {0}
run: |
# Compilation related dependencies
mamba install cmake compilers make ninja pkg-config
# Actual dependencies
mamba install -c conda-forge -c robostack-staging ycm-cmake-modules eigen ace sqlite nlohmann_json
- name: Download YARP [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
run: |
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/yarp
- name: Dependencies from source [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd ${GITHUB_WORKSPACE}
cd yarp
mkdir build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .. \
-DYARP_COMPILE_TESTS:BOOL=ON \
-DYARP_COMPILE_ALL_FAKE_DEVICES:BOOL=ON
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
echo "YARP_DATA_DIRS=${CONDA_PREFIX}/share/yarp::${YARP_DATA_DIRS}" >> $GITHUB_ENV
# curl
cd ${GITHUB_WORKSPACE}
git clone https://github.com/curl/curl.git
cd curl
mkdir -p build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
- name: Dependencies from source [Windows]
if: contains(matrix.os, 'windows')
shell: bash -l {0}
run: |
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/yarp
cd yarp
mkdir build
cd build
cmake -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .. \
-DYARP_COMPILE_TESTS:BOOL=ON \
-DYARP_COMPILE_ALL_FAKE_DEVICES:BOOL=ON
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
echo "YARP_DATA_DIRS=${CONDA_PREFIX}/Library/share/yarp;${YARP_DATA_DIRS}" >> $GITHUB_ENV
cd ${GITHUB_WORKSPACE}
git clone https://github.com/curl/curl.git
cd curl
mkdir -p build
cd build
cmake -G"Visual Studio 16 2019" -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
- name: Configure [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
mkdir -p build
cd build
cmake -GNinja -DBUILD_TESTING:BOOL=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} .. \
-DYARP_COMPILE_TESTS:BOOL=ON
- name: Configure [Windows]
if: contains(matrix.os, 'windows')
shell: bash -l {0}
run: |
mkdir -p build
cd build
cmake -G"Visual Studio 16 2019" -DBUILD_TESTING:BOOL=ON \
-DCMAKE_PREFIX_PATH=${CONDA_PREFIX}/Library \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX}/Library .. \
-DYARP_COMPILE_TESTS:BOOL=ON
- name: Build [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
- name: Install [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
cmake --install . --config ${{ matrix.build_type }}
- name: Test [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
ctest --output-on-failure -C ${{ matrix.build_type }}
- name: Build [Windows]
if: contains(matrix.os, 'windows')
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
- name: Install [Windows]
if: contains(matrix.os, 'windows')
shell: bash -l {0}
run: |
cd build
cmake --install . --config ${{ matrix.build_type }}
- name: Test [Windows]
if: contains(matrix.os, 'windows')
shell: bash -l {0}
run: |
cd build
ctest --output-on-failure -C ${{ matrix.build_type }}
build-valgrind:
name: 'valgrind [ubuntu-latest@Debug@humble@conda]'
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [Debug]
os: [ubuntu-latest]
fail-fast: false

steps:
- uses: actions/checkout@v3

- uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest

- name: Dependencies
shell: bash -l {0}
run: |
# Compilation related dependencies
mamba install cmake compilers make ninja pkg-config
# Actual dependencies
sudo apt update && sudo apt-get install -qq -y libc6-dbg
mamba install -c conda-forge -c robostack-staging ycm-cmake-modules valgrind ace sqlite
- name: Download YARP [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
run: |
cd ${GITHUB_WORKSPACE}
git clone https://github.com/robotology/yarp
- name: Dependencies from source [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd ${GITHUB_WORKSPACE}
cd yarp
mkdir build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} .. \
-DYARP_COMPILE_TESTS:BOOL=ON \
-DYARP_COMPILE_ALL_FAKE_DEVICES:BOOL=ON \
-DYARP_VALGRIND_TESTS:BOOL=ON
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
echo "YARP_DATA_DIRS=${CONDA_PREFIX}/share/yarp::${YARP_DATA_DIRS}" >> $GITHUB_ENV
# curl
cd ${GITHUB_WORKSPACE}
git clone https://github.com/curl/curl.git
cd curl
mkdir -p build
cd build
cmake -GNinja -DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ..
cmake --build . --config ${{ matrix.build_type }}
cmake --install . --config ${{ matrix.build_type }}
- name: Configure [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
mkdir -p build
cd build
cmake -GNinja -DBUILD_TESTING:BOOL=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DYARP_VALGRIND_TESTS:BOOL=ON \
-DCMAKE_INSTALL_PREFIX=${CONDA_PREFIX} .. \
-DYARP_COMPILE_TESTS:BOOL=ON
- name: Build [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
cmake --build . --config ${{ matrix.build_type }}
- name: Install [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
cmake --install . --config ${{ matrix.build_type }}
- name: Test [Linux&macOS]
if: contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')
shell: bash -l {0}
run: |
cd build
ctest --output-on-failure -C ${{ matrix.build_type }}
28 changes: 21 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
# All rights reserved.
#
# This software may be modified and distributed under the terms of the
# BSD-3-Clause license. See the accompanying LICENSE file for details.
# SPDX-FileCopyrightText: 2024 Istituto Italiano di Tecnologia (IIT)
# SPDX-License-Identifier: BSD-3-Clause

cmake_minimum_required(VERSION 3.17)
project(yarp-device-rpLidar
Expand Down Expand Up @@ -31,7 +28,23 @@ set(CMAKE_CXX_EXTENSIONS OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

set(YARP_FORCE_DYNAMIC_PLUGINS TRUE CACHE INTERNAL "yarp-device-rpLidar is always built with dynamic plugins")
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build libraries as shared as opposed to static")
set(BUILD_SHARED_LIBS "Build libraries as shared as opposed to static" ON)

find_package(YARP 3.10.0 COMPONENTS os sig dev OPTIONAL_COMPONENTS math REQUIRED)
find_package(YARP 3.10.0 COMPONENTS catch2 dev_tests QUIET)

if(YARP_catch2_FOUND AND YARP_dev_tests_FOUND)
option(YARP_COMPILE_TESTS "Enable YARP tests" OFF)
if(YARP_COMPILE_TESTS)
enable_testing()
endif()
message (STATUS "yarp_catch2 and yarp_dev_tests libraries found")
else()
SET(YARP_COMPILE_TESTS OFF CACHE BOOL "yarp_catch2 and yarp_dev_tests libraries NOT found. Tests cannot be enabled" FORCE)
message (STATUS "yarp_catch2 and yarp_dev_tests libraries NOT found. Tests cannot be enabled")
endif()

include(YarpValgrindOptions)

include(AddInstallRPATHSupport)
add_install_rpath_support(BIN_DIRS "${CMAKE_INSTALL_FULL_BINDIR}"
Expand All @@ -50,13 +63,14 @@ set_property(GLOBAL PROPERTY USE_FOLDERS 1)

include(AddUninstallTarget)

find_package(YARP 3.10.0 COMPONENTS os sig dev OPTIONAL_COMPONENTS math REQUIRED)
set(CMAKE_C_FLAGS "${YARP_C_FLAGS} ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${YARP_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")

yarp_configure_plugins_installation(yarp-device-rpLidar)
find_package(Doxygen)

feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES)

add_subdirectory(extern)
add_subdirectory(src)
add_subdirectory(tests)
Loading

0 comments on commit e25d058

Please sign in to comment.