Skip to content
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

Add Github Actions CI fo CMake and ROS #1

Merged
merged 26 commits into from
Nov 27, 2023
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
50 changes: 50 additions & 0 deletions .github/workflows/catkin_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'ROS Noetic: Build'

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
container: ros:noetic-ros-base-focal
steps:
- uses: actions/checkout@v3

- name: Install System Deps on Noetic
run: |
apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
apt update && apt install -y python3-wstool python3-catkin-tools git libtool

- name: Build
env:
DEBIAN_FRONTEND: noninteractiv
shell: bash
run: |
apt update
mkdir -p $HOME/catkin_ws/src;
cd $HOME/catkin_ws
catkin init
catkin config --extend "/opt/ros/noetic"
catkin config --merge-devel
catkin config --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
cd $HOME/catkin_ws/src
ln -s $GITHUB_WORKSPACE

# Dependencies
git clone https://github.com/catkin/catkin_simple.git
git clone https://github.com/ethz-asl/glog_catkin.git
git clone https://github.com/ethz-asl/eigen_catkin.git
catkin build catkin_simple glog_catkin eigen_catkin
git clone https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp
mkdir build
cd build
cmake ..
make
sudo make install

# Build
catkin build config_utilities
23 changes: 23 additions & 0 deletions .github/workflows/catkin_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'ROS Noetic: Tests'

on:
workflow_run:
workflows: ["ROS Noetic: Build"]
types:
- completed

jobs:
test:
runs-on: ubuntu-latest
container: ros:noetic-ros-base-focal
steps:
- uses: actions/checkout@v3

- name: Unit Tests
shell: bash
run: |
cd $HOME/catkin_ws/src
catkin config --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCATKIN_ENABLE_TESTING=True
catkin build config_utilities --no-deps -i --catkin-make-args tests
source $HOME/catkin_ws/devel/setup.bash
status=0 && for f in $HOME/catkin_ws/devel/lib/config_utilities/test_*; do $f || exit 1; done
48 changes: 48 additions & 0 deletions .github/workflows/cmake_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: "CMake: Build"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install yaml-cpp
shell: bash
run: |
git clone https://github.com/jbeder/yaml-cpp.git
cd yaml-cpp
mkdir build
cd build
cmake ..
make
sudo make install
sudo apt install libeigen3-dev

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
shell: bash
run: |
cd ${{github.workspace}}/config_utilities
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
shell: bash
run: cmake --build ${{github.workspace}}/build
30 changes: 30 additions & 0 deletions .github/workflows/cmake_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: "CMake: Tests"

on:
workflow_run:
workflows: ["CMake: Build"]
types:
- completed

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
test:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Test
working-directory: ${{github.workspace}}/build
shell: bash
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
![CMake: Build](https://github.com/MIT-SPARK/config_utilities/actions/workflows/cmake_build.yml/badge.svg) ![ROS Noetic: Build](https://github.com/MIT-SPARK/config_utilities/actions/workflows/catkin_build.yml/badge.svg)


# config_utilities
`config_utilities` is a minimal but powerful C++ library, providing tools to parse, verify, and print C++ config structs and configurable objects.

Expand Down Expand Up @@ -97,9 +100,11 @@ Among many other, the key features of `config_utilities` include:
h names ['A', 'B', 'C'].
Warning: Failed to parse param 'uint': Value '-1' underflows storage min of '0'.
================================================================================

[ERROR] No module of type 'NotRegistered' registered to the factory for BaseT='d
emo::Base' and ConstructorArguments={'int'}. Registered are: 'DerivedB', 'Derive
dA'.

[ERROR] Cannot create a module of type 'DerivedA': No modules registered to the
factory for BaseT='demo::Base' and ConstructorArguments={'int', 'float'}. Regist
er modules using a static config::Registration<BaseT, DerivedT, ConstructorArgum
Expand All @@ -111,13 +116,14 @@ Among many other, the key features of `config_utilities` include:
This package is compatible with `catkin` and `catkin_simple`. Just clone it into your workspace and you should be all set!
```bash
cd ~/catkin_ws/src
git clone TODO
git clone [email protected]:MIT-SPARK/config_utilities.git
catkin build config_utilities
```

If you want to build and install without catkin, that should be possible too. Just clone this repository and run:
If you want to build and install without catkin/ROS, that is easy, too! Just clone this repository and build via CMake:
```bash
cd path/to/this/repo
git clone [email protected]:MIT-SPARK/config_utilities.git
cd config_utilities/config_utilities
mkdir build
cd build
cmake ..
Expand Down Expand Up @@ -146,3 +152,7 @@ roslaunch config_utilities demo_ros.launch
```

If you are looking for a specific use case that is not in the tutorials or demos, chances are you can find a good example in the `tests/` directory!


# Example Projects using `config_utilities`
Many cool projects are already using this `config_utilities`! (Unfortunately they're mostly currently private, we will list them soon as they become publicly available). Check them out for some more ideas of what `config_utilities` can do!
1 change: 1 addition & 0 deletions config_utilities/demos/demo_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
*/

#include <iostream>
#include <stdexcept>
#include <string>

#include "config_utilities/config.h" // Enables declare_config().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <exception>
#include <iostream>
#include <memory>
#include <stdexcept>
#include <string>
#include <utility>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

#include <exception>
#include <sstream>
#include <stdexcept>
#include <string>

#include <Eigen/Dense>
Expand Down
2 changes: 2 additions & 0 deletions config_utilities/src/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

#include "config_utilities/internal/logger.h"

#include <stdexcept>

namespace config::internal {

std::string severityToString(const Severity severity) {
Expand Down
2 changes: 2 additions & 0 deletions config_utilities/src/visitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@

#include "config_utilities/internal/visitor.h"

#include <stdexcept>

#include "config_utilities/internal/yaml_utils.h"
#include "config_utilities/settings.h"

Expand Down