├── catkin.options ├── ros_pkg_with_tests ├── scripts │ ├── __init__.py │ ├── test │ │ ├── __init__.py │ │ └── test_double.py │ └── double.py ├── src │ ├── square.cpp │ ├── square.h │ └── test │ │ └── test_square.cpp ├── package.xml └── CMakeLists.txt ├── basic_ros_pkg ├── msg │ └── StringIntTuple.msg ├── src │ └── talker.cpp ├── package.xml └── CMakeLists.txt ├── ros_pkg_with_dependencies ├── src │ └── audio_user.cpp ├── CMakeLists.txt └── package.xml ├── dependencies.rosinstall ├── .gitignore ├── LICENSE ├── .travis.yml └── README.md /catkin.options: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ros_pkg_with_tests/scripts/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ros_pkg_with_tests/scripts/test/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /basic_ros_pkg/msg/StringIntTuple.msg: -------------------------------------------------------------------------------- 1 | string str 2 | int32 num 3 | -------------------------------------------------------------------------------- /ros_pkg_with_tests/src/square.cpp: -------------------------------------------------------------------------------- 1 | #include "square.h" 2 | 3 | double square(double in) { 4 | return in * in; 5 | } 6 | -------------------------------------------------------------------------------- /ros_pkg_with_tests/src/square.h: -------------------------------------------------------------------------------- 1 | #ifndef __SQUARE_H__ 2 | #define __SQUARE_H__ 3 | 4 | double square(double in); 5 | 6 | #endif // __SQUARE_H__ 7 | -------------------------------------------------------------------------------- /ros_pkg_with_tests/scripts/double.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | def double(x): 4 | """ 5 | 6 | >>> double(3) 7 | 6 8 | 9 | :param x: 10 | :return: 11 | """ 12 | return np.multiply(2, x) 13 | -------------------------------------------------------------------------------- /ros_pkg_with_dependencies/src/audio_user.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "audio_common_msgs/AudioData.h" 3 | 4 | int main(int argc, char **argv) 5 | { 6 | ros::init(argc, argv, "audio_user"); 7 | 8 | audio_common_msgs::AudioData data; 9 | 10 | ROS_INFO("Have audio data."); 11 | 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /dependencies.rosinstall: -------------------------------------------------------------------------------- 1 | # NOTE: This is an example source dependency, remove it before adding the 2 | # dependencies.rosinstall file to your repository. 3 | # 4 | # The 'wstool' utility is the preferred way of adding elements to this file. To 5 | # add all repositories from an existing workspace, you can use `wstool scrape`. 6 | 7 | - git: 8 | local-name: grasp-synergy 9 | uri: https://github.com/felixduvallet/grasp-synergy.git 10 | -------------------------------------------------------------------------------- /ros_pkg_with_tests/src/test/test_square.cpp: -------------------------------------------------------------------------------- 1 | #include "square.h" 2 | #include 3 | 4 | TEST(TestSuite, squareTwo) 5 | { 6 | const double ret = square(2); 7 | ASSERT_EQ(4, ret); 8 | } 9 | 10 | TEST(TestSuite, squareFour) 11 | { 12 | const double ret = square(4.1); 13 | ASSERT_EQ(16.81, ret); 14 | } 15 | 16 | // Run all the tests that were declared with TEST() 17 | int main(int argc, char **argv){ 18 | testing::InitGoogleTest(&argc, argv); 19 | return RUN_ALL_TESTS(); 20 | } 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | bin/ 3 | lib/ 4 | msg_gen/ 5 | srv_gen/ 6 | msg/*Action.msg 7 | msg/*ActionFeedback.msg 8 | msg/*ActionGoal.msg 9 | msg/*ActionResult.msg 10 | msg/*Feedback.msg 11 | msg/*Goal.msg 12 | msg/*Result.msg 13 | msg/_*.py 14 | 15 | # Generated by dynamic reconfigure 16 | *.cfgc 17 | /cfg/cpp/ 18 | /cfg/*.py 19 | 20 | # Ignore generated docs 21 | *.dox 22 | *.wikidoc 23 | 24 | # eclipse stuff 25 | .project 26 | .cproject 27 | 28 | # qcreator stuff 29 | CMakeLists.txt.user 30 | 31 | srv/_*.py 32 | *.pcd 33 | *.pyc 34 | qtcreator-* 35 | *.user 36 | 37 | /planning/cfg 38 | /planning/docs 39 | /planning/src 40 | 41 | *~ 42 | 43 | # Emacs 44 | .#* 45 | -------------------------------------------------------------------------------- /ros_pkg_with_tests/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ros_pkg_with_tests 4 | 0.0.0 5 | The ros_pkg_with_tests package 6 | 7 | Felix Duvallet 8 | BSD 9 | 10 | catkin 11 | rospy 12 | roscpp 13 | rostest 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ros_pkg_with_tests/scripts/test/test_double.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import unittest 4 | import rospy 5 | import rostest 6 | import numpy as np 7 | 8 | from scripts.double import double 9 | 10 | class TestCase(unittest.TestCase): 11 | 12 | def test_four(self): 13 | ret = double(4) 14 | self.assertEqual(8, ret) 15 | 16 | def test_two(self): 17 | ret = double(2) 18 | self.assertEqual(4, ret) 19 | 20 | def test_good_math(self): 21 | ret = double(3) 22 | self.assertEqual(6, ret) 23 | 24 | def test_double_vector(self): 25 | x = np.array([2, 5]) 26 | ret = double(x) 27 | ref = np.array([4, 10]) 28 | self.assertTrue(np.array_equal(ref, ret)) 29 | 30 | 31 | if __name__ == '__main__': 32 | rostest.rosrun('package_name', 'test_name', TestCase) 33 | -------------------------------------------------------------------------------- /ros_pkg_with_dependencies/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(ros_pkg_with_dependencies) 3 | 4 | ## Find catkin macros and libraries 5 | ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) 6 | ## is used, also find other catkin packages 7 | find_package(catkin REQUIRED COMPONENTS 8 | roscpp 9 | audio_common_msgs 10 | ) 11 | 12 | ################################### 13 | ## catkin specific configuration ## 14 | ################################### 15 | catkin_package( 16 | # INCLUDE_DIRS include 17 | # LIBRARIES ros_pkg_with_dependencies 18 | CATKIN_DEPENDS audio_common_msgs 19 | DEPENDS system_lib 20 | ) 21 | 22 | ########### 23 | ## Build ## 24 | ########### 25 | include_directories(${catkin_INCLUDE_DIRS}) 26 | add_executable(audio_user src/audio_user.cpp) 27 | target_link_libraries(audio_user ${catkin_LIBRARIES}) 28 | add_dependencies(audio_user ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 29 | -------------------------------------------------------------------------------- /ros_pkg_with_dependencies/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | ros_pkg_with_dependencies 4 | 0.0.0 5 | A test ros package with dependencies. 6 | 7 | 8 | 9 | 10 | Felix Duvallet 11 | 12 | BSD 13 | 14 | catkin 15 | audio_common_msgs 16 | roscpp 17 | grasp_synergy 18 | audio_common_msgs 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ros_pkg_with_tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(ros_pkg_with_tests) 3 | 4 | ## Find catkin macros and libraries 5 | find_package(catkin REQUIRED 6 | roscpp 7 | rospy) 8 | 9 | ################################### 10 | ## catkin specific configuration ## 11 | ################################### 12 | catkin_package( 13 | ) 14 | 15 | ########### 16 | ## Build ## 17 | ########### 18 | include_directories(${catkin_INCLUDE_DIRS}) 19 | include_directories(src) 20 | 21 | ## Declare a C++ library 22 | add_library(square 23 | src/square.cpp 24 | ) 25 | 26 | ############# 27 | ## Testing ## 28 | ############# 29 | 30 | ## Add gtest based cpp test target and link libraries 31 | catkin_add_gtest(${PROJECT_NAME}-test src/test/test_square.cpp) 32 | if(TARGET ${PROJECT_NAME}-test) 33 | target_link_libraries(${PROJECT_NAME}-test square) 34 | endif() 35 | 36 | ## Add folders to be run by python nosetests 37 | catkin_add_nosetests(scripts/test) 38 | -------------------------------------------------------------------------------- /basic_ros_pkg/src/talker.cpp: -------------------------------------------------------------------------------- 1 | #include "ros/ros.h" 2 | #include "std_msgs/String.h" 3 | #include "basic_ros_pkg/StringIntTuple.h" 4 | 5 | #include 6 | 7 | /** 8 | * This tutorial demonstrates simple sending of messages over the ROS system. 9 | */ 10 | int main(int argc, char **argv) 11 | { 12 | ros::init(argc, argv, "talker"); 13 | ros::NodeHandle n; 14 | ros::Publisher chatter_pub = n.advertise("chatter", 1000); 15 | ros::Rate loop_rate(10); 16 | int count = 0; 17 | 18 | // Use the custom message type defined. 19 | basic_ros_pkg::StringIntTuple tuple; 20 | tuple.str = "string"; 21 | tuple.num = 0; 22 | 23 | while (ros::ok()) 24 | { 25 | std_msgs::String msg; 26 | 27 | std::stringstream ss; 28 | ss << "hello world " << count; 29 | msg.data = ss.str(); 30 | 31 | ROS_INFO("%s", msg.data.c_str()); 32 | chatter_pub.publish(msg); 33 | 34 | ros::spinOnce(); 35 | 36 | loop_rate.sleep(); 37 | ++count; 38 | } 39 | 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /basic_ros_pkg/package.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | basic_ros_pkg 4 | 0.0.0 5 | The basic_ros_pkg package 6 | 7 | 8 | 9 | 10 | felixd 11 | 12 | 13 | 14 | 15 | 16 | BSD 17 | 18 | catkin 19 | 20 | roscpp 21 | std_msgs 22 | message_generation 23 | message_generation 24 | std_msgs 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /basic_ros_pkg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.3) 2 | project(basic_ros_pkg) 3 | 4 | ## Find catkin macros and libraries 5 | ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) 6 | ## is used, also find other catkin packages 7 | find_package(catkin REQUIRED 8 | roscpp 9 | std_msgs 10 | message_generation 11 | ) 12 | 13 | ################################################ 14 | ## Declare ROS messages, services and actions ## 15 | ################################################ 16 | 17 | ## Generate messages in the 'msg' folder 18 | add_message_files( 19 | FILES 20 | StringIntTuple.msg 21 | ) 22 | 23 | ## Generate added messages and services with any dependencies listed here 24 | generate_messages( 25 | DEPENDENCIES 26 | std_msgs 27 | ) 28 | 29 | ################################### 30 | ## catkin specific configuration ## 31 | ################################### 32 | catkin_package( 33 | # INCLUDE_DIRS include 34 | # LIBRARIES basic_ros_pkg 35 | # CATKIN_DEPENDS other_catkin_pkg 36 | # DEPENDS system_lib 37 | ) 38 | 39 | ########### 40 | ## Build ## 41 | ########### 42 | include_directories(${catkin_INCLUDE_DIRS}) 43 | add_executable(basic_talker src/talker.cpp) 44 | target_link_libraries(basic_talker ${catkin_LIBRARIES}) 45 | add_dependencies(basic_talker ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Felix Duvallet 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of this package nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Generic .travis.yml file for running continuous integration on Travis-CI for 2 | # any ROS package. 3 | # 4 | # Available here: 5 | # - https://github.com/felixduvallet/ros-travis-integration 6 | # 7 | # This installs ROS on a clean Travis-CI virtual machine, creates a ROS 8 | # workspace, resolves all listed dependencies, and sets environment variables 9 | # (setup.bash). Then, it compiles the entire ROS workspace (ensuring there are 10 | # no compilation errors), and runs all the tests. If any of the compilation/test 11 | # phases fail, the build is marked as a failure. 12 | # 13 | # We handle two types of package dependencies specified in the package manifest: 14 | # - system dependencies that can be installed using `rosdep`, including other 15 | # ROS packages and system libraries. These dependencies must be known to 16 | # `rosdistro` and are installed using apt-get. 17 | # - package dependencies that must be checked out from source. These are handled by 18 | # `wstool`, and should be listed in a file named dependencies.rosinstall. 19 | # 20 | 21 | # There are envioronment variables you may want to change, such as ROS_DISTRO, 22 | # ROSINSTALL_FILE, and the CATKIN_OPTIONS file. See the README.md for more 23 | # information on these flags, and 24 | # https://docs.travis-ci.com/user/environment-variables/ for information about 25 | # Travis environment variables in general. 26 | # 27 | # Author: Felix Duvallet 28 | 29 | # NOTE: The build lifecycle on Travis.ci is something like this: 30 | # before_install 31 | # install 32 | # before_script 33 | # script 34 | # after_success or after_failure 35 | # after_script 36 | # OPTIONAL before_deploy 37 | # OPTIONAL deploy 38 | # OPTIONAL after_deploy 39 | 40 | ################################################################################ 41 | 42 | sudo: required 43 | cache: 44 | - apt 45 | 46 | # Build all valid Ubuntu/ROS combinations available on Travis VMs. 47 | language: generic 48 | matrix: 49 | include: 50 | - name: "Trusty indigo" 51 | dist: trusty 52 | env: ROS_DISTRO=indigo 53 | - name: "Xenial kinetic" 54 | dist: xenial 55 | env: ROS_DISTRO=kinetic 56 | 57 | # Configuration variables. All variables are global now, but this can be used to 58 | # trigger a build matrix for different ROS distributions if desired. 59 | env: 60 | global: 61 | - ROS_CI_DESKTOP="`lsb_release -cs`" # e.g. [trusty|xenial|...] 62 | - CI_SOURCE_PATH=$(pwd) 63 | - ROSINSTALL_FILE=$CI_SOURCE_PATH/dependencies.rosinstall 64 | - CATKIN_OPTIONS=$CI_SOURCE_PATH/catkin.options 65 | - ROS_PARALLEL_JOBS='-j8 -l6' 66 | # Set the python path manually to include /usr/-/python2.7/dist-packages 67 | # as this is where apt-get installs python packages. 68 | - PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages 69 | 70 | ################################################################################ 71 | 72 | # Install system dependencies, namely a very barebones ROS setup. 73 | before_install: 74 | - sudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu $ROS_CI_DESKTOP main\" > /etc/apt/sources.list.d/ros-latest.list" 75 | - sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 76 | - sudo apt-get update -qq 77 | - sudo apt-get install dpkg 78 | - sudo apt-get install -y python-catkin-pkg python-rosdep python-wstool ros-$ROS_DISTRO-ros-base 79 | - source /opt/ros/$ROS_DISTRO/setup.bash 80 | # Prepare rosdep to install dependencies. 81 | - sudo rosdep init 82 | - rosdep update --include-eol-distros # Support EOL distros. 83 | 84 | # Create a catkin workspace with the package under integration. 85 | install: 86 | - mkdir -p ~/catkin_ws/src 87 | - cd ~/catkin_ws/src 88 | - catkin_init_workspace 89 | # Create the devel/setup.bash (run catkin_make with an empty workspace) and 90 | # source it to set the path variables. 91 | - cd ~/catkin_ws 92 | - catkin_make 93 | - source devel/setup.bash 94 | # Add the package under integration to the workspace using a symlink. 95 | - cd ~/catkin_ws/src 96 | - ln -s $CI_SOURCE_PATH . 97 | 98 | # Install all dependencies, using wstool first and rosdep second. 99 | # wstool looks for a ROSINSTALL_FILE defined in the environment variables. 100 | before_script: 101 | # source dependencies: install using wstool. 102 | - cd ~/catkin_ws/src 103 | - wstool init 104 | - if [[ -f $ROSINSTALL_FILE ]] ; then wstool merge $ROSINSTALL_FILE ; fi 105 | - wstool up 106 | # package depdencies: install using rosdep. 107 | - cd ~/catkin_ws 108 | - rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO 109 | 110 | # Compile and test (mark the build as failed if any step fails). If the 111 | # CATKIN_OPTIONS file exists, use it as an argument to catkin_make, for example 112 | # to blacklist certain packages. 113 | # 114 | # NOTE on testing: `catkin_make run_tests` will show the output of the tests 115 | # (gtest, nosetest, etc..) but always returns 0 (success) even if a test 116 | # fails. Running `catkin_test_results` aggregates all the results and returns 117 | # non-zero when a test fails (which notifies Travis the build failed). 118 | script: 119 | - source /opt/ros/$ROS_DISTRO/setup.bash 120 | - cd ~/catkin_ws 121 | - catkin_make $( [ -f $CATKIN_OPTIONS ] && cat $CATKIN_OPTIONS ) 122 | # Run the tests, ensuring the path is set correctly. 123 | - source devel/setup.bash 124 | - catkin_make run_tests && catkin_test_results 125 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ROS package continuous integration with travis (now supporting Kinetic). 2 | 3 | This repository contains a [.travis.yml](https://github.com/felixduvallet/ros-travis-integration/blob/master/.travis.yml) 4 | file for setting up continuous integration (through Travis-CI) for any ROS package. 5 | 6 | Improvements & issues are welcome via pull requests and the issue tracker 7 | (while there's not a lot of active development, it is still supported). If you 8 | find this Travis file helpful, please star this repository! 9 | 10 | This repository also contains several example (i.e. trivial) ROS packages that 11 | serve as example packages for Travis to build and test. They also showcase how 12 | to correctly handle dependencies (system and source). 13 | 14 | [![Build Status](https://travis-ci.org/felixduvallet/ros-travis-integration.svg?branch=master)](https://travis-ci.org/felixduvallet/ros-travis-integration) 15 | 16 | # Installation instructions 17 | 18 | To enable Travis continuous integration for your ROS package, first copy these 19 | files to the *root* of your repository: 20 | - [.travis.yml](https://github.com/felixduvallet/ros-travis-integration/blob/master/.travis.yml): The script that tells Travis CI what to build. 21 | - [dependencies.rosinstall](https://github.com/felixduvallet/ros-travis-integration/blob/master/dependencies.rosinstall): A wstool-generated list of source dependencies 22 | (optional). **Update the contents with your packages.** 23 | - [catkin.options](https://github.com/felixduvallet/ros-travis-integration/blob/master/catkin.options): Contents of this (optional) file are passed as arguments to catkin_make (for example to skip building a package). 24 | 25 | Then, log on to travis-ci and turn on continuous integration for the repository: 26 | - [travis-ci.org](http://travis-ci.org) is free for open-source repositories. 27 | - [travis-ci.com](http://travis-ci.com) provides the same functionality for private repositories (at a price). 28 | 29 | From then on, any push to this repository will trigger a new Travis-ci build. 30 | 31 | # About Travis-CI 32 | 33 | Travis provides a clean virtual machine for each build. The .travis.yml script 34 | installs ROS, creates a fresh workspace, resolves all given dependencies, and 35 | sets environment variables (devel/setup.bash). Then, it compiles the entire ROS 36 | workspace (ensuring there are no missing dependencies or compilation errors), 37 | and runs any available unit tests. If any of the compilation/test phases fail, 38 | the build is marked as a failure. Otherwise, it's a clean build. 39 | 40 | For more information on Travis CI, see their documentation: 41 | http://docs.travis-ci.com/ 42 | 43 | # Handling Dependencies: 44 | 45 | ROS can handle two types of package dependencies specified in the package manifest: 46 | 47 | - system dependencies that can be installed using `rosdep`, including other 48 | ROS packages and system libraries. These dependencies must be known to 49 | `rosdistro` and get installed using apt-get. 50 | - package dependencies that must be checked out from source. These are handled by 51 | `wstool`, and should be listed in a file named dependencies.rosinstall. 52 | 53 | NOTE: **All** dependencies should be handled in one of these fashions; you 54 | should not install packages by modifying the .travis.yml file. If you are 55 | missing a package, it's most likely that you haven't defined the dependency in 56 | package.xml. 57 | 58 | Note that any packages located inside your catkin workspace will take 59 | precendence over the rosdistro system-wide package. 60 | This allows you to use the cutting-edge version of a package directly from 61 | source. 62 | 63 | For public builds (i.e. when using travis-ci.org), `wstool` dependencies should 64 | use a *public* access link (for instance, the https github address instead of 65 | ssh). Otherwise you will get a "Permission denied (publickey)" error. 66 | 67 | The example package `ros_pkg_with_dependencies` showcases both types of 68 | dependencies: there's a dependency on audio_common_msgs (known to rosdistro), so 69 | that package will get installed using `rosdep`. There is also a public 70 | repository link inside `dependencies.rosinstall`, so Travis will clone the 71 | repository into the workspace before building anything. 72 | 73 | When building your own package, make sure to remove the contents of 74 | dependencies.rosinstall and add your package's source dependencies instead. 75 | 76 | # Build matrix 77 | 78 | The .travis.yml defines a build matrix specifying which combinations of Ubuntu 79 | distribution and ROS version should be used. 80 | 81 | Currently, the list of supported pairs is: 82 | 83 | - ROS indigo on Ubuntu trusty 84 | - ROS kinetic on Ubuntu xenial 85 | 86 | Note that some pairs are not possible (e.g. kinetic on trusty or indigo on 87 | xenial). The debian packages must be available for the appropriate ubuntu 88 | release. 89 | 90 | # ROS variables: 91 | 92 | The .travis.yml file has some [environment 93 | variables](https://docs.travis-ci.com/user/environment-variables/) you can 94 | change to customize your build: defined in the script which are used to 95 | parametrize the build: 96 | 97 | - ROSINSTALL_FILE (default is dependencies.rosinstall in repo): This file 98 | list all necessary repositories in wstool format (see the ros wiki). If the 99 | file does not exists then nothing happens. 100 | - CATKIN_OPTIONS (default is catkin.options in repo): File **whose contents** 101 | specify the options passed to catkin_make. If this file does not exist, 102 | catkin_make is called without options. For example, you can have catkin 103 | *not* build several packages by putting this inside the file: 104 | 105 | -DCATKIN_BLACKLIST_PACKAGES=pkg_a;pkg_b 106 | 107 | # Private repositories: 108 | 109 | Travis-ci.com can build a private repository. However if your package has 110 | dependencies that are also private, you have to go through additional steps. 111 | The instructions are generally listed here: 112 | http://docs.travis-ci.com/user/private-dependencies/ 113 | 114 | At a high level, you shoud: 115 | 116 | 1. Create a machine account on github. 117 | 2. Generate a public/private key on your computer, if not done already. 118 | 3. Add the public key (id_rsa.pub) to the machine account's github settings (see [here](https://developer.github.com/guides/managing-deploy-keys/#machine-users)). 119 | 4. In github, make sure the machine account has read access to all the dependency repositories. 120 | 5. In github, add the machine account as an administrator for the repository you want to build (note: not the dependencies). 121 | 6. In travis settings for the machine user, add the *private* key (id_rsa) in the build job settings. 122 | 123 | # The example packages 124 | 125 | This repository contain some example packages to: 126 | 127 | * Verify this script indeed works 128 | * Give Travis something to do 129 | * Serve as an example of "proper" dependency management 130 | 131 | The packages are: 132 | 133 | * basic_ros_pkg: Just a simple C++ node. 134 | * ros_pkg_with_tests: Includes both python and C++ tests 135 | * ros_pkg_with_dependencies: Has dependencies in package.xml that must be 136 | resolved by wstool (in this case, clone pocketsphinx from source) and rosdep 137 | (in this case, install audio_common_msgs using rosdep). 138 | 139 | You can look at the [Travis build 140 | log](https://travis-ci.org/felixduvallet/ros-travis-integration) to see exactly 141 | how it resolves dependencies and then builds the package. 142 | --------------------------------------------------------------------------------