Skip to content

Commit

Permalink
Fixes in moveit_ci for moveit2
Browse files Browse the repository at this point in the history
ros2 branch of moveit_ci wasn't able to build
moveit_core and other moveit2 packages.

Summary of fixes:
- Changed docker image to one with all dependencies
- Made use of vcstools instead
- Use common ros2.repos instead
- modified scripts to enable local testing in OS X
  • Loading branch information
vmayoral committed Apr 7, 2019
1 parent 9ab02b5 commit 0f53118
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 37 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ It's also possible to run the moveit\_ci script locally, without Travis. We demo
First clone the repo you want to test:

cd /tmp/travis # any working directory will do
git clone https://github.com/ros-planning/moveit2
git clone https://github.com/acutronicrobotics/moveit2
cd moveit2

Next clone the CI script:
Expand Down Expand Up @@ -141,3 +141,25 @@ It's also possible to run the script without using docker. To this end, issue th
mkdir $ROS_WS # and create it

.moveit_ci/travis.sh

## Running Locally For Testing in `OS X`

First clone the repo you want to test:

cd /tmp/travis # any working directory will do
git clone https://github.com/acutronicrobotics/moveit2
cd moveit2

Next clone the CI script:

git clone -b ros2 https://github.com/acutronicrobotics/moveit_ci .moveit_ci

Manually define the variables, Travis would otherwise define for you. These are required:

export TRAVIS_BRANCH=master
export ROS_DISTRO=crystal
export ROS_REPO=acutronicrobotics
export CC=gcc
export CXX=g++
export UPSTREAM_WORKSPACE=moveit.rosinstall
export TRAVIS_OS_NAME=osx
87 changes: 53 additions & 34 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,19 @@ function run_docker() {

# Choose the docker container to use
case "${ROS_REPO:-ros}" in
acutronicrobotics) export DOCKER_IMAGE=acutronicrobotics/moveit2:$ROS_DISTRO-ci ;;
ros) export DOCKER_IMAGE=moveit/moveit2:$ROS_DISTRO-ci ;;
*) echo -e $(colorize RED "Unsupported ROS_REPO=$ROS_REPO. Use 'ros'"); exit 1 ;;
esac

echo -e $(colorize BOLD "Starting Docker image: $DOCKER_IMAGE")
travis_run docker pull $DOCKER_IMAGE

if [[ "${ROS_REPO}" == acutronicrobotics ]]; then
# travis_run docker pull $DOCKER_IMAGE # Image not available from dockerhub for now, build locally
travis_run docker build -t $DOCKER_IMAGE .docker/ci/
else
travis_run docker pull $DOCKER_IMAGE
fi

