Skip to content

Commit

Permalink
Added new tests in Travis exploiting build stages
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Apr 12, 2018
1 parent cdaed3d commit 01ca540
Showing 1 changed file with 146 additions and 35 deletions.
181 changes: 146 additions & 35 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,156 @@ language: cpp
os:
- linux

matrix:
include:
# Enable a job for building the documentation
- os: linux
env:
TRAVIS_BUILD_DOCS=true
GIT_COMMITTER_USERNAME=LOC2Bot
GIT_COMMITTER_NAME=LOC2Bot
[email protected]
DOXYGEN_INPUT_FOLDER=$TRAVIS_BUILD_DIR/doc/doxygen
MKDOCS_INPUT_FOLDER=$TRAVIS_BUILD_DIR/doc/mkdocs
addons:
apt:
packages:
- doxygen
- doxygen-doc
- doxygen-gui
- graphviz
- python3-pip

before_install:
# Install documentation dependencies
cache:
directories:
- $HOME/cache
- $HOME/.ccache

stages:
- prepare
- test
#- deploy
#if: (branch IS master) AND (type IS NOT pull_request)
#templates:
#- &template_test
#env:

compiler:
- gcc
- clang

env:
global:
- DEPENDENCY_BRANCH="master"
matrix:
- TRAVIS_CMAKE_GENERATOR="Unix Makefiles", TRAVIS_BUILD_TYPE="Release"
- TRAVIS_CMAKE_GENERATOR="Unix Makefiles", TRAVIS_BUILD_TYPE="Debug"

addons:
apt:
packages:
# YARP
- libace-dev
- libeigen3-dev
- libgsl0-dev
- libedit-dev
# iDynTree
- coinor-libipopt-dev

#jobs:
#include:
#- stage: test
#os: osx
#env: TRAVIS_CMAKE_GENERATOR="Xcode", TRAVIS_BUILD_TYPE="Release"
#- stage: test
#os: osx
#env: TRAVIS_CMAKE_GENERATOR="Xcode", TRAVIS_BUILD_TYPE="Debug"

# ==============
# STAGE: prepare
# ==============

before_install_prepare: &before_install_prepare
- if [ "$TRAVIS_OS_NAME" == "osx" ] ; brew install ccache ; fi

install_prepare: &install_prepare
# Prepare ccache
- mkdir -p $HOME/.local/bin
- ln -s $(which ccache) $HOME/.local/bin/$CC
- ln -s $(which ccache) $HOME/.local/bin/$CXX
- export PATH=/$HOME/.local/bin:$PATH
# Remove cache from previous builds (ccache is instead kept)
- rm -rf $HOME/cache
# Create the cache directory for dependencies
- export DEPS_CACHE=$HOME/cache/$TRAVIS_OS_NAME/$TRAVIS_BUILD_TYPE
- mkdir -p $DEPS_CACHE
# Setup ccache
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then export PATH=/usr/lib/ccache:$PATH ; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then ; fi


# Install dependencies
# --------------------

- mkdir $HOME/git && cd $HOME/git

# Install yarp
- git clone https://github.com/robotology/yarp
- cd yarp
- mkdir build && cd build
- >-
if [[ "$TRAVIS_BRANCH" = "master" && -n "$TRAVIS_BUILD_DOCS" && "$TRAVIS_PULL_REQUEST" = "false" ]] ; then
pip3 install --user Pygments mkdocs mkdocs-material || travis_terminate 1
export PATH=$HOME/.local/bin:$PATH
fi
cmake .. \
-G"${TRAVIS_CMAKE_GENERATOR}" \
-DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=$DEPS_CACHE \
-DCREATE_LIB_MATH=ON
- cmake --build . --config ${TRAVIS_BUILD_TYPE} --target install

# Install icub-main
- git clone https://github.com/robotology/icub-main
- cd icub-main
- mkdir build && cd build
- >-
cmake .. \
-G"${TRAVIS_CMAKE_GENERATOR}" \
-DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX=$DEPS_CACHE
- cmake --build . --config ${TRAVIS_BUILD_TYPE} --target install

jobs:
include:
- stage: prepare
before_install: &before_install_prepare
install: &install_prepare
script: skip

# ===========
# STAGE: test
# ===========

# before_script:
script:
# Right now Travis only builds the documentation
- true
# Setup the dependencies cache
- export DEPS_CACHE=$HOME/cache/$TRAVIS_OS_NAME/$TRAVIS_BUILD_TYPE
- export PATH=$PATH:$DEPS_CACHE/bin
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DEPS_CACHE/lib
# Build the project
- cd $TRAVIS_BUILD_DIR
- mkdir build && cd build
- cmake -G"${TRAVIS_CMAKE_GENERATOR}" -DCMAKE_BUILD_TYPE=${TRAVIS_BUILD_TYPE} ..
- cmake --build . --config ${TRAVIS_BUILD_TYPE}

after_success:
# Generate the docs only if master, the TRAVIS_BUILD_DOCS is true and we can use secure variables
- >-
if [[ "$TRAVIS_BRANCH" = "master" && -n "$TRAVIS_BUILD_DOCS" && "$TRAVIS_PULL_REQUEST" = "false" ]] ; then
./$PROJECT_DIR_ABS/.ci/generateDocumentation.sh || travis_terminate 1
fi
# =============
# STAGE: deploy
# =============

#stage_deploy:
#before_install: &before_install_deploy
#- pip3 install --user Pygments mkdocs mkdocs-material
#- export PATH=$HOME/.local/bin:$PATH
#after_success: &after_success_deploy
#- ./$PROJECT_DIR_ABS/.ci/generateDocumentation.sh || travis_terminate 1

#jobs:
#include:
#- stage: deploy
#before_install: &before_install_deploy
#script: skip
#after_success: &after_success_deploy
#env:
#TRAVIS_BUILD_DOCS=true
#GIT_COMMITTER_USERNAME=LOC2Bot
#GIT_COMMITTER_NAME=LOC2Bot
#[email protected]
#DOXYGEN_INPUT_FOLDER=$TRAVIS_BUILD_DIR/doc/doxygen
#MKDOCS_INPUT_FOLDER=$TRAVIS_BUILD_DIR/doc/mkdocs
#addons:
#apt:
#packages:
#- doxygen
#- doxygen-doc
#- doxygen-gui
#- graphviz
#- python3-pip

# notifications:
# email:
Expand Down

0 comments on commit 01ca540

Please sign in to comment.