Skip to content

Commit

Permalink
use docker in travis to run on modern ROS distros
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Dec 4, 2017
1 parent fe12127 commit 7fada8e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 127 deletions.
137 changes: 16 additions & 121 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,125 +1,20 @@
# Generic .travis.yml file for running continuous integration on Travis-CI for
# any ROS package.
#
# Available here:
# - http://felixduvallet.github.io/ros-travis-integration
# - https://github.com/felixduvallet/ros-travis-integration
#
# This installs ROS on a clean Travis-CI virtual machine, creates a ROS
# workspace, resolves all listed dependencies, and sets environment variables
# (setup.bash). Then, it compiles the entire ROS workspace (ensuring there are
# no compilation errors), and runs all the tests. If any of the compilation/test
# phases fail, the build is marked as a failure.
#
# We handle two types of package dependencies specified in the package manifest:
# - system dependencies that can be installed using `rosdep`, including other
# ROS packages and system libraries. These dependencies must be known to
# `rosdistro` and get installed using apt-get.
# - package dependencies that must be checked out from source. These are handled by
# `wstool`, and should be listed in a file named dependencies.rosinstall.
#
# There are two variables you may want to change:
# - ROS_DISTRO (default is indigo). Note that packages must be available for
# ubuntu 14.04 trusty.
# - ROSINSTALL_FILE (default is dependencies.rosinstall inside the repo
# root). This should list all necessary repositories in wstool format (see
# the ros wiki). If the file does not exists then nothing happens.
#
# See the README.md for more information.
#
# Author: Felix Duvallet <[email protected]>

# NOTE: The build lifecycle on Travis.ci is something like this:
# before_install
# install
# before_script
# script
# after_success or after_failure
# after_script
# OPTIONAL before_deploy
# OPTIONAL deploy
# OPTIONAL after_deploy

################################################################################

# Use ubuntu trusty (14.04) with sudo privileges.
dist: trusty
# We cannot use latest ROS distributions in travis since we are limited to trusty
# So, let's use docker.
sudo: required
language:
- generic
cache:
- apt

# Configuration variables. All variables are global now, but this can be used to
# trigger a build matrix for different ROS distributions if desired.
dist: trusty
language: c++
notifications:
env:
global:
- ROS_DISTRO=indigo
- ROS_CI_DESKTOP="`lsb_release -cs`" # e.g. [precise|trusty|...]
- CI_SOURCE_PATH=$(pwd)
- ROSINSTALL_FILE=$CI_SOURCE_PATH/dependencies.rosinstall
- CATKIN_OPTIONS=$CI_SOURCE_PATH/catkin.options
- ROS_PARALLEL_JOBS='-j8 -l6'
# Set the python path manually to include /usr/-/python2.7/dist-packages
# as this is where apt-get installs python packages.
- PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages

################################################################################

# Install system dependencies, namely a very barebones ROS setup.
before_install:
- sudo sh -c "echo \"deb http://packages.ros.org/ros/ubuntu $ROS_CI_DESKTOP main\" > /etc/apt/sources.list.d/ros-latest.list"
- sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
- sudo apt-get update -qq
- sudo apt-get install -y python-catkin-pkg python-rosdep python-wstool ros-$ROS_DISTRO-catkin
- source /opt/ros/$ROS_DISTRO/setup.bash
# Prepare rosdep to install dependencies.
- sudo rosdep init
# === Install a more recent MRPT version from PPA repo ===
- sudo add-apt-repository ppa:joseluisblancoc/mrpt -y
- sudo apt-get update -qq
- sudo apt-get -y install libmrpt-dev
# ======
- rosdep update

# Create a catkin workspace with the package under integration.
install:
- mkdir -p ~/catkin_ws/src
- cd ~/catkin_ws/src
- catkin_init_workspace
# Create the devel/setup.bash (run catkin_make with an empty workspace) and
# source it to set the path variables.
- cd ~/catkin_ws
- catkin_make
- source devel/setup.bash
# Add the package under integration to the workspace using a symlink.
- cd ~/catkin_ws/src
- ln -s $CI_SOURCE_PATH .

# Install all dependencies, using wstool first and rosdep second.
# wstool looks for a ROSINSTALL_FILE defined in the environment variables.
matrix:
- CI_ROS_DISTRO=kinetic MRPT_BRANCH="2.0" MRPT_PPA="ppa:joseluisblancoc/mrpt"
- CI_ROS_DISTRO=kinetic MRPT_BRANCH="1.5" MRPT_PPA="ppa:joseluisblancoc/mrpt-1.5"
# - ROS_DISTRO=kinetic BUILDER='catkin_make_isolated' BUILDER='catkin_make'
before_script:
# source dependencies: install using wstool.
- cd ~/catkin_ws/src
- wstool init
- if [[ -f $ROSINSTALL_FILE ]] ; then wstool merge $ROSINSTALL_FILE ; fi
- wstool up
# package depdencies: install using rosdep.
- cd ~/catkin_ws
- rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

# Compile and test (mark the build as failed if any step fails). If the
# CATKIN_OPTIONS file exists, use it as an argument to catkin_make, for example
# to blacklist certain packages.
#
# NOTE on testing: `catkin_make run_tests` will show the output of the tests
# (gtest, nosetest, etc..) but always returns 0 (success) even if a test
# fails. Running `catkin_test_results` aggregates all the results and returns
# non-zero when a test fails (which notifies Travis the build failed).
- case $CI_ROS_DISTRO in "kinetic") export DISTRO=xenial;; "lunar") export DISTRO=xenial;; esac;
- export DOCKER_IMAGE=ubuntu:$DISTRO
- export CI_SOURCE_PATH=$(pwd)
- export REPOSITORY_NAME=${PWD##*/}
- if [ ! "$ROS_PARALLEL_JOBS" ]; then export ROS_PARALLEL_JOBS="-j8 -l8"; fi
- docker images
script:
- source /opt/ros/$ROS_DISTRO/setup.bash
- cd ~/catkin_ws
- catkin_make $( [ -f $CATKIN_OPTIONS ] && cat $CATKIN_OPTIONS )
# Run the tests, ensuring the path is set correctly.
- source devel/setup.bash
- catkin_make run_tests && catkin_test_results
- docker run -v $HOME:$HOME -e MRPT_PPA -e CI_SOURCE_PATH -e REPOSITORY_NAME -e HOME -e DISTRO -e CI_ROS_DISTRO -e ROS_PARALLEL_JOBS $DOCKER_IMAGE bash -c 'cd $CI_SOURCE_PATH; source .travis.sh'
Empty file removed catkin.options
Empty file.
6 changes: 0 additions & 6 deletions dependencies.rosinstall

This file was deleted.

0 comments on commit 7fada8e

Please sign in to comment.