# Start Docker container
docker run \
Expand Down Expand Up @@ -89,6 +96,9 @@ function update_system() {
# Make sure the packages are up-to-date
travis_run apt-get -qq dist-upgrade

# Make sure autoconf is installed
travis_run apt-get -qq install -y autoconf

# Install clang-tidy stuff if needed
[[ "$TEST" == *clang-tidy* ]] && travis_run apt-get -qq install -y clang-tidy
# run-clang-tidy is part of clang-tools in Bionic, but not in Xenial -> ignore failure
Expand Down Expand Up @@ -153,40 +163,49 @@ function run_xvfb() {
function prepare_ros_workspace() {
travis_fold start ros.ws "Setting up ROS workspace"
travis_run_simple mkdir -p $ROS_WS/src
travis_run_simple cd $ROS_WS/src

# Pull additional packages into the ros workspace
travis_run wstool init .
for item in $(unify_list " ,;" ${UPSTREAM_WORKSPACE:-debian}) ; do
echo "Adding $item"
case "$item" in
debian)
echo "Obtaining debian packages for all upstream dependencies."
break ;;
https://github.com/*) # clone from github
# extract url and optional branch from item=<url>#<branch>
item="${item}#"
url=${item%%#*}
branch=${item#*#}; branch=${branch%#}; branch=${branch:+--branch ${branch}}
travis_run_true git clone -q --depth 1 $branch $url
test $? -ne 0 && echo -e "$(colorize RED Failed clone repository. Aborting.)" && exit 2
continue ;;
http://* | https://* | file://*) ;; # use url as is
*) item="file://$CI_SOURCE_PATH/$item" ;; # turn into proper url
esac
travis_run_true wstool merge -k $item
test $? -ne 0 && echo -e "$(colorize RED Failed to find rosinstall file. Aborting.)" && exit 2
done

# Download upstream packages into workspace
if [ -e .rosinstall ]; then
# ensure that the to-be-tested package is not in .rosinstall
travis_run_true wstool rm $REPOSITORY_NAME
# perform shallow checkout: only possible with wstool init
travis_run_simple mv .rosinstall rosinstall
travis_run cat rosinstall
travis_run wstool init --shallow . rosinstall
fi
if [[ "${ROS_REPO}" == acutronicrobotics ]]; then
travis_run_simple cd $ROS_WS
# There's already a moveit2.repos locally, no need to fetch it
# travis_run wget https://raw.githubusercontent.com/AcutronicRobotics/moveit2/master/moveit2.repos
travis_run vcs import src < moveit2.repos
travis_run_simple cd $ROS_WS/src
else
travis_run_simple cd $ROS_WS/src

# Pull additional packages into the ros workspace
travis_run wstool init .
for item in $(unify_list " ,;" ${UPSTREAM_WORKSPACE:-debian}) ; do
echo "Adding $item"
case "$item" in
debian)
echo "Obtaining debian packages for all upstream dependencies."
break ;;
https://github.com/*) # clone from github
# extract url and optional branch from item=<url>#<branch>
item="${item}#"
url=${item%%#*}
branch=${item#*#}; branch=${branch%#}; branch=${branch:+--branch ${branch}}
travis_run_true git clone -q --depth 1 $branch $url
test $? -ne 0 && echo -e "$(colorize RED Failed clone repository. Aborting.)" && exit 2
continue ;;
http://* | https://* | file://*) ;; # use url as is
*) item="file://$CI_SOURCE_PATH/$item" ;; # turn into proper url
esac
travis_run_true wstool merge -k $item
test $? -ne 0 && echo -e "$(colorize RED Failed to find rosinstall file. Aborting.)" && exit 2
done

# Download upstream packages into workspace
if [ -e .rosinstall ]; then
# ensure that the to-be-tested package is not in .rosinstall
travis_run_true wstool rm $REPOSITORY_NAME
# perform shallow checkout: only possible with wstool init
travis_run_simple mv .rosinstall rosinstall
travis_run cat rosinstall
travis_run wstool init --shallow . rosinstall
fi
fi # else

# Link in the repo we are testing
if [ "$(dirname $CI_SOURCE_PATH)" != $PWD ] ; then
Expand Down
4 changes: 4 additions & 0 deletions travis_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ travis_nanoseconds() {
format='+%s000000000'
fi

if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
format='+%s000000000'
fi

"${cmd}" -u "${format}"
}
travis_time_start() {
Expand Down
9 changes: 7 additions & 2 deletions util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ travis_timeout() {
# travis_fold (start|end) [name] [message]
travis_fold() {
# option -g declares those arrays globally!
declare -ag _TRAVIS_FOLD_NAME_STACK # "stack" array to hold name hierarchy
declare -Ag _TRAVIS_FOLD_COUNTERS # associated array to hold global counters

if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
:
else
declare -ag _TRAVIS_FOLD_NAME_STACK # "stack" array to hold name hierarchy
declare -Ag _TRAVIS_FOLD_COUNTERS # associated array to hold global counters
fi

local action="$1"
local name="${2:-moveit_ci}" # name defaults to moveit_ci
Expand Down

0 comments on commit 0f53118

Please sign in to comment.