forked from UCL/STIR
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
138 lines (124 loc) · 4.5 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Language selection
language: cpp
cache: ccache
# Environment variables:
# To avoid too many builds, we mix some options (although independent tests would have been better)
matrix:
include:
#### linux
- os: linux
python: 3
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=0 -DSTIR_OPENMP:BOOL=OFF" CC=gcc-5 CXX=g++-5
- os: linux
python: 3
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=OFF" CC=gcc-5 CXX=g++-5
- os: linux
python: 3
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=0 -DSTIR_OPENMP:BOOL=ON" CC=gcc-5 CXX=g++-5
- os: linux
python: 3
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=OFF" CC=clang-5.0 CXX=clang++-5.0
# note: cannot use OpenMP yet with Clang on Travis apparently. See https://github.com/travis-ci/travis-ci/issues/8613
#### osx
# note: cannot use OpenMP on OSX yet, see https://github.com/UCL/STIR/issues/117
- os: osx
python: 3
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=OFF" CC=gcc CXX=g++
- os: osx
osx_image: xcode9 # need that for ROOT
python: 3
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=0 -DSTIR_OPENMP:BOOL=OFF" CC=gcc CXX=g++
- os: osx
osx_image: xcode9 # need that for ROOT
python: 3
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=0 -DSTIR_OPENMP:BOOL=OFF -DSTIR_ENABLE_EXPERIMENTAL:BOOL=ON" CC=clang CXX=clang++
env:
global:
- BUILD_FLAGS="-DBUILD_SWIG_PYTHON:BOOL=On -DSTIR_MPI:BOOL=Off -DCMAKE_BUILD_TYPE=Release"
# Ubuntu 14.04 LTS (trusty)
dist: trusty
# No need for sudo
sudo: false
# Compilation dependencies
addons:
apt:
sources:
- llvm-toolchain-trusty-5.0
packages:
- libboost-dev
- swig3.0
- python3-dev
- python3-numpy
- python3-pytest
- libgomp1
- clang-5.0
- root-system-bin
- libroot-tree-dev
- libroot-tree-treeplayer-dev
- libroot-io-dev
# Actual compilation script
before_install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
# seems to be needed on Travis due to conflicts with gcc otherwise
# see https://github.com/travis-ci/travis-ci/issues/8826
brew cask uninstall oclint
brew install ccache
export PATH="/usr/local/opt/ccache/libexec:$PATH"
# Install ROOT, unless disabled
case "$EXTRA_BUILD_FLAGS" in
*DISABLE_CERN_ROOT=1*)
echo "Not installing ROOT to save some time (and potential time-outs)";;
*)
brew install root;;
esac
brew install swig
# use Python3 on Mac
brew upgrade python || true # don't fail if upgrading doesn't do anything
# find exact location of Python executable to pass to CMake
# we attempt to find the last one if there are multiple Python 3 versions installed
PYMVER=3
PY_INST=$(ls -d1 /usr/local/Cellar/python/$PYMVER.*/Frameworks/Python.framework/Versions/$PYMVER.*|tail -n 1)
PYMVER=$(basename ${PY_INST})
PY_EXE=$PY_INST/bin/python$PYMVER
if [ ! -x "$PY_EXE" ]; then
echo "Something wrong with finding Python executable for OSX"
echo "PY_EXE = $PY_EXE"
travis_terminate 1
fi
# Next lines are not necessary if we give the actual path for the executable to cmake
#PY_LIB=$PY_INST/Python
#PY_INC=$PY_INST/Headers
# BUILD_FLAGS="$BUILD_FLAGS -DPYTHON_LIBRARY=$PY_LIB -DPYTHON_INCLUDE_DIR=$PY_INC"
${PY_EXE} -m pip install -U pip
${PY_EXE} -m pip install pytest numpy
else
PY_EXE=`which python3`
fi
${PY_EXE} --version
BUILD_FLAGS="$BUILD_FLAGS -DPYTHON_EXECUTABLE=${PY_EXE}"
install:
- mkdir build install
- cd build
- cmake $BUILD_FLAGS $EXTRA_BUILD_FLAGS -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/install ..
- make -j 2 all
- make install
script:
- make test
- export PATH=$PATH:$TRAVIS_BUILD_DIR/install/bin
- cd $TRAVIS_BUILD_DIR/recon_test_pack
- ./run_test_simulate_and_recon.sh
- ./run_test_listmode_recon.sh
- ./run_test_simulate_and_recon_with_motion.sh
- ./run_scatter_tests.sh
- ./run_tests.sh --nointbp
- if [[ $EXTRA_BUILD_FLAGS == *"DDISABLE_CERN_ROOT=0"* ]]; then ./run_root_GATE.sh; fi
- cd $TRAVIS_BUILD_DIR/recon_test_pack/SPECT
- ./run_SPECT_tests.sh
- cd $TRAVIS_BUILD_DIR/src
# Run Python tests, making sure we're using the correct Python interpreter
- export PYTHON=$(cmake -LA -N $TRAVIS_BUILD_DIR/build |awk -F= '/PYTHON_EXECUTABLE/ {print $2}')
- echo Using Python executable "$PYTHON"
- export PYTHONPATH=$TRAVIS_BUILD_DIR/install/python
- ${PYTHON} -m pytest .