diff --git a/README.md b/README.md index 2d307055..89faed3e 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 diff --git a/travis.sh b/travis.sh index be9d8793..a225a5cb 100755 --- a/travis.sh +++ b/travis.sh @@ -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 \ @@ -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 @@ -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=# - 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=# + 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 diff --git a/travis_functions.sh b/travis_functions.sh index 05632c59..82171d43 100644 --- a/travis_functions.sh +++ b/travis_functions.sh @@ -31,6 +31,10 @@ travis_nanoseconds() { format='+%s000000000' fi + if [[ "${TRAVIS_OS_NAME}" == osx ]]; then + format='+%s000000000' + fi + "${cmd}" -u "${format}" } travis_time_start() { diff --git a/util.sh b/util.sh index d9400c3d..20ccb3e4 100644 --- a/util.sh +++ b/util.sh @@ -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