Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Consider env variables in Travis CI settings #735

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 36 additions & 43 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,70 +3,63 @@ sudo: required

language: cpp

compiler:
- g++
- clang

git:
depth: 10

os:
- linux
- osx

env:
global:
# versions of VTK for each OS
# - On Ubuntu, use default version installed by apt-get
# - On macOS, build recent VTK version from sources and cache installation
- LINUX_VTK_VERSION=6.0.0
- MACOS_VTK_VERSION=9.0 # Homebrew versions: 8.2, 9.0; otherwise build from sources
- WITH_CCACHE=ON # speed up MIRTK build itself using ccache
- WITH_ARPACK=OFF # requires time consuming build of gcc on macOS
- WITH_UMFPACK=OFF # ARPACK & UMFPACK dependencies come in pairs
- WITH_TBB=ON # build with TBB is always recommended
- WITH_FLANN=ON # build with FLANN is optional, but requires only little extra build time
- WITH_FLTK=ON # build with FLTK-based Viewer when WITH_VTK is turned ON
- WITH_ITK=OFF # required by ANTs N4 which is included in DrawEM package
# exclude DrawEM from Travis CI build for now, see https://github.com/MIRTK/DrawEM/pull/27
- VTK_VERSION_LINUX=${VTK_VERSION_LINUX:-6.0.0} # trusty: 6.0.0, xenial: 6.2.0, bionic: 6.3.0, 7.1.1
- VTK_VERSION_MACOS=${VTK_VERSION_MACOS:-9.0} # Homebrew versions: 8.2, 9.0; otherwise build from sources
- WITH_CCACHE=${WITH_CCACHE:-ON} # speed up MIRTK build itself using ccache
- WITH_ARPACK=${WITH_ARPACK:-OFF} # requires time consuming build of gcc on macOS
- WITH_UMFPACK=${WITH_UMFPACK:-OFF} # ARPACK & UMFPACK dependencies come in pairs
- WITH_TBB=${WITH_TBB:-ON} # build with TBB is always recommended
- WITH_FLANN=${WITH_FLANN:-ON} # build with FLANN is optional, but requires only little extra build time
- WITH_FLTK=${WITH_FLTK:-ON} # build with FLTK-based Viewer when WITH_VTK is turned ON
- WITH_VTK=${WITH_VTK:-ON} # by default, build with VTK
- WITH_ITK=${WITH_ITK:-OFF} # required by ANTs N4 which is included in DrawEM package
# exclude DrawEM from Travis CI build for now, see https://github.com/MIRTK/DrawEM/pull/27
- BUILD_TYPE=Release # default build configuration
# build and deployment of AppImage for Linux
- AppImage_BUILD=${AppImage_BUILD:-ON}
- AppImage_BRANCH=${AppImage_BRANCH:-master}
- AppImage_DEVEL=${AppImage_DEVEL:-ON}
- AppImage_LATEST=${AppImage_LATEST:-ON}
- AppImage_RELEASE=${AppImage_RELEASE}
matrix:
- WITH_VTK=OFF # make sure that MIRTK can be build fine without VTK
- WITH_VTK=ON # test build with all moduldes, including those using VTK

matrix:
jobs:
include:
# build optimized code with all modules for AppImage generation
- os: linux
compiler: g++
env: BUILD_TYPE=Release WITH_VTK=ON
# ensure assertions and debug code compiles
- os: linux
compiler: g++
env: BUILD_TYPE=Debug WITH_VTK=ON
# make sure that MIRTK can be build fine without VTK
- os: linux
compiler: g++
env: BUILD_TYPE=Release WITH_VTK=OFF
# build on macOS using clang and recent VTK version
- os: osx
compiler: clang
env: BUILD_TYPE=Release WITH_VTK=ON
# the osx build often breaks with homebrew changes, so we allow it to fail on master
allow_failures:
# the osx build often breaks with homebrew changes, so we allow it to fail
- os: osx
exclude:
# in order to reduce number of jobs to wait for, test only main compilers
# used on each OS
- os: linux
compiler: clang
- os: osx
compiler: g++
# travis-ci.org has low capacity for macOS jobs, thus reduce number of
# macOS jobs to only the essential ones. With the following, we only need
# to wait for one macOS job.
# Because on macOS usually a very recent VTK version is installed with
# Homebrew, it is more interesting to build with VTK on macOS than on
# Ubuntu. When the GCC build without VTK on Ubuntu succeeds, chances
# are very high it also builts fine on macOS.
- os: osx
compiler: clang
env: WITH_VTK=OFF
if: branch = master
fast_finish: true

