diff --git a/.travis/after_failure b/.travis/after_failure index 5662cf10..420f615f 100755 --- a/.travis/after_failure +++ b/.travis/after_failure @@ -1,5 +1,5 @@ #!/bin/bash -. .travis/common.sh +. `dirname $0`/common.sh # Set debug mode set -x @@ -13,8 +13,8 @@ if [ -d debian ]; then echo "Debian build failed" else if [ ! x${DIST} = x ]; then - echo "skipping this build" - exit 0 + echo "skipping this build" + exit 0 fi # Dump as much log as we can diff --git a/.travis/after_success b/.travis/after_success index e9602e65..f0a154ad 100755 --- a/.travis/after_success +++ b/.travis/after_success @@ -1,99 +1,128 @@ #!/bin/bash -. .travis/common.sh +. `dirname $0`/common.sh # Set debug mode set -x set -v -if [ -d debian ]; then - if `test x${DIST} = x`; then - echo "distribution is not set, skipping this build" - exit 0 - fi - echo "Target distribution: ${DIST}" +############################## +# -- Helper functions -- # +############################## - export GNUPGHOME="$root_dir/.travis/.gnupg" - # If the build is a success, upload the source package to Launchpad. - if `test x${DIST} = xunstable`; then - echo "Debian Sid package. Skipping Launchpad upload..." +upload_to_ppa() +{ + if `test x${DIST} = x`; then + echo "distribution is not set, skipping this build" + exit 0 + fi + echo "Target distribution: ${DIST}" + + export GNUPGHOME="`dirname $0`/.gnupg" + # If the build is a success, upload the source package to Launchpad. + if `test x${DIST} = xunstable`; then + echo "Debian Sid package. Skipping Launchpad upload..." + else + if `! test ${CI_PULL_REQUEST} = false`; then + echo "skipping launchpad upload in pull request" else - if `! test ${TRAVIS_PULL_REQUEST} = false`; then - echo "skipping launchpad upload in pull request" - else - dput ppa:${PPA_URI} "$build_dir"/export/*_source.changes - fi - fi -elif [[ ${TRAVIS_OS_NAME} = linux ]]; then - if [ ! x${DIST} = x ]; then - echo "skipping this build" - exit 0 + dput ppa:${PPA_URI} "$build_dir"/export/*_source.changes fi + fi +} +generate_coverage_data() +{ + # Upload coveralls data. + if [ x${CC} = xgcc ]; then + cd $build_dir + # If tests failed, coveralls data may not have been written + lcov --directory $build_dir --base-directory $root_dir --capture --output-file coverage.info || true + # Note: ignore rules are given by a string such as "*test* *foo*" + # lcov expects: '*test*' '*foo*' + # We use -f to prevent expansion of * + set -f + lcov --remove coverage.info '/usr*' "$install_dir*" ${LCOV_IGNORE_RULES} -o coverage.info || true + set +f cd $root_dir - HEAD=`git rev-parse HEAD` + coveralls-lcov "$build_dir/coverage.info" || true + cd - + else + echo "skipping coveralls upload in non-gcc builds" + fi +} - # Upload coveralls data. - if [ x${CC} = xgcc ]; then - cd $build_dir - # If tests failed, coveralls data may not have been written - lcov --directory $build_dir --base-directory $root_dir --capture --output-file coverage.info || true - lcov --remove coverage.info '/usr*' "$install_dir*" -o coverage.info || true - if `! test x${LCOV_IGNORE_RULES} = x`; then - # Note: ignore rules are given by a string such as "*test* *foo*" - # lcov expects: '*test*' '*foo*' - # We use -f to prevent expansion of * - set -f - lcov --remove coverage.info ${LCOV_IGNORE_RULES} -o coverage.info || true - set +f - fi - cd $root_dir - coveralls-lcov "$build_dir/coverage.info" || true - cd - - else - echo "skipping coveralls upload in non-gcc builds" +set_push_uri() +{ + # If GH_PUSH_URI has already been provided + if `test x${GH_PUSH_URI} != x`; then + export GH_PUSH_URI=${GH_PUSH_URI} + # If encrypted username/tokens were not provided + elif `test x${GH_TOKEN} = x -o x${GH_USERNAME} = x`; then + echo "missing username and/or token for GitHub push" + export GH_PUSH_URI="" + else + export GH_PUSH_URI=https://${GH_USERNAME}:${GH_TOKEN}@github.com/${GH_REPO} + fi + if `test x${GH_PUSH_URI} != x`; then + cd $root_dir + git remote set-url origin "${GH_PUSH_URI}" + fi + return 0 +} + +update_documentation() +{ + # If we are on the master branch: + if [[ ${CI_BRANCH} = master ]]; then + # Update the documentation. + # Retrieve last commit of the gh-pages branch. + if `git fetch --depth=1 origin gh-pages:gh-pages`; then + cd $build_dir/doc && $root_dir/cmake/github/update-doxygen-doc.sh \ + -r $root_dir -b $build_dir fi + fi +} - # If it's not a fork or a pull request - if `test x${TRAVIS_REPO_SLUG} = x${GH_REPO} -a ${TRAVIS_PULL_REQUEST} = false`; then - # If encrypted username/tokens were not provided - if `test x${GH_TOKEN} = x -o x${GH_USERNAME} = x`; then - echo "missing username and/or token for GitHub push" - else - cd $root_dir - # Set the push capable URL. - # - # Add the possibility to use three variables instead of one to - # work around string maximum length limitation issue. - if `test x${GH_PUSH_URI} = x`; then - export GH_PUSH_URI=https://${GH_USERNAME}:${GH_TOKEN}@github.com/${GH_REPO} - fi - git remote set-url origin "${GH_PUSH_URI}" +push_note() +{ + # Push git note indicating success + cd $root_dir + HEAD=`git rev-parse HEAD` + notes_msg="Successful build.\n----\n\nDependencies commit id:" + for package in ${GIT_DEPENDENCIES}; do + git_dependency_parsing $package + cd $build_dir/$git_dep + commitid=`git rev-parse HEAD || echo unknown` + notes_msg="${notes_msg} $git_dep : $commitid\n" + done + cd $root_dir + git fetch --quiet --force origin refs/notes/jrl-ci:refs/notes/jrl-ci || true + git notes --ref=jrl-ci add -f -m "$(echo "${notes_msg}")" $HEAD + git push origin refs/notes/jrl-ci --force +} - # If we are on the master branch: - if [[ ${TRAVIS_BRANCH} = master ]]; then - # Update the documentation. - # Retrieve last commit of the gh-pages branch. - git fetch --depth=1 origin gh-pages:gh-pages +######################### +# -- Main script -- # +######################### - cd $build_dir/doc && $root_dir/cmake/github/update-doxygen-doc.sh \ - -r $root_dir -b $build_dir - fi +if [ -d debian ]; then + upload_to_ppa +elif [[ ${CI_OS_NAME} = linux ]]; then + if [ ! x${DIST} = x ]; then + echo "skipping this build" + exit 0 + fi - # Push git note indicating success - cd $root_dir - notes_msg="Successful build.\n----\n\nDependencies commit id:" - for package in ${GIT_DEPENDENCIES}; do - cd $build_dir/$package - commitid=`git rev-parse HEAD || echo unknown` - notes_msg="${notes_msg} $package : $commitid\n" - done - cd $root_dir - git fetch --quiet --force origin refs/notes/travis:refs/notes/travis || true - git notes --ref=travis add -f -m "$(echo "${notes_msg}")" $HEAD - git push origin refs/notes/travis --force - fi + generate_coverage_data + # If it's not a fork or a pull request + if `test x${CI_REPO_SLUG} = x${GH_REPO} -a ${CI_PULL_REQUEST} = false`; then + set_push_uri + if `test x${GH_PUSH_URI} != x`; then + update_documentation + push_note + fi else - echo "skipping doc/build result upload on forks and for pull requests" + echo "skipping doc/build result upload on forks and for pull requests" fi fi diff --git a/.travis/appveyor.yml.in b/.travis/appveyor.yml.in new file mode 100644 index 00000000..cb646339 --- /dev/null +++ b/.travis/appveyor.yml.in @@ -0,0 +1,42 @@ +version: 1.0.{build} +os: Visual Studio 2015 +clone_folder: C:/devel-src/@PROJECT_NAME@ +# The following lines output the connection parameters for the RDE in AppVeyor +# at the start of the build. Be advised that this may allow people to tinker +# with your build +# init: +# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +environment: + CI_OS_NAME: win32 + CI_TOOL: appveyor +# Dependencies should be a list of dependencies separated by ';' + CHOCO_DEPENDENCIES: @CHOCO_DEPENDENCIES@ + GIT_DEPENDENCIES: @GIT_DEPENDENCIES@ +# Should be the same as clone_folder + PROJECT_SOURCE_DIR: C:/devel-src/@PROJECT_NAME@ +# Do not tinker with the variables below unless you know what you are doing + SOURCE_FOLDER: C:/devel-src + CMAKE_INSTALL_PREFIX: C:/devel + PATH: C:/devel/bin;C:\Libraries\boost_1_59_0\lib64-msvc-14.0;%PATH% + PKG_CONFIG_PATH: C:/devel/lib/pkgconfig + BOOST_ROOT: C:\Libraries\boost_1_59_0 + BOOST_LIBRARYDIR: C:\Libraries\boost_1_59_0\lib64-msvc-14.0 +# N.B: empty lines here and in test_script are VERY important +build_script: +- ps: >- + Set-PSDebug -Trace 1 + + . ./.jrl-ci/functions.ps1 + + setup_build + + ./.jrl-ci/dependencies/eigen-3.2.ps1 + + install_dependencies + + build_project +test_script: +- cmd: >- + cd %PROJECT_SOURCE_DIR% + + ctest diff --git a/.travis/before_install b/.travis/before_install index 085f016c..eaa5c897 100755 --- a/.travis/before_install +++ b/.travis/before_install @@ -2,186 +2,234 @@ rm -rf "$build_dir" "$install_dir" -. .travis/common.sh +. `dirname $0`/common.sh # Set debug mode set -x set -v -# Print Git version -git --version - -# Setup Git identity. -git config --global user.name "Thomas Moulard (Travis Automatic Builds)" -git config --global user.email "thomas.moulard+travis@gmail.com" - -# Retrieve the submodules. -git submodule update --quiet --init --recursive - -# Setup environment variables. -export LD_LIBRARY_PATH="$install_dir/lib:$LD_LIBRARY_PATH" -export PKG_CONFIG_PATH="$install_dir/lib/pkgconfig:$PKG_CONFIG_PATH" +############################## +# -- Helper functions -- # +############################## -if [[ ${TRAVIS_OS_NAME} = linux ]]; then - # Speed up apt - sudo sh -c "echo \"force-unsafe-io\" > /etc/dpkg/dpkg.cfg.d/02apt-speedup" - - # Update the apt local cache. - sudo apt-get update -qq - - export LD_LIBRARY_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`:$LD_LIBRARY_PATH" - export PKG_CONFIG_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`/pkgconfig:$PKG_CONFIG_PATH" -fi +_linux_setup_package_source() +{ + # Speed up apt + ${SUDO_CMD} sh -c "echo \"force-unsafe-io\" > /etc/dpkg/dpkg.cfg.d/02apt-speedup" + # Update the apt local cache. + ${SUDO_CMD} apt-get update -qq +} -# Fetch tags to compute the distance between the last release tag -# and us. -git fetch --quiet --tags +_osx_setup_package_source() +{ + # Add science-related repos + brew tap homebrew/science + # Update homebrew + brew update +} -# Shortcuts. -git_clone="git clone --quiet --recursive" +# setup_package_source +# --------------------- +# +# Setup the package source (e.g. homebrew on osx, apt on debian-like systems) +setup_package_source() +{ + if [[ ${CI_OS_NAME} = linux ]]; then + _linux_setup_package_source + fi + if [[ ${CI_OS_NAME} = osx ]]; then + _osx_setup_package_source + fi +} -# Display environment -echo "Environment:" -env +# setup_pbuilder +# -------------- +# +# Setup a pbuilder environment +setup_pbuilder() +{ + if `test x${DIST} = x`; then + echo "distribution is not set, skipping this build" + exit 0 + fi + echo "Target distribution: ${DIST}" + + # If we are, we install Debian package development tools and + # create a sid pbuilder. Package dependencies will be installed + # automatically. + ${SUDO_CMD} apt-get install -qq \ + debootstrap devscripts \ + git-buildpackage debian-archive-keyring \ + pkg-kde-tools dput eatmydata ccache + + # Fix ccache use in pbuilder + ${SUDO_CMD} addgroup --system --gid 1234 ccache + ${SUDO_CMD} adduser --quiet --system --uid 1234 --ingroup ccache \ + --home /var/cache/pbuilder --no-create-home pbuilder + ${SUDO_CMD} mkdir -p /var/cache/pbuilder/ccache + ${SUDO_CMD} chown -R pbuilder:ccache /var/cache/pbuilder/ccache + ${SUDO_CMD} chmod -R g+ws /var/cache/pbuilder/ccache + + # Remove previous sandbox. + ${SUDO_CMD} rm -rf /var/cache/pbuilder/base-${DIST}.cow || true + + # Create a pbuilder sandbox. + cp -f `dirname $0`/pbuilderrc $HOME/.pbuilderrc + sed -i "s|@DIST@|${DIST}|g" $HOME/.pbuilderrc + + git-pbuilder create + + # Speed up pbuilder. + echo "echo \"force-unsafe-io\" > /etc/dpkg/dpkg.cfg.d/02apt-speedup" | \ + git-pbuilder login --save-after-exec + + # Add additional PPAs + for ppa in ${DEBIAN_PPA}; do + echo "apt-add-repository ppa:${ppa}" | \ + git-pbuilder login --save-after-exec + done + + # Retrieve PPA package list. + git-pbuilder update + + # FIXME There is something fishy here... + # ccache is not necessary in our case and may cause permission + # issues. + echo "apt-get -y remove ccache" | \ + git-pbuilder login --save-after-exec +} # catkin_git_dependency # -------------------- # +# Clone catkin package into the workspace +# See arguments of build_git_dependency +# Branch defaults to $ROS_DISTRO instead of master catkin_git_dependency() { - _string=$1 - git_dep=${_string%%:*} - git_dep_branch=${_string##*:} - # For ROS packages, the default version is named after the ROS distro. - if [ "$git_dep_branch" == "$git_dep" ]; then - git_dep_branch="$ROS_DISTRO" - fi - echo "--> Getting $git_dep (branch $git_dep_branch)" - CATKIN_WORKSPACE=$build_dir/.. - cd $CATKIN_WORKSPACE/src - $git_clone -b $git_dep_branch "git://github.com/$git_dep" "$git_dep" + git_dependency_parsing $1 $ROS_DISTRO + echo "--> Getting $git_dep (branch $git_dep_branch)" + CATKIN_DEP_WORKSPACE=/tmp/_ci/catkin_dep_ws + cd $CATKIN_DEP_WORKSPACE/src + $git_clone -b $git_dep_branch "$git_dep_uri" "$git_dep" } +# catkin_build_workspace +# ---------------------- +# +# Build catkin workspace +catkin_build_workspace() +{ + CATKIN_DEP_WORKSPACE=/tmp/_ci/catkin_dep_ws + cd $CATKIN_DEP_WORKSPACE + catkin_make +} # build_git_dependency # -------------------- # # Build a dependency directly from the Git development tree. -# First argument: repository's GitHub URL + optional branch -# For example: "jrl-umi3218/jrl-travis" or "jrl-umi3218/jrl-travis:dev" +# First argument: repository's GitHub URL or repository's URI + optional branch +# For example: "jrl-umi3218/jrl-travis" or "jrl-umi3218/jrl-travis#dev" +# Or: user@host:path/to/repo or git@github.com:organization/repo#branch build_git_dependency() { - _string=$1 - git_dep=${_string%%:*} - git_dep_branch=${_string##*:} - if [ "$git_dep_branch" == "$git_dep" ]; then - git_dep_branch="master" - fi - echo "--> Compiling $git_dep (branch $git_dep_branch)" - mkdir -p "$build_dir/$git_dep" - cd "$build_dir" - $git_clone -b $git_dep_branch "git://github.com/$git_dep" "$git_dep" - cd "$build_dir/$git_dep" - cmake . -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" \ - -DDISABLE_TESTS:BOOL=ON - make install || make + git_dependency_parsing $1 + echo "--> Compiling $git_dep (branch $git_dep_branch)" + cd "$build_dir" + mkdir -p "$git_dep" + $git_clone -b $git_dep_branch "$git_dep_uri" "$git_dep" + cd "$git_dep" + cmake . -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" \ + -DDISABLE_TESTS:BOOL=ON ${CMAKE_ADDITIONAL_OPTIONS} + make install || make } +_osx_install_dependencies() +{ + # Install user-specified packages + brew install cppcheck ${HOMEBREW_DEPENDENCIES} +} + +_linux_install_dependencies() +{ + # Add additional PPAs + for ppa in ${MASTER_PPA}; do + ${SUDO_CMD} add-apt-repository -y ppa:${ppa} + done + ${SUDO_CMD} apt-get update -qq + + ${SUDO_CMD} apt-get install -qq curl cppcheck ${APT_DEPENDENCIES} + + # Install lcov from github + cd "$build_dir" + wget https://github.com/linux-test-project/lcov/releases/download/v1.12/lcov-1.12.tar.gz + tar zxvf lcov-1.12.tar.gz + cd lcov-1.12 + # Reset lcov to release 1.12 + ${SUDO_CMD} make install + + gem install coveralls-lcov +} + +install_dependencies() +{ + if [[ ${CI_OS_NAME} = linux ]]; then + _linux_install_dependencies + fi + if [[ ${CI_OS_NAME} = osx ]]; then + _osx_install_dependencies + fi + # and we build directly dependencies from the Git repository + for package in ${ROS_GIT_DEPENDENCIES}; do + catkin_git_dependency "$package" + done + if `test "x${ROS_GIT_DEPENDENCIES}" != x`; then + catkin_build_workspace + fi + + for package in ${GIT_DEPENDENCIES}; do + build_git_dependency "$package" + done +} + +######################### +# -- Main script -- # +######################### + +# Print Git version +git --version + +# Setup Git identity. +git config --global user.name "JRL/IDH Continuous Integration Tool" +git config --global user.email "jrl-idh+ci@gmail.com" + +# Retrieve the submodules. +git submodule update --quiet --init --recursive + +# Fetch tags to compute the distance between the last release tag +# and us. +git fetch --quiet --tags + +# Shortcuts. +git_clone="git clone --quiet --recursive" + +# Display environment +echo "Environment:" +env + + +setup_package_source + # Check if we are in a debian branch... if [ -d debian ]; then - if `test x${DIST} = x`; then - echo "distribution is not set, skipping this build" - exit 0 - fi - echo "Target distribution: ${DIST}" - - # If we are, we install Debian package development tools and - # create a sid pbuilder. Package dependencies will be installed - # automatically. - sudo apt-get install -qq \ - debootstrap devscripts \ - git-buildpackage debian-archive-keyring \ - pkg-kde-tools dput eatmydata ccache - - # Fix ccache use in pbuilder - sudo addgroup --system --gid 1234 ccache - sudo adduser --quiet --system --uid 1234 --ingroup ccache \ - --home /var/cache/pbuilder --no-create-home pbuilder - sudo mkdir -p /var/cache/pbuilder/ccache - sudo chown -R pbuilder:ccache /var/cache/pbuilder/ccache - sudo chmod -R g+ws /var/cache/pbuilder/ccache - - # Remove previous sandbox. - sudo rm -rf /var/cache/pbuilder/base-${DIST}.cow || true - - # Create a pbuilder sandbox. - cp -f $root_dir/.travis/pbuilderrc $HOME/.pbuilderrc - sed -i "s|@DIST@|${DIST}|g" $HOME/.pbuilderrc - - git-pbuilder create - - # Speed up pbuilder. - echo "echo \"force-unsafe-io\" > /etc/dpkg/dpkg.cfg.d/02apt-speedup" | \ - git-pbuilder login --save-after-exec - - # Add additional PPAs - for ppa in ${DEBIAN_PPA}; do - echo "apt-add-repository ppa:${ppa}" | \ - git-pbuilder login --save-after-exec - done - - # Retrieve PPA package list. - git-pbuilder update - - # ccache is not necessary in our case and may cause permission - # issues. - echo "apt-get -y remove ccache" | \ - git-pbuilder login --save-after-exec + setup_pbuilder else - if [ ! x${DIST} = x ]; then - echo "skipping this build" - exit 0 - fi - - if [[ ${TRAVIS_OS_NAME} = linux ]]; then - # Add additional PPAs - for ppa in ${MASTER_PPA}; do - sudo add-apt-repository -y ppa:${ppa} - done - sudo apt-get update -qq - - # ...otherwise we install the dependencies explicitly. - sudo apt-get install -qq curl cppcheck ${APT_DEPENDENCIES} - - # Install lcov and related dependencies - sudo apt-get install -qq lcov - - # lcov will only be used on linux - gem install coveralls-lcov - - elif [[ ${TRAVIS_OS_NAME} = osx ]]; then - - # Add science-related repos - brew tap homebrew/science - - # Update homebrew - brew update - - # Install user-specified packages - brew install cppcheck ${HOMEBREW_DEPENDENCIES} - fi - - # and we build directly dependencies from the Git repository - if `! test x${ROS_GIT_DEPENDENCIES} = x`; then - for package in ${ROS_GIT_DEPENDENCIES}; do - catkin_git_dependency "$package" - done - fi - - cd $root_dir - for package in ${GIT_DEPENDENCIES}; do - build_git_dependency "$package" - done + if [ ! x${DIST} = x ]; then + echo "skipping this build" + exit 0 + fi + install_dependencies fi # End debug mode diff --git a/.travis/build b/.travis/build index c89ecb9d..a4514173 100755 --- a/.travis/build +++ b/.travis/build @@ -1,5 +1,5 @@ #!/bin/bash -. .travis/common.sh +. `dirname $0`/common.sh # Set debug mode set -x @@ -16,24 +16,22 @@ build_package() cd "$build_dir" cmake "$root_dir" -DCMAKE_INSTALL_PREFIX="$install_dir" \ - -DCMAKE_CXX_FLAGS="--coverage" \ - -DCMAKE_EXE_LINKER_FLAGS="--coverage" \ - -DCMAKE_MODULE_LINKER_FLAGS="--coverage" \ - ${CMAKE_ADDITIONAL_OPTIONS} + -DCMAKE_CXX_FLAGS="--coverage" \ + -DCMAKE_EXE_LINKER_FLAGS="--coverage" \ + -DCMAKE_MODULE_LINKER_FLAGS="--coverage" \ + ${CMAKE_ADDITIONAL_OPTIONS} ${MAKE_PREFIX} make make install - if `test x${ALLOW_TESTSUITE_FAILURE} = x`; then - ALLOW_TESTSUITE_FAILURE=false - fi + ALLOW_TESTSUITE_FAILURE=${ALLOW_TESTSUITE_FAILURE:-false} make test || ${ALLOW_TESTSUITE_FAILURE} cppcheck --quiet --enable=all \ - -I $root_dir/src -I $root_dir/tests -I $root_dir/include \ - -I $root_dir/tests/shared-tests \ - -I $build_dir/include -I $install_dir/include \ - -i $build_dir/CMakeFiles \ - $root_dir || true + -I $root_dir/src -I $root_dir/tests -I $root_dir/include \ + -I $root_dir/tests/shared-tests \ + -I $build_dir/include -I $install_dir/include \ + -i $build_dir/CMakeFiles \ + $root_dir || true } # debian_build_package @@ -51,10 +49,10 @@ debian_build_package() cd "$root_dir" buildNumber=$(git rev-list \ - $(git describe --tags --match "debian/*" --abbrev=0)..HEAD | wc -l) \ - || buildNumber=1 + $(git describe --tags --match "debian/*" --abbrev=0)..HEAD | wc -l) \ + || buildNumber=1 dch --force-distribution --distribution ${DIST} \ - --local ppa$buildNumber+$DIST "Travis automatic build" + --local ppa$buildNumber+$DIST "Travis automatic build" echo "debian/changelog first line:" head -n 1 debian/changelog @@ -62,44 +60,62 @@ debian_build_package() git add debian/changelog git commit -m "Travis automatic commit" - sudo chmod -R 777 /var/cache/pbuilder/ccache + ${SUDO_CMD} chmod -R 777 /var/cache/pbuilder/ccache # If orig tarball exists, delete it. rm -f "$build_dir/export/*_*.orig.tar*" git-buildpackage \ - --git-submodules \ - --git-no-pristine-tar \ - --git-ignore-branch \ - --git-debian-branch=HEAD \ - --git-export-dir="$build_dir/export" \ - --git-tag \ - --git-upstream-branch=master \ - --git-dist=${DIST} \ - --git-pbuilder \ - --git-force-create \ - --git-ignore-new \ - --git-retag \ - -p\"gpg\\ --passphrase\\ ${GNUPG_PASSPHRASE}\" \ - -k${DEBSIGN_KEYID} || exit 1 + --git-submodules \ + --git-no-pristine-tar \ + --git-ignore-branch \ + --git-debian-branch=HEAD \ + --git-export-dir="$build_dir/export" \ + --git-tag \ + --git-upstream-branch=master \ + --git-dist=${DIST} \ + --git-pbuilder \ + --git-force-create \ + --git-ignore-new \ + --git-retag \ + -p\"gpg\\ --passphrase\\ ${GNUPG_PASSPHRASE}\" \ + -k${DEBSIGN_KEYID} || exit 1 git-buildpackage \ - --git-submodules \ - --git-no-pristine-tar \ - --git-debian-branch=HEAD \ - --git-ignore-branch \ - --git-export-dir="$build_dir/export" \ - --git-tag \ - --git-upstream-branch=master \ - --git-dist=${DIST} \ - --git-ignore-new \ - --git-retag \ - -p\"gpg --passphrase ${GNUPG_PASSPHRASE}\" \ - -k${DEBSIGN_KEYID} \ - -S -sa || exit 1 + --git-submodules \ + --git-no-pristine-tar \ + --git-debian-branch=HEAD \ + --git-ignore-branch \ + --git-export-dir="$build_dir/export" \ + --git-tag \ + --git-upstream-branch=master \ + --git-dist=${DIST} \ + --git-ignore-new \ + --git-retag \ + -p\"gpg --passphrase ${GNUPG_PASSPHRASE}\" \ + -k${DEBSIGN_KEYID} \ + -S -sa || exit 1 } +# setup_ros_build_environment +# --------------------------- +# +# Source ROS setup scripts if they exist +setup_ros_build_environment() +{ + if [ -e /opt/ros/${ROS_DISTRO}/setup.sh ]; then + . /opt/ros/${ROS_DISTRO}/setup.sh + fi + CATKIN_DEP_WORKSPACE=/tmp/_ci/catkin_dep_ws + if [ -e ${CATKIN_DEP_WORKSPACE}/devel/setup.sh ]; then + . ${CATKIN_DEP_WORKSPACE}/devel/setup.sh + fi + # Limit the number of parallel jobs when running catkin_make + PARALLEL_JOBS=${PARALLEL_JOBS:-1} + export ROS_PARALLEL_JOBS="-j ${PARALLEL_JOBS}" +} + # build_catkin_package # -------------------- # @@ -108,48 +124,41 @@ debian_build_package() # and check whether the catkin package is well written (catkin_lint) build_catkin_package() { - . /opt/ros/${ROS_DISTRO}/setup.sh + # Main package workspace CATKIN_WORKSPACE=$build_dir/.. - - # Limit the number of parallel jobs when running catkin_make - if `test x${PARALLEL_JOBS} = x`; then - export ROS_PARALLEL_JOBS='-j 1' - else - export ROS_PARALLEL_JOBS='-j ${PARALLEL_JOBS}' - fi - + ln -s $root_dir/.. $CATKIN_WORKSPACE/src + cd $CATKIN_WORKSPACE/src + catkin_init_workspace cd $CATKIN_WORKSPACE catkin_make for pack in `ls -d ./src/*/ ./src/*/*/`; do - if test -f $pack/package.xml; then - rosdoc_lite $pack - fi + if test -f $pack/package.xml; then + rosdoc_lite $pack + fi done catkin_make install # run catkin_lint on every directory. - if `test x${ALLOW_CATKINLINT_FAILURE} = x`; then - ALLOW_CATKINLINT_FAILURE=false - fi + ALLOW_CATKINLINT_FAILURE=${ALLOW_CATKINLINT_FAILURE:-false} catkin_lint `ls -d ./src/*/ ./src/*/*/` || ${ALLOW_CATKINLINT_FAILURE} } +setup_ros_build_environment # Realize a normal build in all branches except the one containing a # debian/ folder. if [ -d debian ]; then if `test x${DIST} = x`; then - echo "distribution is not set, skipping this build" - exit 0 + echo "distribution is not set, skipping this build" + exit 0 fi echo "Target distribution: ${DIST}" debian_build_package else if [ ! x${DIST} = x ]; then - echo "skipping this build" - exit 0 + echo "skipping this build" + exit 0 fi - # checking if it is a ros folder. Taking appropriate measure. #The current repository is a package if [[ -n $(find . -maxdepth 2 -name package.xml) ]]; then diff --git a/.travis/common.sh b/.travis/common.sh index 1350e85b..746f6401 100644 --- a/.travis/common.sh +++ b/.travis/common.sh @@ -2,51 +2,226 @@ # This should be sourced, not called. set -e -# Directories. -root_dir=`pwd` +######################################## +# -- VERBOSE HANDLING -- # +######################################## -build_dir="/tmp/_travis/build" -install_dir="/tmp/_travis/install" +# More verbose handling for 'set -e'. +# +# Show a traceback if we're using bash, otherwise just a message. +# Downloaded from: https://gist.github.com/kergoth/3885825 +on_exit () { + ret=$? + case $ret in + 0) + ;; + *) + echo >&2 "Exiting with $ret from a shell command" + ;; + esac +} -echo "root_dir: " $root_dir -echo "build_dir: " $build_dir -echo "install_dir: " $install_dir +on_error () { + local ret=$? + local FRAMES=${#BASH_SOURCE[@]} -# osx support is still in beta -if `test x${TRAVIS_OS_NAME} = x`; then - export TRAVIS_OS_NAME=linux -fi + echo >&2 "Traceback (most recent call last):" + for ((frame=FRAMES-2; frame >= 0; frame--)); do + local lineno=${BASH_LINENO[frame]} -# Shortcuts. -git_clone="git clone --quiet --recursive" + printf >&2 ' File "%s", line %d, in %s\n' "${BASH_SOURCE[frame+1]}" "$lineno" "${FUNCNAME[frame+1]}" + sed >&2 -n "${lineno}s/^[ ]*/ /p" "${BASH_SOURCE[frame+1]}" || true + done + printf >&2 "Exiting with %d\n" "$ret" + exit $ret +} + +case "$BASH_VERSION" in + '') + trap on_exit EXIT + ;; + *) + set -o errtrace + trap on_error ERR + ;; +esac + +######################################## +# -- GLOBAL UTILITIES -- # +######################################## + +# git_dependency_parsing +# ---------------------- +# +# From an entry in GIT_DEPENDENCIES variable set git_dep, git_dep_uri and +# git_dep_branch in the environment +# For example given the input "jrl-umi3218/jrl-travis" the following variables +# are defined in the environment: +# - git_dep jrl-umi3218/jrl-travis +# - git_dep_uri git://github.com/jrl-umi3218/jrl-traviss +# - git_dep_branch master +# Or, given the input git@github.com:jrl-umi3218/jrl-travis#thebranch +# - git_dep jrl-umi3218/jrl-travis +# - git_dep_uri git@github.com:jrl-umi3218/jrl-travis +# - git_dep_branch thebranch +# The second (optional) argument allows to defined the default branch (defaults +# to master) +git_dependency_parsing() +{ + _input=$1 + export git_dep=${_input%%#*} + export git_dep_branch=${_input##*#} + if [ "$git_dep_branch" == "$git_dep" ]; then + if [ -e "$2" ]; then + export git_dep_branch=$2 + else + export git_dep_branch="master" + fi + fi + git_dep_uri_base=${git_dep%%:*} + if [ "$git_dep_uri_base" == "$git_dep" ]; then + export git_dep_uri="git://github.com/$git_dep" + else + export git_dep_uri=$git_dep + export git_dep=${git_dep##*:} + fi +} + + +######################################## +# -- ENVIRONMENT MANIPULATION -- # +######################################## + +_gitlab_setup_ci_vars() +{ + export CI_REQUIRE_SUDO=false + export CI_PULL_REQUEST=false #FIXME Can it be provided by gitlab? + export CI_REPO_SLUG=`echo ${CI_PROJECT_DIR}|sed -e's@/builds/@@'` + export CI_BRANCH=${CI_BUILD_REF_NAME} + export CI_OS_NAME=${CI_OS_NAME:-linux} +} + +_travis_setup_ci_vars() +{ + export CI_REQUIRE_SUDO=${CI_REQUIRE_SUDO:-true} + export CI_PULL_REQUEST=${TRAVIS_PULL_REQUEST} + export CI_REPO_SLUG=${TRAVIS_REPO_SLUG} + export CI_BRANCH=${TRAVIS_BRANCH} + export CI_OS_NAME=${TRAVIS_OS_NAME:-linux} +} + +# _setup_ci_vars +# -------------- +# +# Setup CI_* variables based on the CI type +_setup_ci_vars() +{ + # Check which CI tool we are using, default to travis + export CI_TOOL=${CI_TOOL:-travis} -# Setup environment variables. -if [ -d /opt/ros ]; then - . /opt/ros/${ROS_DISTRO}/setup.sh -fi + if [ $CI_TOOL = travis ]; then + _travis_setup_ci_vars + else + _gitlab_setup_ci_vars + fi +} -export LD_LIBRARY_PATH="$install_dir/lib:$LD_LIBRARY_PATH" -export LTDL_LIBRARY_PATH="$install_dir/lib:$LTDL_LIBRARY_PATH" -export PKG_CONFIG_PATH="$install_dir/lib/pkgconfig:$PKG_CONFIG_PATH" +# _setup_sudo_cmd +# --------------- +# +# Setup SUDO_CMD based on CI configuration +_setup_sudo_cmd() +{ + if [ ${CI_REQUIRE_SUDO} = false ]; then + export SUDO_CMD='' + else + export SUDO_CMD='sudo' + fi +} -if [[ ${TRAVIS_OS_NAME} = linux ]]; then - export LD_LIBRARY_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`:$LD_LIBRARY_PATH" - export LTDL_LIBRARY_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`:$LTDL_LIBRARY_PATH" - export PKG_CONFIG_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`/pkgconfig:$PKG_CONFIG_PATH" -fi +# _setup_ros +# ---------- +# +# Setup ROS environment if present on the system +_setup_ros() +{ + if [ -f /opt/ros/${ROS_DISTRO}/setup.sh ]; then + . /opt/ros/${ROS_DISTRO}/setup.sh + fi +} -if type "python" > /dev/null; then +# _setup_env_vars +# --------------- +# +# Setup environment variables +_setup_env_vars() +{ + export LD_LIBRARY_PATH="$install_dir/lib:$LD_LIBRARY_PATH" + export LTDL_LIBRARY_PATH="$install_dir/lib:$LTDL_LIBRARY_PATH" + export PKG_CONFIG_PATH="$install_dir/lib/pkgconfig:$install_dir/share/pkgconfig:$PKG_CONFIG_PATH" + if type "python" > /dev/null; then pythonsite_dir=`python -c "import sys, os; print(os.sep.join(['lib', 'python' + sys.version[:3], 'site-packages']))"` export PYTHONPATH="$install_dir/$pythonsite_dir:$PYTHONPATH" -fi + fi -if [[ ${TRAVIS_OS_NAME} = osx ]]; then - # Since default gcc on osx is just a front-end for LLVM... - if [[ ${CC} = gcc ]]; then - export CXX=g++-4.8 - export CC=gcc-4.8 - fi -fi +} + +# _setup_linux_env +# ---------------- +# +# Environment setup specific to linux +_setup_linux_env() +{ + export LD_LIBRARY_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`:$LD_LIBRARY_PATH" + export LTDL_LIBRARY_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`:$LTDL_LIBRARY_PATH" + export PKG_CONFIG_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARCH`/pkgconfig:$PKG_CONFIG_PATH" +} + +# _setup_osx_env +# ---------------- +# +# Environment setup specific to OSX +_setup_osx_env() +{ + # Since default gcc on osx is just a front-end for LLVM... + if [[ ${CC} = gcc ]]; then + export CXX=g++-4.8 + export CC=gcc-4.8 + fi +} + +# setup_ci_env +# ------------ +# +# Setup the CI and environment variables +setup_ci_env() +{ + _setup_ci_vars + _setup_sudo_cmd + _setup_ros + _setup_env_vars + if [[ ${CI_OS_NAME} = linux ]]; then + _setup_linux_env + fi + if [[ ${CI_OS_NAME} = osx ]]; then + _setup_osx_env + fi +} + +# Directories. +root_dir=`pwd` +build_dir="/tmp/_ci/build" +install_dir="/tmp/_ci/install" + +echo "root_dir: " $root_dir +echo "build_dir: " $build_dir +echo "install_dir: " $install_dir + +# Shortcuts. +git_clone="git clone --quiet --recursive" + +# Setup all variables needed by the CI scripts +setup_ci_env # Make cmake verbose. export CMAKE_VERBOSE_MAKEFILE=1 @@ -55,6 +230,3 @@ export CTEST_OUTPUT_ON_FAILURE=1 # Create layout. mkdir -p "$build_dir" mkdir -p "$install_dir" - -# Add verbose handling -. .travis/verbose_errors.sh diff --git a/.travis/dependencies/catkin b/.travis/dependencies/catkin index 60c5d547..2d39a9ad 100755 --- a/.travis/dependencies/catkin +++ b/.travis/dependencies/catkin @@ -1,28 +1,30 @@ #!/bin/bash -. .travis/common.sh +. `dirname $0`/../common.sh # If the ros version is not defined, quit. if `test x${ROS_DISTRO} = x`; then exit 0 fi -sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu precise main" > /etc/apt/sources.list.d/ros-latest.list' -wget http://packages.ros.org/ros.key -O - | sudo apt-key add - -sudo apt-get update +${SUDO_CMD} sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -c -s` main" > /etc/apt/sources.list.d/ros-latest.list' +wget http://packages.ros.org/ros.key -O - | ${SUDO_CMD} apt-key add - +${SUDO_CMD} apt-get update -if `test x${ROS_DISTRO} = xhydro`; then - sudo apt-get install ros-hydro-ros-base ros-hydro-rosdoc-lite python-catkin-lint +if `test x${ROS_DISTRO} = xjade`; then + ${SUDO_CMD} apt-get install -qq ros-jade-ros-base ros-jade-rosdoc-lite python-catkin-lint +elif `test x${ROS_DISTRO} = xindigo`; then + ${SUDO_CMD} apt-get install -qq ros-indigo-ros-base ros-indigo-rosdoc-lite python-catkin-lint +elif `test x${ROS_DISTRO} = xhydro`; then + ${SUDO_CMD} apt-get install -qq ros-hydro-ros-base ros-hydro-rosdoc-lite python-catkin-lint elif `test x${ROS_DISTRO} = xgroovy`; then - sudo apt-get install ros-groovy-ros-base ros-groovy-rosdoc-lite python-catkin-lint + ${SUDO_CMD} apt-get install -qq ros-groovy-ros-base ros-groovy-rosdoc-lite python-catkin-lint else echo "ROS distribution unkown, exiting" + ${ROS_DISTRO} - exit 1 + exit 1 fi . /opt/ros/${ROS_DISTRO}/setup.sh -# workspace -CATKIN_WORKSPACE=$build_dir/.. -ln -s $root_dir/.. $CATKIN_WORKSPACE/src -cd $CATKIN_WORKSPACE/src -catkin_init_workspace - +# Dependencies workspace +CATKIN_DEP_WORKSPACE=/tmp/_ci/catkin_dep_ws +mkdir -p $CATKIN_DEP_WORKSPACE/src +cd $CATKIN_DEP_WORKSPACE/src diff --git a/.travis/dependencies/eigen-3.2 b/.travis/dependencies/eigen-3.2 index d652c4dc..46d48380 100755 --- a/.travis/dependencies/eigen-3.2 +++ b/.travis/dependencies/eigen-3.2 @@ -2,10 +2,10 @@ # # Setup Eigen 3.2 # -. .travis/common.sh +. `dirname $0`/../common.sh -EIGEN_VERSION=3.2.5 -EIGEN_HASH=bdd17ee3b1b3 +EIGEN_VERSION=3.2.8 +EIGEN_HASH=07105f7124f9 # Checkout Eigen cd "$build_dir" @@ -16,8 +16,7 @@ mkdir -p "$build_dir/eigen-eigen-${EIGEN_HASH}/_build" cd "$build_dir/eigen-eigen-${EIGEN_HASH}/_build" # Build, make and install Eigen -cmake .. -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" \ - -Dpkg_config_libdir:STRING="$install_dir/lib" +cmake .. -DCMAKE_INSTALL_PREFIX:STRING="$install_dir" make make install diff --git a/.travis/dependencies/eigen-3.2.ps1 b/.travis/dependencies/eigen-3.2.ps1 new file mode 100644 index 00000000..1db43158 --- /dev/null +++ b/.travis/dependencies/eigen-3.2.ps1 @@ -0,0 +1,26 @@ +$EIGEN_VERSION="3.2.8" +$EIGEN_HASH="07105f7124f9" + +cd $Env:SOURCE_FOLDER +appveyor DownloadFile "http://bitbucket.org/eigen/eigen/get/$EIGEN_VERSION.zip" +7z x "${EIGEN_VERSION}.zip" -o"${Env:SOURCE_FOLDER}\eigen" -r +cd "${Env:SOURCE_FOLDER}\eigen\eigen-eigen-$EIGEN_HASH" +md build +cd build + +# Build, make and install Eigen +cmake -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="${Env:CMAKE_INSTALL_PREFIX}" ../ +msbuild INSTALL.vcxproj + +# Generate eigen3.pc +$EIGEN3_PC_FILE="${Env:PKG_CONFIG_PATH}/eigen3.pc" +echo "Name: Eigen3" | Out-File -Encoding ascii -FilePath $EIGEN3_PC_FILE +echo "Description: A C++ template library for linear algebra: vectors, matrices, and related algorithms" | Out-File -Append -Encoding ascii -FilePath $EIGEN3_PC_FILE +echo "Requires:" | Out-File -Append -Encoding ascii -FilePath $EIGEN3_PC_FILE +echo "Version: $EIGEN_VERSION" | Out-File -Append -Encoding ascii -FilePath $EIGEN3_PC_FILE +echo "Libs:" | Out-File -Append -Encoding ascii -FilePath $EIGEN3_PC_FILE +echo "Cflags: -I${Env:CMAKE_INSTALL_PREFIX}/include/eigen3" | Out-File -Append -Encoding ascii -FilePath $EIGEN3_PC_FILE + +# Check install +pkg-config --modversion "eigen3 >= ${EIGEN_VERSION}" +pkg-config --cflags "eigen3 >= ${EIGEN_VERSION}" diff --git a/.travis/dependencies/nag b/.travis/dependencies/nag index bb2c7f5e..88adc789 100755 --- a/.travis/dependencies/nag +++ b/.travis/dependencies/nag @@ -2,7 +2,7 @@ # # Setup NAG # -. .travis/common.sh +. `dirname $0`/../common.sh build_dir=`mktemp -d` trap "rm -rf -- '$build_dir'" EXIT @@ -15,6 +15,6 @@ export PKG_CONFIG_PATH="$install_dir/lib/`dpkg-architecture -qDEB_BUILD_MULTIARC # Checkout NAG. cd "$build_dir" -wget "http://www.nag.co.uk/downloads/impl/cll6a23dhl.tgz" -tar xzvf cll6a23dhl.tgz +wget "http://www.nag.co.uk/downloads/impl/cll6i25dcl.tgz" +tar xzvf cll6i25dcl.tgz ./install.sh -accept -installdir="$install_dir/NAG" diff --git a/.travis/dependencies/nlopt b/.travis/dependencies/nlopt index e0058037..311cc29c 100755 --- a/.travis/dependencies/nlopt +++ b/.travis/dependencies/nlopt @@ -2,7 +2,7 @@ # # Setup NLopt # -. .travis/common.sh +. `dirname $0`/../common.sh build_dir=`mktemp -d` trap "rm -rf -- '$build_dir'" EXIT diff --git a/.travis/dependencies/pagmo b/.travis/dependencies/pagmo index 4866626b..50c87935 100755 --- a/.travis/dependencies/pagmo +++ b/.travis/dependencies/pagmo @@ -2,8 +2,8 @@ # # Setup PaGMO # -. .travis/common.sh -pagmo_pc_file="`pwd`/.travis/dependencies/pagmo.pc" +. `dirname $0`/common.sh +pagmo_pc_file="`dirname $0`/dependencies/pagmo.pc" build_dir=`mktemp -d` trap "rm -rf -- '$build_dir'" EXIT diff --git a/.travis/dependencies/pybindgen-0.16 b/.travis/dependencies/pybindgen-0.16 new file mode 100755 index 00000000..ac557741 --- /dev/null +++ b/.travis/dependencies/pybindgen-0.16 @@ -0,0 +1,19 @@ +#!/bin/bash + +# Install pybindgen v 0.16.0 + +. `dirname $0`/../common.sh + +# Install dependencies +${SUDO_CMD} apt-get install -qq gccxml python-pygccxml + +# Get pybindgen +cd "$build_dir" +wget --quiet https://pybindgen.googlecode.com/files/pybindgen-0.16.0.tar.bz2 +tar xjf pybindgen-0.16.0.tar.bz2 +cd "$build_dir/pybindgen-0.16.0/" + +# Configure build and install +./waf configure +./waf +${SUDO_CMD} ./waf install diff --git a/.travis/functions.ps1 b/.travis/functions.ps1 new file mode 100644 index 00000000..46bfcb76 --- /dev/null +++ b/.travis/functions.ps1 @@ -0,0 +1,99 @@ +function git_dependency_parsing +{ + $_input = $args[0].split('#'); + if($args.length -gt 1) + { + $default_branch = $args[1]; + } + else + { + $default_branch = "master"; + } + Set-Variable -Name git_dep -Value $_input[0] -Scope Global; + Set-Variable -Name git_dep_branch -Value $default_branch -Scope Global; + if($_input.length -eq 2) + { + $git_dep_branch = $_input[1]; + Set-Variable -Name git_dep_branch -Value $git_dep_branch -Scope Global; + } + $git_dep_uri_base = $git_dep.split(':')[0]; + if($git_dep_uri_base -eq $git_dep) + { + $git_dep_uri = "git://github.com/" + $git_dep + Set-Variable -Name git_dep_uri -Value $git_dep_uri -Scope Global; + } + else + { + Set-Variable -Name git_dep_uri -Value $git_dep -Scope Global; + Set-Variable -Name git_dep -Value $git_dep.split(':')[1] -Scope Global; + } +} + +function setup_directories +{ + md $env:CMAKE_INSTALL_PREFIX + if( -Not (Test-Path $Env:SOURCE_FOLDER) ) + { + md $Env:SOURCE_FOLDER + } + if( -Not (Test-Path $Env:PKG_CONFIG_PATH) ) + { + md $Env:PKG_CONFIG_PATH + } +} + +function setup_pkg_config +{ + appveyor DownloadFile http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip + appveyor DownloadFile http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip + appveyor DownloadFile http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip + 7z x glib_2.28.8-1_win32.zip -o"${env:CMAKE_INSTALL_PREFIX}" -r + 7z x pkg-config_0.26-1_win32.zip -o"${env:CMAKE_INSTALL_PREFIX}" -r + 7z x gettext-runtime_0.18.1.1-2_win32.zip -o"${env:CMAKE_INSTALL_PREFIX}" -r +} + +function setup_build +{ + setup_directories + setup_pkg_config +} + +function install_choco_dependencies +{ + ForEach($choco_dep in $Env:CHOCO_DEPENDENCIES.split(';')) + { + choco install $choco_dep + } +} + +function install_git_dependencies +{ + ForEach($g_dep in $Env:GIT_DEPENDENCIES.split(';')) + { + cd $Env:SOURCE_FOLDER + git_dependency_parsing $g_dep + git clone -b "$git_dep_branch" "$git_dep_uri" "$git_dep" + cd $git_dep + git submodule update --init + md build + cd build + cmake ../ -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="${Env:CMAKE_INSTALL_PREFIX}" -DPYTHON_BINDING=OFF + msbuild INSTALL.vcxproj + } +} + +function install_dependencies +{ + install_choco_dependencies + install_git_dependencies +} + +function build_project +{ + cd $Env:PROJECT_SOURCE_DIR + git submodule update --init + md build + cd build + cmake ../ -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="${Env:CMAKE_INSTALL_PREFIX}" -DPYTHON_BINDING=OFF + msbuild INSTALL.vcxproj +} diff --git a/.travis/gitlab-ci.yml.in b/.travis/gitlab-ci.yml.in new file mode 100644 index 00000000..7c1a8cfd --- /dev/null +++ b/.travis/gitlab-ci.yml.in @@ -0,0 +1,39 @@ +variables: + CI_OS_NAME: @CI_OS_NAME@ + CI_TOOL: gitlab-ci + APT_DEPENDENCIES: @APT_DEPENDENCIES@ + GIT_DEPENDENCIES: @GIT_DEPENDENCIES@ + ROS_GIT_DEPENDENCIES: @ROS_GIT_DEPENDENCIES@ + ROS_DISTRO: @ROS_DISTRO@ + PARALLEL_JOBS: @PARALLEL_JOBS@ + +# Secured variable are stored in the project +# See: http://doc.gitlab.com/ci/variables/README.html + +# Notifications (email/chatroom) are also handled by gitlab directly + +before_script: + - ./.jrl-ci/run before_install + +# The following is just an example possibility to run gcc/clang builds +# One could set environment variable and apt dependencies to do the job + +build_gcc: + stage: build + script: + - ./.jrl-ci/run build + - ./.jrl-ci/run after_success + tags: + - GCC + +build_clang: + stage: build + script: + - ./.jrl-ci/run build + - ./.jrl-ci/run after_success + tags: + - clang + allow_failure: true + +stages: + - build diff --git a/.travis/run b/.travis/run index a50f2395..3d8655f1 100755 --- a/.travis/run +++ b/.travis/run @@ -12,7 +12,7 @@ GH_PUSH_URI=${GH_PUSH_URI:-"\#EDITED\#"} # Anonymize the output. -./.travis/$1 2>&1 | sed \ +`dirname $0`/$1 2>&1 | sed \ -e "s|${COVERITY_TOKEN}|\#EDITED\#|g" \ -e "s|${GNUPG_PASSPHRASE}|\#EDITED\#|g" \ -e "s|${GH_USERNAME}|\#EDITED\#|g" \