Pārlūkot izejas kodu

Fixes CI and adds Kinetic to the matrix. (#39)

Damon Kohler 9 gadi atpakaļ
vecāks
revīzija
3843e796f8
5 mainītis faili ar 92 papildinājumiem un 5 dzēšanām
  1. 18 4
      .travis.yml
  2. 1 1
      Dockerfile.indigo
  3. 18 0
      Dockerfile.kinetic
  4. 26 0
      scripts/load_docker_cache.sh
  5. 29 0
      scripts/save_docker_cache.sh

+ 18 - 4
.travis.yml

@@ -14,8 +14,22 @@
 
 sudo: required
 services: docker
-install:
+
+# 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:
+  - ROS_RELEASE=indigo DOCKER_CACHE_FILE=/home/travis/docker/indigo-cache.tar.gz
+  - ROS_RELEASE=kinetic DOCKER_CACHE_FILE=/home/travis/docker/kinetic-cache.tar.gz
+
+before_install: scripts/load_docker_cache.sh
+
+install: true
+script:
   - git clone https://github.com/googlecartographer/cartographer_ros.git
-  - docker build cartographer_ros -t cartographer_ros
-  - rm -rf cartographer_ros
-script: docker build ${TRAVIS_BUILD_DIR} -t cartographer_turtlebot
+  - docker build cartographer_ros -t cartographer_ros:${ROS_RELEASE} -f cartographer_ros/Dockerfile.${ROS_RELEASE}
+  - docker build ${TRAVIS_BUILD_DIR} -t cartographer_turtlebot:${ROS_RELEASE} -f Dockerfile.${ROS_RELEASE}
+  - scripts/save_docker_cache.sh

+ 1 - 1
Dockerfile → Dockerfile.indigo

@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM cartographer_ros
+FROM cartographer_ros:indigo
 COPY . cartographer_turtlebot
 RUN cartographer_turtlebot/scripts/install.bash
 COPY scripts/ros_entrypoint.sh /

+ 18 - 0
Dockerfile.kinetic

@@ -0,0 +1,18 @@
+# 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.
+
+FROM cartographer_ros:kinetic
+COPY . cartographer_turtlebot
+RUN cartographer_turtlebot/scripts/install.bash
+COPY scripts/ros_entrypoint.sh /

+ 26 - 0
scripts/load_docker_cache.sh

@@ -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

+ 29 - 0
scripts/save_docker_cache.sh

@@ -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_turtlebot:${ROS_RELEASE} |
+      grep -v '<missing>') | gzip > ${DOCKER_CACHE_FILE};
+fi