forked from UCL/STIR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
226 lines (210 loc) · 7.11 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# Language selection
language: cpp
dist: bionic # default to Ubuntu 18.04 LTS
cache: ccache
# Compilation dependencies
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages: &addons_apt_packages
- libboost-dev
- libhdf5-serial-dev
- libfftw3-dev # not sure why this is needed, but otherwise we get linking errors
- swig
- python3-dev
- python3-numpy
- python3-pytest
# these were for trusty
#- root-system-bin
#- libroot-tree-dev
#- libroot-tree-treeplayer-dev
#- libroot-io-dev
# 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
addons:
apt:
packages:
- *addons_apt_packages
- [g++-6]
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=OFF" CC=gcc-6 CXX=g++-6
- os: linux
python: 3
addons:
apt:
packages:
- *addons_apt_packages
- [g++-5, libinsighttoolkit4-dev]
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=OFF -DDISABLE_HDF5=ON" CC=gcc-5 CXX=g++-5
- os: linux
python: 3
addons:
apt:
packages:
- *addons_apt_packages
- [g++-7, libinsighttoolkit4-dev]
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=0 -DSTIR_OPENMP:BOOL=ON" CC=gcc-7 CXX=g++-7
- os: linux
dist: focal
python: 3
addons:
apt:
packages:
- *addons_apt_packages
- [g++-9, libinsighttoolkit4-dev, nlohmann-json3-dev]
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=0 -DSTIR_OPENMP:BOOL=ON" CC=gcc-9 CXX=g++-9
- os: linux
dist: focal
python: 3
addons:
apt:
packages:
- *addons_apt_packages
- [g++-10, nlohmann-json3-dev]
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=ON" CC=gcc-10 CXX=g++-10
- os: linux
# note: can't get it to install on focal due to a package problem
dist: bionic
python: 3
addons:
apt:
packages:
- *addons_apt_packages
- [clang, libomp-dev]
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=ON" CC=clang CXX=clang++
#### osx
# note: cannot use OpenMP on OSX yet, see https://github.com/UCL/STIR/issues/117
- os: osx
osx_image: xcode12.2
python: 3
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=OFF" CC=gcc CXX=g++
# Disable as ROOT is currently failing via brew (as it wants to build it, and which causes a timeout)
#- os: osx
# python: 3
# env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=0 -DSTIR_OPENMP:BOOL=OFF" CC=gcc CXX=g++
- os: osx
osx_image: xcode11.3
python: 3
env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=OFF -DSTIR_ENABLE_EXPERIMENTAL:BOOL=ON" CC=clang CXX=clang++
# osx, OpenMP using llvm clang
# disable due to LLVM clang 12.0.1 problem
#- os: osx
# osx_image: xcode11.3
# python: 3
# env: EXTRA_BUILD_FLAGS="-DDISABLE_CERN_ROOT=1 -DSTIR_OPENMP:BOOL=ON -DSTIR_ENABLE_EXPERIMENTAL:BOOL=ON -DCMAKE_CXX_COMPILER=/usr/local/opt/llvm/bin/clang++ -DCMAKE_C_COMPILER=/usr/local/opt/llvm/bin/clang"
env:
global:
- BUILD_FLAGS="-DBUILD_SWIG_PYTHON:BOOL=On -DSTIR_MPI:BOOL=Off -DCMAKE_BUILD_TYPE=Release"
# No need for sudo
sudo: false
# Actual compilation script
before_install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update
#now upgrade to avoid problems with outdated packages
brew upgrade
# check if we're using LLVM
if [[ $EXTRA_BUILD_FLAGS == *"llvm"* ]]; then
brew install llvm
brew install libomp
export DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:"/usr/local/opt/llvm/lib"
export LDFLAGS="-L/usr/local/opt/llvm/lib"
fi
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
PYMVER=3
PY_EXE=$(which 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
## specific handling of clang due to apt package problem in focal(but fails)
# case $CXX in
# clang*)
# wget https://apt.llvm.org/llvm.sh
# chmod +x llvm.sh
# sudo ./llvm.sh 10
# ;;
# *)
# ;;
# esac
#
## 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)";;
*)
ubuntu_major=`lsb_release -rs| awk -F. '{print $1}'`
case $ubuntu_major in
18) rootcc=gcc7.5;;
19) rootcc=gcc9.2;;
20) rootcc=gcc9.3;;
esac
rootfile=root_v6.24.00.Linux-ubuntu${ubuntu_major}-x86_64-${rootcc}.tar.gz
wget https://root.cern/download/$rootfile
tar xzf $rootfile
source root/bin/thisroot.sh
esac
PY_EXE=`which python3`
# needed for OPENMP support on Travis
# see https://github.com/travis-ci/travis-ci/issues/8613
export LD_LIBRARY_PATH=/usr/local/clang/lib:$LD_LIBRARY_PATH
fi
${PY_EXE} --version
BUILD_FLAGS="$BUILD_FLAGS -DPYTHON_EXECUTABLE=${PY_EXE}"
${CXX} --version
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:
- ctest --output-on-failure
- 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
- ./run_test_zoom_image.sh
- ./run_ML_norm_tests.sh
- if [[ $EXTRA_BUILD_FLAGS == *"DDISABLE_CERN_ROOT=0"* ]]; then ./run_root_GATE.sh; fi
- ./run_tests_modelling.sh
- cd $TRAVIS_BUILD_DIR/recon_test_pack/SPECT
- ./run_SPECT_tests.sh
# Run examples to see if they work
- cd $TRAVIS_BUILD_DIR/examples/PET_simulation
- ./run_simulation.sh 1> /dev/null
- 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 .