Adds Docker caching to Travis build. (#137)
parent
16f192aeb9
commit
20487028ed
15
.travis.yml
15
.travis.yml
|
@ -14,5 +14,18 @@
|
||||||
|
|
||||||
sudo: required
|
sudo: required
|
||||||
services: docker
|
services: docker
|
||||||
|
|
||||||
|
# Cache intermediate Docker layers. For a description of how this works, see:
|
||||||
|
# https://giorgos.sealabs.net/docker-cache-on-travis-and-docker-112.html
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- /home/travis/docker/
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
- DOCKER_CACHE_FILE=/home/travis/docker/cache.tar.gz
|
||||||
|
before_install: scripts/load_docker_cache.sh
|
||||||
|
|
||||||
install: true
|
install: true
|
||||||
script: docker build ${TRAVIS_BUILD_DIR} -t cartographer_ros
|
script:
|
||||||
|
- docker build ${TRAVIS_BUILD_DIR} -t cartographer_ros
|
||||||
|
- scripts/save_docker_cache.sh
|
||||||
|
|
11
Dockerfile
11
Dockerfile
|
@ -13,6 +13,15 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
FROM ros:indigo
|
FROM ros:indigo
|
||||||
|
# wstool needs the updated rosinstall file to clone the correct repos.
|
||||||
|
COPY cartographer_ros.rosinstall cartographer_ros/
|
||||||
|
# rosdep needs the updated package.xml files to install the correct debs.
|
||||||
|
COPY cartographer_ros/package.xml cartographer_ros/cartographer_ros/
|
||||||
|
COPY cartographer_ros_msgs/package.xml cartographer_ros/cartographer_ros_msgs/
|
||||||
|
COPY cartographer_rviz/package.xml cartographer_ros/cartographer_rviz/
|
||||||
|
COPY ceres_solver/package.xml cartographer_ros/ceres_solver/
|
||||||
|
COPY scripts/install_debs.sh cartographer_ros/scripts/
|
||||||
|
RUN cartographer_ros/scripts/install_debs.sh && rm -rf /var/lib/apt/lists/*
|
||||||
COPY . cartographer_ros
|
COPY . cartographer_ros
|
||||||
RUN cartographer_ros/scripts/install.sh
|
RUN cartographer_ros/scripts/install_cartographer_ros.sh && rm -rf catkin_ws
|
||||||
COPY scripts/ros_entrypoint.sh /
|
COPY scripts/ros_entrypoint.sh /
|
||||||
|
|
|
@ -17,29 +17,14 @@
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o verbose
|
set -o verbose
|
||||||
|
|
||||||
# Install Ninja.
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y ninja-build
|
|
||||||
|
|
||||||
. /opt/ros/${ROS_DISTRO}/setup.sh
|
. /opt/ros/${ROS_DISTRO}/setup.sh
|
||||||
|
|
||||||
# Create a new workspace in 'catkin_ws'.
|
|
||||||
mkdir catkin_ws
|
|
||||||
cd catkin_ws
|
cd catkin_ws
|
||||||
wstool init src
|
|
||||||
|
|
||||||
# Merge the cartographer_ros.rosinstall file and fetch code for dependencies.
|
|
||||||
wstool merge -t src ../cartographer_ros/cartographer_ros.rosinstall
|
|
||||||
wstool update -t src
|
|
||||||
|
|
||||||
# Use the local version of cartographer_ros to include local modifications.
|
# Use the local version of cartographer_ros to include local modifications.
|
||||||
rm -rf src/cartographer_ros
|
rm -rf src/cartographer_ros
|
||||||
mv ../cartographer_ros src
|
mv ../cartographer_ros src
|
||||||
|
|
||||||
# Install rosdep dependencies.
|
|
||||||
rosdep update
|
|
||||||
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
|
|
||||||
|
|
||||||
# Build, install, and test.
|
# Build, install, and test.
|
||||||
#
|
#
|
||||||
# It's necessary to use the '--install' flag for every call to
|
# It's necessary to use the '--install' flag for every call to
|
||||||
|
@ -50,7 +35,3 @@ rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
|
||||||
export BUILD_FLAGS="--use-ninja --install-space /opt/cartographer_ros --install"
|
export BUILD_FLAGS="--use-ninja --install-space /opt/cartographer_ros --install"
|
||||||
catkin_make_isolated ${BUILD_FLAGS} --catkin-make-args run_tests
|
catkin_make_isolated ${BUILD_FLAGS} --catkin-make-args run_tests
|
||||||
catkin_make_isolated ${BUILD_FLAGS} --pkg cartographer --make-args test
|
catkin_make_isolated ${BUILD_FLAGS} --pkg cartographer --make-args test
|
||||||
|
|
||||||
# Clean up.
|
|
||||||
cd ..
|
|
||||||
rm -rf catkin_ws /var/lib/apt/lists/*
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Copyright 2016 The Cartographer Authors
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o verbose
|
||||||
|
|
||||||
|
# Install Ninja.
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y ninja-build
|
||||||
|
|
||||||
|
. /opt/ros/${ROS_DISTRO}/setup.sh
|
||||||
|
|
||||||
|
# Create a new workspace in 'catkin_ws'.
|
||||||
|
mkdir catkin_ws
|
||||||
|
cd catkin_ws
|
||||||
|
wstool init src
|
||||||
|
|
||||||
|
# Merge the cartographer_ros.rosinstall file and fetch code for dependencies.
|
||||||
|
wstool merge -t src ../cartographer_ros/cartographer_ros.rosinstall
|
||||||
|
wstool update -t src
|
||||||
|
|
||||||
|
# Install rosdep dependencies.
|
||||||
|
rosdep update
|
||||||
|
rosdep install --from-paths src --ignore-src --rosdistro=${ROS_DISTRO} -y
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 2016 The Cartographer Authors
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# Cache intermediate Docker layers. For a description of how this works, see:
|
||||||
|
# https://giorgos.sealabs.net/docker-cache-on-travis-and-docker-112.html
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o verbose
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
if [ -f ${DOCKER_CACHE_FILE} ]; then
|
||||||
|
gunzip -c ${DOCKER_CACHE_FILE} | docker load;
|
||||||
|
fi
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright 2016 The Cartographer Authors
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# Cache intermediate Docker layers. For a description of how this works, see:
|
||||||
|
# https://giorgos.sealabs.net/docker-cache-on-travis-and-docker-112.html
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o verbose
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
if [[ ${TRAVIS_BRANCH} == "master" ]] &&
|
||||||
|
[[ ${TRAVIS_PULL_REQUEST} == "false" ]]; then
|
||||||
|
mkdir -p $(dirname ${DOCKER_CACHE_FILE});
|
||||||
|
docker save $(docker history -q cartographer_ros |
|
||||||
|
grep -v '<missing>') | gzip > ${DOCKER_CACHE_FILE};
|
||||||
|
fi
|
Loading…
Reference in New Issue