Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI settings #25

Merged
merged 9 commits into from Apr 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions .travis.scripts/install_deps.sh
@@ -0,0 +1,24 @@
#!/bin/bash

set -o errexit
set -o verbose

scriptdir=`dirname "${0}"`

source /opt/ros/${ROS_DISTRO}/setup.bash
source /catkin_ws/devel/setup.bash

cd /catkin_ws

SKIP_KEYS=
if [ -f $scriptdir/rosdepkeys.skip ];
then
SKIP_KEYS="--skip-keys=\"$(cat $scriptdir/rosdepkeys.skip | tr '\n' ' ' | sed 's/\s*$//g')\""
fi

echo $SKIP_KEYS

apt-get -qq update
eval rosdep install --from-paths src --ignore-src $SKIP_KEYS --rosdistro=${ROS_DISTRO} -y
apt-get clean
rm -rf /var/lib/apt/lists/*
10 changes: 1 addition & 9 deletions .travis.scripts/load_cache.sh
Expand Up @@ -3,12 +3,4 @@
set -o errexit
set -o verbose

sudo apt-get -qq update
sudo apt-get install -y liblz4-tool

echo ${DOCKER_CACHE_FILE}

if [ -f ${DOCKER_CACHE_FILE} ]; then
lz4 -dc ${DOCKER_CACHE_FILE} | docker load || true
fi

docker pull ${DOCKER_CACHE_REGISTRY}:${ROS_DISTRO_TARGET} || true
3 changes: 3 additions & 0 deletions .travis.scripts/rosdepkeys.skip
@@ -0,0 +1,3 @@
ypspur
ros-kinetic-ypspur
ros-indigo-ypspur
10 changes: 3 additions & 7 deletions .travis.scripts/save_cache.sh
Expand Up @@ -5,11 +5,7 @@ set -o verbose

if [[ ${TRAVIS_BRANCH} == "master" ]] && [[ ${TRAVIS_PULL_REQUEST} == "false" ]];
then
mkdir -p $(dirname ${DOCKER_CACHE_FILE})
docker save $(echo ${DOCKER_CACHE_TARGETS} | xargs -n1 docker history -q | grep -v '<missing>' | sort | uniq) | lz4 -zcf - > ${DOCKER_CACHE_FILE}

echo "------------"
ls -lh $(dirname ${DOCKER_CACHE_FILE})
echo "------------"
docker tag ${DOCKER_CACHE_TARGET}:${ROS_DISTRO_TARGET} ${DOCKER_CACHE_REGISTRY}:${ROS_DISTRO_TARGET}
docker login -u ${DOCKER_HUB_USER} -p ${DOCKER_HUB_TOKEN}
docker push ${DOCKER_CACHE_REGISTRY}:${ROS_DISTRO_TARGET}
fi

12 changes: 0 additions & 12 deletions .travis.scripts/setup_docker.sh

This file was deleted.

12 changes: 5 additions & 7 deletions .travis.scripts/test.sh
Expand Up @@ -5,8 +5,7 @@ set -o verbose

scriptdir=`dirname "${0}"`

wget -q -P /tmp https://raw.githubusercontent.com/at-wat/gh-pr-comment/master/gh-pr-comment.sh
source /tmp/gh-pr-comment.sh
pip install gh-pr-comment

source /opt/ros/${ROS_DISTRO}/setup.bash

Expand All @@ -25,10 +24,10 @@ fi

echo $SKIP_KEYS

apt-get -qq update && \
apt-get install libxml2-utils && \
rosdep install --from-paths src --ignore-src $SKIP_KEYS --rosdistro=${ROS_DISTRO} -y && \
apt-get clean && \
apt-get -qq update
apt-get install libxml2-utils
eval rosdep install --from-paths src --ignore-src $SKIP_KEYS --rosdistro=${ROS_DISTRO} -y
apt-get clean
rm -rf /var/lib/apt/lists/*

CMI_OPTION="--install-space /opt/ros/${ROS_DISTRO} --install"
Expand Down Expand Up @@ -62,4 +61,3 @@ gh-pr-comment "PASSED on ${ROS_DISTRO}" "All tests passed$result_text"

cd ..
rm -rf /catkin_ws || true

13 changes: 7 additions & 6 deletions .travis.yml
Expand Up @@ -7,20 +7,21 @@ cache:
env:
global:
- PACKAGE_NAME=ypspur_ros
- DOCKER_CACHE_FILE=/home/travis/docker/cache.tar.lz4
- DOCKER_CACHE_TARGETS="${PACKAGE_NAME}:latest ${PACKAGE_NAME}:indigo"
- DOCKER_CACHE_TARGET=ypspurros
- DOCKER_CACHE_REGISTRY=atwat/ros-ypspurros-cache
matrix:
- ROS_DISTRO_TARGET=kinetic
- ROS_DISTRO_TARGET=indigo
branches:
only:
- master

before_install:
- .travis.scripts/setup_docker.sh
- .travis.scripts/load_cache.sh

install: true

script:
- docker build -t ${PACKAGE_NAME}:latest --pull=true ${TRAVIS_BUILD_DIR} --build-arg TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} --build-arg TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG} --build-arg TRAVIS_BOT_GITHUB_TOKEN=${TRAVIS_BOT_GITHUB_TOKEN} --build-arg PACKAGE_NAME=${PACKAGE_NAME}
- docker build -t ${PACKAGE_NAME}:indigo -f Dockerfile.indigo --pull=true ${TRAVIS_BUILD_DIR} --build-arg TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} --build-arg TRAVIS_REPO_SLUG=${TRAVIS_REPO_SLUG} --build-arg TRAVIS_BOT_GITHUB_TOKEN=${TRAVIS_BOT_GITHUB_TOKEN} --build-arg PACKAGE_NAME=${PACKAGE_NAME}
- docker build --cache-from ${DOCKER_CACHE_REGISTRY}:${ROS_DISTRO_TARGET} -t ${DOCKER_CACHE_TARGET}:${ROS_DISTRO_TARGET} -f Dockerfile.${ROS_DISTRO_TARGET} --pull=true ${TRAVIS_BUILD_DIR}
- docker run --rm -it -e TRAVIS_PULL_REQUEST=${TRAVIS_PULL_REQUEST} -e TRAVIS_PULL_REQUEST_SLUG=${TRAVIS_PULL_REQUEST_SLUG} -e TRAVIS_BOT_GITHUB_TOKEN=${TRAVIS_BOT_GITHUB_TOKEN} -e PACKAGE_NAME=${PACKAGE_NAME} ${DOCKER_CACHE_TARGET}:${ROS_DISTRO_TARGET} /catkin_ws/src/${PACKAGE_NAME}/.travis.scripts/test.sh
- .travis.scripts/save_cache.sh

19 changes: 0 additions & 19 deletions Dockerfile

This file was deleted.

31 changes: 17 additions & 14 deletions Dockerfile.indigo
@@ -1,19 +1,22 @@
FROM ros:indigo

RUN apt-get -qq update && \
apt-get install -y --no-install-recommends sudo wget curl build-essential && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN apt-get -qq update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
python-pip \
sudo \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ARG TRAVIS_PULL_REQUEST=false
ARG TRAVIS_REPO_SLUG=""
ARG TRAVIS_BOT_GITHUB_TOKEN=""
ARG PACKAGE_NAME=""
RUN rosdep update \
&& mkdir -p /catkin_ws/src \
&& cd /catkin_ws/src \
&& bash -c ". /opt/ros/${ROS_DISTRO}/setup.bash && catkin_init_workspace && cd .. && catkin_make"

ENV TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST
ENV TRAVIS_REPO_SLUG=$TRAVIS_REPO_SLUG
ENV TRAVIS_BOT_GITHUB_TOKEN=$TRAVIS_BOT_GITHUB_TOKEN
ENV PACKAGE_NAME=$PACKAGE_NAME
COPY ./.travis.scripts /catkin_ws/src/ypspur_ros/.travis.scripts
COPY ./package.xml /catkin_ws/src/ypspur_ros/package.xml
RUN /catkin_ws/src/ypspur_ros/.travis.scripts/install_deps.sh

COPY ./ /catkin_ws/src/${PACKAGE_NAME}
RUN /catkin_ws/src/${PACKAGE_NAME}/.travis.scripts/test.sh
COPY ./ /catkin_ws/src/ypspur_ros
21 changes: 21 additions & 0 deletions Dockerfile.kinetic
@@ -0,0 +1,21 @@
FROM ros:kinetic

RUN apt-get -qq update \
&& apt-get install -y --no-install-recommends \
curl \
python-pip \
sudo \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN rosdep update \
&& mkdir -p /catkin_ws/src \
&& cd /catkin_ws/src \
&& bash -c ". /opt/ros/${ROS_DISTRO}/setup.bash && catkin_init_workspace && cd .. && catkin_make"

COPY ./.travis.scripts /catkin_ws/src/ypspur_ros/.travis.scripts
COPY ./package.xml /catkin_ws/src/ypspur_ros/package.xml
RUN /catkin_ws/src/ypspur_ros/.travis.scripts/install_deps.sh

COPY ./ /catkin_ws/src/ypspur_ros