From 56806b04d9b72a49ee98253f37250b5eefb7c61c Mon Sep 17 00:00:00 2001 From: Juan Rodriguez Hortala Date: Tue, 26 Feb 2019 16:52:49 -0800 Subject: [PATCH] Move common entry point for CE build from .travis.yml to a script --- ce_build.sh | 27 +++++++++++++++++++++++++++ ros1_build.sh | 0 ros1_sa_build.sh | 0 ros2_build.sh | 0 4 files changed, 27 insertions(+) create mode 100755 ce_build.sh mode change 100644 => 100755 ros1_build.sh mode change 100644 => 100755 ros1_sa_build.sh mode change 100644 => 100755 ros2_build.sh diff --git a/ce_build.sh b/ce_build.sh new file mode 100755 index 0000000..658f77d --- /dev/null +++ b/ce_build.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -e + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +# create a shared mount point to put coverage report +mkdir shared/ +# move travis scripts to share mount so they can be executed within the docker container +cp -r ${SCRIPT_DIR} shared/ +# get a docker container from OSRF's docker hub +docker pull ros:"$ROS_DISTRO"-ros-core +# run docker container +docker run -v "$PWD/shared:/shared" -e ROS_DISTRO="$ROS_DISTRO" \ + -e PACKAGE_NAME="$PACKAGE_NAME" \ + -e ROS_VERSION="$ROS_VERSION" \ + -e NO_TEST="$NO_TEST" \ + --name "$ROS_DISTRO"-container \ + -dit ros:"$ROS_DISTRO"-ros-core /bin/bash +# make a workspace in the docker container +docker exec "$ROS_DISTRO"-container /bin/bash -c 'mkdir -p /"$ROS_DISTRO"_ws/src' +# copy the code over to the docker container +docker cp $TRAVIS_BUILD_DIR "$ROS_DISTRO"-container:/"$ROS_DISTRO"_ws/src/ +# execute build scripts and run test +docker exec "$ROS_DISTRO"-container /bin/bash \ + -c "sh /shared/$(basename ${SCRIPT_DIR})/"'ros"$ROS_VERSION"_build.sh' || travis_terminate 1; +# upload coverage report to codecov +bash <(curl -s https://codecov.io/bash) -Z diff --git a/ros1_build.sh b/ros1_build.sh old mode 100644 new mode 100755 diff --git a/ros1_sa_build.sh b/ros1_sa_build.sh old mode 100644 new mode 100755 diff --git a/ros2_build.sh b/ros2_build.sh old mode 100644 new mode 100755