Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.*
!/.gitignore
34 changes: 9 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
sudo: required
language: generic
dist: trusty
dist: bionic

notifications:
email:
recipients:
- spuetz@uos.de
on_success: change
on_failure: change

matrix:
include:
- name: "Indigo"
env: ROS_DISTRO=indigo

- name: "Kinetic"
env: ROS_DISTRO=kinetic

- name: "Lunar"
env: ROS_DISTRO=lunar

- name: "Melodic"
env: ROS_DISTRO=melodic

install:
- git clone https://github.com/ros-industrial/industrial_ci.git .ci_config
env:
global:
- ROS_DISTRO=melodic
- CI_SOURCE_PATH=$(pwd)
- CI_PARENT_DIR=.travis
matrix:
- TEST=build DOCKER_IMAGE=mbf_ci:latest

script:
- .ci_config/travis.sh
- source $CI_PARENT_DIR/$TEST.sh
15 changes: 15 additions & 0 deletions .travis/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export REPOSITORY_NAME=${PWD##*/}
echo "Testing branch '$TRAVIS_BRANCH' of '$REPOSITORY_NAME' on ROS '$ROS_DISTRO'"

# Start Docker container
cp ~/.ssh/id_rsa id_rsa && docker build -t $DOCKER_IMAGE -f Dockerfile.ci $CI_SOURCE_PATH
docker_result=$?
rm id_rsa

# Check if docker ran successfully
if [ $docker_result -ne 0 ]; then
echo "$DOCKER_IMAGE container finished with errors"
exit 1 # error
fi
echo "$DOCKER_IMAGE container finished successfully"
exit 0
11 changes: 11 additions & 0 deletions .travis/build_in_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#!/bin/bash
source /opt/ros/melodic/setup.bash
source src/mbf/.travis/util.sh

travis_run catkin init
travis_run rosdep update --as-root apt:false
travis_run rosdep install --from-paths src --ignore-src --rosdistro melodic -y -r

travis_run catkin config --extend /opt/ros/melodic --cmake-args -DCMAKE_BUILD_TYPE=Release
travis_run_wait 60 catkin build move_base_flex
182 changes: 182 additions & 0 deletions .travis/util.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
#!/bin/bash
#********************************************************************
# Software License Agreement (BSD License)
#
# Copyright (c) 2016, University of Colorado, Boulder
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of the Univ of CO, Boulder nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#********************************************************************/

# Author: Dave Coleman <dave@dav.ee>, Robert Haschke
# Desc: Utility functions used to make CI work better in Travis

#######################################
export TRAVIS_FOLD_COUNTER=0


#######################################
# Start a Travis fold with timer
#
# Arguments:
# travis_fold_name: name of line
# command: action to run
#######################################
function travis_time_start {
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
local COMMAND=${@:2} # all arguments except the first

# Start fold
echo -e "\e[0Ktravis_fold:start:$TRAVIS_FOLD_NAME"
# Output command being executed
echo -e "\e[0Ktravis_time:start:$TRAVIS_TIME_ID\e[34m$COMMAND\e[0m"
}

#######################################
# Wraps up the timer section on Travis CI (that's started mostly by travis_time_start function).
#
# Arguments:
# travis_fold_name: name of line
#######################################
function travis_time_end {
if [ -z $TRAVIS_START_TIME ]; then
echo '[travis_time_end] var TRAVIS_START_TIME is not set. You need to call `travis_time_start` in advance.';
return;
fi
local TRAVIS_END_TIME=$(date +%s%N)
local TIME_ELAPSED_SECONDS=$(( ($TRAVIS_END_TIME - $TRAVIS_START_TIME)/1000000000 ))

# Output Time
echo -e "travis_time:end:$TRAVIS_TIME_ID:start=$TRAVIS_START_TIME,finish=$TRAVIS_END_TIME,duration=$(($TRAVIS_END_TIME - $TRAVIS_START_TIME))\e[0K"
# End fold
echo -e -n "travis_fold:end:$TRAVIS_FOLD_NAME\e[0m"

unset TRAVIS_START_TIME
unset TRAVIS_TIME_ID
unset TRAVIS_FOLD_NAME
}

#######################################
# Display command in Travis console and fold output in dropdown section
#
# Arguments:
# command: action to run
#######################################
function travis_run_impl() {
local command=$@

let "TRAVIS_FOLD_COUNTER += 1"
travis_time_start moveit_ci.$TRAVIS_FOLD_COUNTER $command
# actually run command
$command
result=$?
travis_time_end
return $result
}

#######################################
# Run a command and do folding and timing for it
# Return the exit status of the command
function travis_run() {
travis_run_impl $@ || exit $?
}

#######################################
# Same as travis_run but return 0 exit status, thus ignoring any error
function travis_run_true() {
travis_run_impl $@ || return 0
}

#######################################
# Same as travis_run, but issue some output regularly to indicate that the process is still alive
# from: https://github.com/travis-ci/travis-build/blob/d63c9e95d6a2dc51ef44d2a1d96d4d15f8640f22/lib/travis/build/script/templates/header.sh
function travis_run_wait() {
local timeout=$1 # in minutes

if [[ $timeout =~ ^[0-9]+$ ]]; then
# looks like an integer, so we assume it's a timeout
shift
else
# default value
timeout=20
fi

local cmd=$@
let "TRAVIS_FOLD_COUNTER += 1"
travis_time_start moveit_ci.$TRAVIS_FOLD_COUNTER $cmd

# Disable bash's job control messages
set +m
# Run actual command in background
$cmd &
local cmd_pid=$!

travis_jigger $cmd_pid $timeout $cmd &
local jigger_pid=$!
local result

{
wait $cmd_pid 2>/dev/null
result=$?
# if process finished before jigger, stop the jigger too
ps -p$jigger_pid 2>&1>/dev/null && kill $jigger_pid
}

echo
travis_time_end

return $result
}

#######################################
function travis_jigger() {
local cmd_pid=$1
shift
local timeout=$1
shift
local count=0

echo -n "Waiting for process to finish "
while [ $count -lt $timeout ]; do
count=$(($count + 1))
echo -ne "."
sleep 60 # wait 60s
done

echo -e "\n\033[31;1mTimeout (${timeout} minutes) reached. Terminating \"$@\"\033[0m\n"
kill -9 $cmd_pid
}

# unify_list SEPARATORS LIST
# replace all separator chars given as first argument with spaces
unify_list() {
local separators=$1; shift
echo "$*" | tr "$separators" ' '
}
31 changes: 31 additions & 0 deletions Dockerfile.ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM rrdockerhub/ros-base-melodic-amd64:latest

RUN mkdir -p /root/catkin_ws/src/.travis
WORKDIR /root/catkin_ws

COPY ./move_base_flex_CI.rosinstall src/.rosinstall
COPY ./.travis src/mbf/.travis


# Setup for ssh onto github & bitbucket
# Before running Docker, run locally: `cp ~/.ssh/id_rsa_unsafe id_rsa`
RUN bash -c "source src/mbf/.travis/util.sh && travis_run apt-get update && travis_run apt-get -qq install -y ssh"
RUN mkdir -p /root/.ssh
COPY id_rsa /root/.ssh/id_rsa
RUN chmod 700 /root/.ssh/id_rsa

RUN ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
RUN ssh-keyscan -t rsa bitbucket.org >> ~/.ssh/known_hosts

RUN wstool update -t src --abort-changed-uris

### Stage 2: Build ###
FROM rrdockerhub/ros-base-melodic-amd64:latest
COPY --from=0 /root/catkin_ws /root/catkin_ws
WORKDIR /root/catkin_ws
COPY . src/mbf

# Remove this line if we can get python-catkin-tools to be in the base image
RUN bash -c "source src/mbf/.travis/util.sh && travis_run apt-get update && travis_run apt-get -qq install -y python-catkin-tools"

RUN ./src/mbf/.travis/build_in_docker.sh
9 changes: 9 additions & 0 deletions move_base_flex_CI.rosinstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- git:
local-name: forklift_interfaces
uri: git@github.com:rapyuta-robotics/forklift_interfaces.git
version: devel

- git:
local-name: rr_navigation
uri: git@github.com:rapyuta-robotics/rr_navigation.git
version: devel