From cfd09abccf3827530687e65bd08fe553b03ab38b Mon Sep 17 00:00:00 2001 From: Wolfgang Hess Date: Tue, 30 Aug 2016 08:33:45 +0200 Subject: [PATCH] Sets up Travis CI. (#34) --- .travis.yml | 18 ++++++++++ Dockerfile | 18 ++++++++++ README.rst | 12 +++---- cartographer_ros/CMakeLists.txt | 10 +----- cartographer_ros/package.xml | 10 ++++++ scripts/install.sh | 58 +++++++++++++++++++++++++++++++++ scripts/ros_entrypoint.sh | 22 +++++++++++++ 7 files changed, 133 insertions(+), 15 deletions(-) create mode 100644 .travis.yml create mode 100644 Dockerfile create mode 100755 scripts/install.sh create mode 100755 scripts/ros_entrypoint.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..6e885c8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +# Copyright 2016 The Cartographer Authors +# +# 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. + +sudo: required +services: docker +install: true +script: docker build ${TRAVIS_BUILD_DIR} -t cartographer_ros diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f95ca98 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +# Copyright 2016 The Cartographer Authors +# +# 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. + +FROM ros:indigo +COPY . cartographer_ros +RUN cartographer_ros/scripts/install.sh +COPY scripts/ros_entrypoint.sh / diff --git a/README.rst b/README.rst index 5981907..425bcdd 100644 --- a/README.rst +++ b/README.rst @@ -12,16 +12,11 @@ See the License for the specific language governing permissions and limitations under the License. -.. Cartographer documentation master file, created by - sphinx-quickstart on Fri Jul 8 10:41:33 2016. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - ============================ Cartographer ROS Integration ============================ -|docs| +|build| |docs| Purpose ======= @@ -49,6 +44,11 @@ at our `Contribution page`_. .. _Contribution page: https://github.com/googlecartographer/cartographer_ros/blob/master/CONTRIBUTING.md +.. |build| image:: https://travis-ci.org/googlecartographer/cartographer_ros.svg?branch=master + :alt: Build Status + :scale: 100% + :target: https://travis-ci.org/googlecartographer/cartographer_ros + .. |docs| image:: https://readthedocs.org/projects/google-cartographer-ros/badge/?version=latest :alt: Documentation Status :scale: 100% diff --git a/cartographer_ros/CMakeLists.txt b/cartographer_ros/CMakeLists.txt index bcaf75e..f80d938 100644 --- a/cartographer_ros/CMakeLists.txt +++ b/cartographer_ros/CMakeLists.txt @@ -54,12 +54,6 @@ link_directories(${CARTOGRAPHER_LIBRARY_DIRS}) find_package(ZLIB REQUIRED) include_directories(${ZLIB_INCLUDE_DIRS}) -# TODO(pedrofernandez): CMake test rules are written differently in the core -# library. Change the way it's done here and reenable testing. -# enable_testing() -# find_package(GTest REQUIRED) -# include_directories(${GTEST_INCLUDE_DIRS}) - set(CMAKE_AUTOMOC ON) if(rviz_QT_VERSION VERSION_LESS "5") message(STATUS "Using Qt4 based on the rviz_QT_VERSION: ${rviz_QT_VERSION}") @@ -119,7 +113,7 @@ add_dependencies(cartographer_rviz_submaps_visualization ${catkin_EXPORTED_TARGETS} ) -add_executable(time_conversion_test +catkin_add_gtest(time_conversion_test src/time_conversion_test.cc src/time_conversion.h src/time_conversion.cc @@ -135,8 +129,6 @@ add_dependencies(time_conversion_test ${catkin_EXPORTED_TARGETS} ) -add_test(time_conversion_test time_conversion_test) - install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch/ ) diff --git a/cartographer_ros/package.xml b/cartographer_ros/package.xml index a935e7a..8597fcd 100644 --- a/cartographer_ros/package.xml +++ b/cartographer_ros/package.xml @@ -24,14 +24,19 @@ catkin + g++-static + wget cartographer eigen_conversions geometry_msgs cartographer_ros_msgs + libgflags-dev libpcl-all-dev message_generation nav_msgs pcl_conversions + protobuf-dev + python-sphinx qtbase5-dev rosbag roscpp @@ -39,6 +44,7 @@ rviz sensor_msgs std_msgs + suitesparse tf2 tf2_eigen visualization_msgs @@ -46,6 +52,7 @@ eigen_conversions geometry_msgs cartographer_ros_msgs + libgflags-dev libpcl-all libqt5-core libqt5-gui @@ -59,10 +66,13 @@ rviz sensor_msgs std_msgs + suitesparse tf2_eigen tf2 visualization_msgs + rosunit + diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..e7d73b5 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# Copyright 2016 The Cartographer Authors +# +# 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. + +set -o errexit +set -o verbose + +. /opt/ros/${ROS_DISTRO}/setup.sh + +# Create a new workspace in 'catkin_ws'. +mkdir catkin_ws +cd catkin_ws +wstool init + +# Merge the cartographer_ros rosinstall file and fetch code for dependencies. +wstool merge ../cartographer_ros/cartographer_ros.rosinstall +wstool update + +# Use the local version of cartographer_ros to include local modifications. +rm -rf src/cartographer_ros +mv ../cartographer_ros src + +# Install deb dependencies. +sudo apt-get update +sudo apt-get install -y libwebp-dev # TODO(whess): Move to rosdep. +rosdep update +rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y +rm -rf /var/lib/apt/lists/* + +# Build and run tests. +catkin_make_isolated +catkin_make_isolated --catkin-make-args tests +catkin_make_isolated --catkin-make-args test + +# TODO(whess): Fix installing cartographer_ros. For now we use a workaround: +echo Working around install issues... +mkdir /opt/cartographer_ros +ln -Tsf ${PWD}/devel_isolated/setup.bash /opt/cartographer_ros/setup.bash +exit + +# Install under /opt/cartographer_ros. +catkin_make_isolated --install-space /opt/cartographer_ros --install + +# Clean up. +cd .. +rm -rf catkin_ws diff --git a/scripts/ros_entrypoint.sh b/scripts/ros_entrypoint.sh new file mode 100755 index 0000000..1c63688 --- /dev/null +++ b/scripts/ros_entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Copyright 2016 The Cartographer Authors +# +# 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. + +set -o errexit +set -o verbose + +source "/opt/ros/${ROS_DISTRO}/setup.bash" +source "/opt/cartographer_ros/setup.bash" +exec "$@"