Skip to content

Commit

Permalink
Add travis config to test pkg on all releasing platforms
Browse files Browse the repository at this point in the history
I had error reported at ros#27 (comment).
  • Loading branch information
wkentaro committed Aug 11, 2017
1 parent 4d743a0 commit 8b088fc
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash

set -e

function travis_time_start {
set +x
TRAVIS_START_TIME=$(date +%s%N)
TRAVIS_TIME_ID=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)
TRAVIS_FOLD_NAME=$1
echo -e "\e[0Ktraivs_fold:start:$TRAVIS_FOLD_NAME"
echo -e "\e[0Ktraivs_time:start:$TRAVIS_TIME_ID"
set -x
}
function travis_time_end {
set +x
_COLOR=${1:-32}
TRAVIS_END_TIME=$(date +%s%N)
TIME_ELAPSED_SECONDS=$(( ($TRAVIS_END_TIME - $TRAVIS_START_TIME)/1000000000 ))
echo -e "traivs_time:end:$TRAVIS_TIME_ID:start=$TRAVIS_START_TIME,finish=$TRAVIS_END_TIME,duration=$(($TRAVIS_END_TIME - $TRAVIS_START_TIME))\n\e[0K"
echo -e "traivs_fold:end:$TRAVIS_FOLD_NAME"
echo -e "\e[0K\e[${_COLOR}mFunction $TRAVIS_FOLD_NAME takes $(( $TIME_ELAPSED_SECONDS / 60 )) min $(( $TIME_ELAPSED_SECONDS % 60 )) sec\e[0m"
set -x
}

apt-get update -qq && apt-get install -qq -y -q wget sudo lsb-release gnupg # for docker


travis_time_start setup.before_install
#before_install:
# Define some config vars.
# Install ROS
sudo sh -c "echo \"deb http://packages.ros.org/ros-shadow-fixed/ubuntu `lsb_release -cs` 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
travis_time_end

travis_time_start setup.install
# 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
travis_time_end

travis_time_start setup.before_script
# 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
wstool up

# package depdencies: install using rosdep.
cd ~/catkin_ws
rosdep install -q -y -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO --os $DOCKER_IMAGE
travis_time_end

travis_time_start setup.script
# Compile and test.
#script:
source /opt/ros/$ROS_DISTRO/setup.bash
cd ~/catkin_ws
catkin build -p1 -j1
catkin run_tests -p1 -j1
catkin_test_results --all build
catkin clean -b --yes
catkin config --install
catkin build -p1 -j1
travis_time_end
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
sudo: required
dist: trusty
language: generic
env:
global:
- ROS_DISTRO=lunar
matrix:
- DOCKER_IMAGE=debian:stretch
- DOCKER_IMAGE=ubuntu:xenial
- DOCKER_IMAGE=ubuntu:yakkety
- DOCKER_IMAGE=ubuntu:zesty
# Install system dependencies, namely ROS.
before_install:
# Define some config vars.
- export CI_SOURCE_PATH=$(pwd)
- export REPOSITORY_NAME=${PWD##*/}
- export ROS_PARALLEL_JOBS='-j8 -l6'
script:
- echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME"
- docker run --rm -i -v $CI_SOURCE_PATH:$CI_SOURCE_PATH -e "CI_SOURCE_PATH=$CI_SOURCE_PATH" -e "HOME=$HOME" -e "ROS_DISTRO=$ROS_DISTRO" -e "ROS_PARALLEL_JOBS=$ROS_PARALLEL_JOBS" -e "DOCKER_IMAGE=$DOCKER_IMAGE" -t $DOCKER_IMAGE sh -c "cd $CI_SOURCE_PATH; ./.travis.sh"
after_failure:
- find ${HOME}/.ros/test_results -type f -exec echo "== {} ==" \; -exec cat {} \;
- for file in ${HOME}/.ros/log/rostest-*; do echo "=== $file ==="; cat $file; done
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# bond_core

[![Build Status](https://travis-ci.org/ros-perception/perception_pcl.svg)](https://travis-ci.org/ros-perception/perception_pcl)

A bond allows two processes, A and B, to know when the other has terminated, either cleanly or by crashing. The bond remains
connected until it is either broken explicitly or until a heartbeat times out.

0 comments on commit 8b088fc

Please sign in to comment.