cache:
ccache: true
timeout: 1000
directories:
- "$HOME/VTK-$LINUX_VTK_VERSION"
- "$HOME/VTK-$MACOS_VTK_VERSION"
- "$HOME/VTK-$VTK_VERSION_LINUX"
- "$HOME/VTK-$VTK_VERSION_MACOS"

before_install:
- . Scripts/install_depends.sh # sourcing will enable export of env variables
Expand All @@ -78,7 +71,7 @@ script:
- Scripts/travis.sh

after_success:
- if [ "$AppImage_BUILD" = ON ] && [ "$TRAVIS_REPO_SLUG" = "BioMedIA/MIRTK" ] && [ "$TRAVIS_BRANCH" = "$AppImage_BRANCH" ] && [ "$TRAVIS_PULL_REQUEST" = false ] && [ "$TRAVIS_OS_NAME" = linux ] && [ "$WITH_VTK" = ON ]; then
- if [ "$AppImage_BUILD" = ON ] && [ "$TRAVIS_REPO_SLUG" = "BioMedIA/MIRTK" ] && [ "$TRAVIS_BRANCH" = "$AppImage_BRANCH" ] && [ "$TRAVIS_PULL_REQUEST" = false ] && [ "$TRAVIS_OS_NAME" = linux ] && [ "$WITH_VTK" = ON ] && [ "$BUILD_TYPE" = Release ]; then
export AppImage_BINTRAY=ON;
else
export AppImage_BINTRAY=OFF;
Expand Down
8 changes: 4 additions & 4 deletions Scripts/install_depends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ if [ $os = linux ] || [ $os = Linux ]; then
fi

if [ $WITH_VTK = ON ]; then
if [ -n "$LINUX_VTK_VERSION" ]; then
VTK_VERSION="$LINUX_VTK_VERSION"
if [ -n "$VTK_VERSION_LINUX" ]; then
VTK_VERSION="$VTK_VERSION_LINUX"
fi
if [ "$DISTRIB_CODENAME" = "trusty" ]; then
if [ -z "$VTK_VERSION" ] || [ $VTK_VERSION = '6.0.0' ]; then
Expand Down Expand Up @@ -182,7 +182,7 @@ if [ $os = osx ] || [ $os = Darwin ]; then
brew_install suite-sparse
fi
if [ $WITH_VTK = ON ]; then
VTK_VERSION="$MACOS_VTK_VERSION"
VTK_VERSION="$VTK_VERSION_MACOS"
if [ -z "$VTK_VERSION" ]; then
echo "Installing VTK using Homebrew"
brew_install vtk
Expand Down Expand Up @@ -220,7 +220,7 @@ if [ $WITH_VTK = ON ] && [ -n "$VTK_VERSION" ]; then
# build configuration
cmake_args=(
-DCMAKE_INSTALL_PREFIX="$vtk_prefix"
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_BUILD_TYPE=${BUILD_TYPE:-Release}
)
# pre-requisites to use system installations
if [ $os = osx ] || [ $os = Darwin ]; then
Expand Down
6 changes: 3 additions & 3 deletions Scripts/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ if [ $WITH_VTK = ON ]; then
modules=(${modules[@]} Viewer)
fi
if [ $os = osx ] || [ $os = Darwin ]; then
if [ -d "/usr/local/opt/vtk@$MACOS_VTK_VERSION" ]; then
cmake_args+=(-D DEPENDS_VTK_DIR="/usr/local/opt/vtk@$MACOS_VTK_VERSION")
if [ -d "/usr/local/opt/vtk@$VTK_VERSION_MACOS" ]; then
cmake_args+=(-D DEPENDS_VTK_DIR="/usr/local/opt/vtk@$VTK_VERSION_MACOS")
fi
fi
fi
Expand All @@ -82,7 +82,7 @@ fi
mkdir Build && cd Build
run "$cmake_cmd" \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_BUILD_TYPE=${BUILD_TYPE:-Release} \
-D BUILD_SHARED_LIBS=ON \
-D BUILD_APPLICATIONS=ON \
-D BUILD_TESTING=$TESTING \
Expand Down