diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..81b8f2a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,62 @@ +sudo: required +dist: trusty +language: generic +env: + - OPENCV_VERSION=2 ROS_DISTRO=indigo + - OPENCV_VERSION=3 ROS_DISTRO=indigo +# Install system dependencies, namely ROS. +before_install: + # Define some config vars. + - export ROS_CI_DESKTOP=`lsb_release -cs` # e.g. [precise|trusty] + - export CI_SOURCE_PATH=$(pwd) + - export REPOSITORY_NAME=${PWD##*/} + - export ROSINSTALL_FILE=$CI_SOURCE_PATH/dependencies.rosinstall + - export CATKIN_OPTIONS=$CI_SOURCE_PATH/catkin.options + - export ROS_PARALLEL_JOBS='-j8 -l6' + # Install ROS + - sudo sh -c "echo \"deb http://packages.ros.org/ros-shadow-fixed/ubuntu $ROS_CI_DESKTOP main\" > /etc/apt/sources.list.d/ros-latest.list" + - wget http://packages.ros.org/ros.key -O - | sudo apt-key add - + - sudo apt-get update -qq + # Install ROS + - sudo apt-get install -qq -y python-catkin-pkg python-catkin-tools python-rosdep python-wstool ros-$ROS_DISTRO-catkin + - source /opt/ros/$ROS_DISTRO/setup.bash + # Setup for rosdep + - sudo rosdep init + - rosdep update + +# Create a catkin workspace with the package under test. +install: + - mkdir -p ~/catkin_ws/src + + # Add the package under test to the workspace. + - cd ~/catkin_ws/src + - ln -s $CI_SOURCE_PATH . # Link the repo we are testing to the new workspace + + - if [ $OPENCV_VERSION == 3 ]; then sed -i 's@libopencv-dev@opencv3@' $REPOSITORY_NAME/*/package.xml ; fi + +# Install all dependencies, using wstool and rosdep. +# wstool looks for a ROSINSTALL_FILE defined in before_install. +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 -q -y -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO + +# Compile and test. +script: + - source /opt/ros/$ROS_DISTRO/setup.bash + - cd ~/catkin_ws + - catkin build -p1 -j1 --no-status + - catkin run_tests -p1 -j1 --no-status + - catkin_test_results --all build + - catkin clean -b --yes + - catkin config --install + - catkin build -p1 -j1 --no-status +after_failure: + - if [ -e ~/catkin_ws/build/ ]; then catkin_test_results --verbose --all ~/catkin_ws/build ; fi + - if [ -e ~/.ros/test_results/ ]; then catkin_test_results --verbose --all ~/.ros/test_results ; fi