Skip to content

Commit

Permalink
travis CI: Switch to Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
mintar committed May 6, 2019
1 parent e9c7873 commit 9114b8d
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 42 deletions.
52 changes: 10 additions & 42 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,15 @@
sudo: required
dist: trusty
# Force travis to use its minimal image with default Python settings
language: generic
notifications:
email:
recipients:
- martin.guenther@dfki.de
on_success: change #[always|never|change] # default: change
on_failure: change #[always|never|change] # default: always

services:
- docker

env:
global:
- CATKIN_WS=~/catkin_ws
- CATKIN_WS_SRC=${CATKIN_WS}/src
matrix:
- CI_ROS_DISTRO="indigo"
- CI_ROS_DISTRO="kinetic"
- CI_ROS_DISTRO="melodic"

install:
- sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty 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
- sudo apt-get install -y dpkg # to upgrade to dpkg >= 1.17.5ubuntu5.8, which fixes https://bugs.launchpad.net/ubuntu/+source/dpkg/+bug/1730627
- sudo apt-get install -qq -y python-rosdep python-catkin-tools
- sudo rosdep init
- rosdep update
# Use rosdep to install all dependencies (including ROS itself)
- rosdep install --from-paths ./ -i -y --rosdistro $CI_ROS_DISTRO
- docker build -t sick_tim_$CI_ROS_DISTRO -f Dockerfile-$CI_ROS_DISTRO .

script:
- export PYTHONPATH=/usr/lib/python2.7/dist-packages # temporary fix for travis-ci/travis-ci#8048
- source /opt/ros/$CI_ROS_DISTRO/setup.bash
- mkdir -p $CATKIN_WS_SRC
- ln -s $TRAVIS_BUILD_DIR $CATKIN_WS_SRC
- cd $CATKIN_WS
- catkin init
# Enable install space
- catkin config --install
# Build [and Install] packages
- catkin build --limit-status-rate 0.1 --no-notify -DCMAKE_BUILD_TYPE=Release
# NOTE on testing: `catkin 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 the CI that the build failed).
# Build tests
- catkin build --limit-status-rate 0.1 --no-notify --make-args tests
# Run tests
- catkin run_tests
# Verify test results
- catkin_test_results
- docker run sick_tim_$CI_ROS_DISTRO /bin/bash -c "source devel/setup.bash && catkin run_tests && catkin_test_results"
17 changes: 17 additions & 0 deletions Dockerfile-kinetic
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ros:kinetic-ros-core

RUN apt-get update && apt-get install -y \
build-essential python-catkin-tools

# Create ROS workspace
COPY . /ws/src/sick_tim
WORKDIR /ws

# Use rosdep to install all dependencies (including ROS itself)
RUN rosdep install --from-paths src -i -y --rosdistro kinetic

RUN /bin/bash -c "source /opt/ros/kinetic/setup.bash && \
catkin init && \
catkin config --install -j 1 -p 1 && \
catkin build --limit-status-rate 0.1 --no-notify && \
catkin build --limit-status-rate 0.1 --no-notify --make-args tests"
17 changes: 17 additions & 0 deletions Dockerfile-melodic
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ros:melodic-ros-core

RUN apt-get update && apt-get install -y \
build-essential python-catkin-tools

# Create ROS workspace
COPY . /ws/src/sick_tim
WORKDIR /ws

# Use rosdep to install all dependencies (including ROS itself)
RUN rosdep install --from-paths src -i -y --rosdistro melodic

RUN /bin/bash -c "source /opt/ros/melodic/setup.bash && \
catkin init && \
catkin config --install -j 1 -p 1 && \
catkin build --limit-status-rate 0.1 --no-notify && \
catkin build --limit-status-rate 0.1 --no-notify --make-args tests"

0 comments on commit 9114b8d

Please sign in to comment.