-
Notifications
You must be signed in to change notification settings - Fork 29
/
.travis.yml
266 lines (258 loc) · 10.2 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# Note: with `language: cpp`, `cache: ccache` works
# but `cache: pip` and `python:` is ignored
language: cpp
dist: bionic # Ubuntu 18.04 LTS
cache: # cache C/C++/pip (shared between builds)
- ccache
- pip
# No need for sudo
sudo: false
# Currently commented out as set with environment flags
# Both clang and gcc can be tested. More is the better.
#compiler:
# - clang
# - gcc
# Compilation dependencies
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages: &addons_apt_packages
- git-core
- build-essential
- libhdf5-serial-dev
- libfftw3-dev
- python3-dev
- python3-tk
- libopenblas-dev
- libatlas-base-dev
- liblapack-dev
- libxml2-dev
- libarmadillo-dev
- libgtest-dev
- libplplot-dev
- swig
- ccache
# not in whitelist
- libxslt-dev
- libace-dev
# - root-system-bin
# Environment variables
# Note: On trusty we need to build Armadillo and boost ourselves (the system versions are too old)
# Note: On OSX we can't test SYSTEM_Boost=OFF due to excessive log size (https://github.com/CCPPETMR/SIRF-SuperBuild/issues/167)
# Note: currently ACE is not building correctly, so ACE is not built on any configuration https://github.com/CCPPETMR/SIRF-SuperBuild/issues/#174
# Note: on Trusty, g++-7 causes errors with the system ACE, so cannot use g++-7 or later https://github.com/CCPPETMR/SIRF-SuperBuild/issues/169
# Note: altering the matrix here will cause re-building of caches,
# so try to keep this concise to avoid need to update
# Note: the line above each `env` contains a resume of the parameters passed to cmake.
# + or - refer to the value of the parameter affecting the specific package is passed to cmake:
# i.e. -boost == -DUSE_SYSTEM_Boost=OFF, which means that Boost will be built.
env:
global:
- #STIR_BRANCH="-DSTIR_URL:STRING=https://github.com/KrisThielemans/STIR-1 -DSTIR_TAG=scatter_improvements_2"
- BUILD_FLAGS="-DCMAKE_BUILD_TYPE=Release ${STIR_BRANCH}"
# don't use too many threads - may crash
- MAKEFLAGS="-j 2"
matrix:
include:
# linux g{cc,++}-{6,7,8}
- os: linux
dist: focal
python: 3
addons:
apt:
packages:
- *addons_apt_packages
- [g++-8, libinsighttoolkit4-dev]
name: focal gcc8 -boost +itk +fftw3 +hdf5 +ace
env: EXTRA_BUILD_FLAGS="-DUSE_ITK:BOOL=ON -DUSE_SYSTEM_ITK:BOOL=ON -DUSE_SYSTEM_Boost=OFF -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON -DUSE_SYSTEM_ACE=ON" MATRIX_EVAL="CC=gcc-8 CXX=g++-8" PYMVER=3
- os: linux
dist: focal
python: 3
addons:
apt:
packages:
- *addons_apt_packages
- [g++-8, libboost-all-dev, libinsighttoolkit4-dev]
name: focal gcc8 +boost +itk +fftw3 +hdf5 +siemens_to_ismrmrd +swig +ace
env: EXTRA_BUILD_FLAGS="-DUSE_ITK:BOOL=ON -DUSE_SYSTEM_ITK:BOOL=ON -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON -DBUILD_siemens_to_ismrmrd=ON -DUSE_SYSTEM_SWIG=ON -DUSE_SYSTEM_ACE=ON" MATRIX_EVAL="CC=gcc-8 CXX=g++-8" PYMVER=3
- os: linux
python: 3
addons:
apt:
packages:
- *addons_apt_packages
- [g++-6, libboost-all-dev]
name: bionic gcc6 +DEVEL -boost -hdf5 -fftw3 +ace +siemens_to_ismrmrd
env: EXTRA_BUILD_FLAGS="-DDEVEL_BUILD=ON -DUSE_SYSTEM_Boost=OFF -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_FFTW3=OFF -DUSE_SYSTEM_ACE=ON -DBUILD_siemens_to_ismrmrd=ON" MATRIX_EVAL="CC=gcc-6 CXX=g++-6" PYMVER=3
- os: linux
python: 3
addons:
apt:
packages:
- *addons_apt_packages
- [g++-7, libinsighttoolkit4-dev]
name: bionic gcc7 +DEVEL -boost -fftw3 -hdf5 -swig +ace
env: EXTRA_BUILD_FLAGS="-DUSE_ITK:BOOL=ON -DUSE_SYSTEM_ITK:BOOL=ON -DDEVEL_BUILD=ON -DUSE_SYSTEM_Boost=OFF -DUSE_SYSTEM_FFTW3=OFF -DUSE_SYSTEM_HDF5=ON -DUSE_SYSTEM_ACE=ON -DUSE_SYSTEM_SWIG=OFF" MATRIX_EVAL="CC=gcc-7 CXX=g++-7" PYMVER=3
## osx g{cc,++} py{27,36}
#- os: osx
# osx_image: xcode11.2
# python: 3
# # +boost -hdf5 -swig
# env: EXTRA_BUILD_FLAGS="-DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_SWIG=OFF" MATRIX_EVAL="CC=gcc CXX=g++" PYMVER=3
#- os: osx
# # +boost +fftw3 -hdf5 -swig
# osx_image: xcode11.2
# python: 3
# env: EXTRA_BUILD_FLAGS="-DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_SWIG=OFF" MATRIX_EVAL="CC=gcc CXX=g++" PYMVER=3
#- os: osx
# python: 3
# # +DEVEL +boost -hdf5 +swig
# osx_image: xcode11.2
# env: EXTRA_BUILD_FLAGS="-DDEVEL_BUILD=ON -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_SWIG=ON" MATRIX_EVAL="CC=gcc CXX=g++" PYMVER=3
#- os: osx
# python: 3
# # +DEVEL +boost -fftw3 -hdf5 +swig +itk
# osx_image: xcode11.2
# env: EXTRA_BUILD_FLAGS="-DDEVEL_BUILD=ON -DUSE_SYSTEM_Boost=ON -DUSE_SYSTEM_FFTW3=OFF -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_SWIG=ON -DUSE_ITK=ON" MATRIX_EVAL="CC=gcc CXX=g++" PYMVER=3
- os: linux
python: 3
addons:
apt:
packages:
- *addons_apt_packages
- [g++-6, libboost-all-dev]
name: bionic gcc6 +boost +itk +fftw3 +hdf5 +vtk
env: EXTRA_BUILD_FLAGS="-DUSE_SYSTEM_Boost=ON -DUSE_ITK=ON -DUSE_SYSTEM_FFTW3=ON -DUSE_SYSTEM_HDF5=ON -DUSE_VTK=ON -DUSE_SYSTEM_VTK=ON" MATRIX_EVAL="CC=gcc-6 CXX=g++-6" PYMVER=3
#- os: osx
# python: 3
# # +boost +itk -hdf5 +swig +vtk
# osx_image: xcode11.2
# env: EXTRA_BUILD_FLAGS="-DUSE_SYSTEM_Boost=ON -DUSE_ITK=ON -DUSE_SYSTEM_HDF5=OFF -DUSE_SYSTEM_SWIG=ON -DUSE_VTK=ON -DUSE_SYSTEM_VTK=ON" MATRIX_EVAL="CC=gcc CXX=g++" PYMVER=3
before_install:
# Set C and C++ compiler etc using trick from
# https://docs.travis-ci.com/user/languages/cpp/#c11c11-and-beyond-and-toolchain-versioning
- eval "${MATRIX_EVAL}"
- export CC="${CC:-gcc}"
- export CXX="${CXX:-g++}"
- $CC --version
- $CXX --version
- mkdir -p ~/.local/bin
- pushd ~/.local/bin
# Note: use ( set -ev; ... ) to echo commands and exit immediately on failure
# in compounds statements (note that export/cd etc won't persist).
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
# Update and upgrade brew
brew update
brew upgrade
BUILD_FLAGS="$BUILD_FLAGS -DSHARED_LIBS_ABS_PATH=ON"
brew install openblas
# Let CMake find this blas version (note: we use /usr/local/opt/openblas symlink to get the most recent brew version)
EXTRA_BUILD_FLAGS="$EXTRA_BUILD_FLAGS -DCBLAS_INCLUDE_DIR=/usr/local/opt/openblas/include -DCBLAS_LIBRARY=/usr/local/opt/openblas/lib/libblas.dylib"
PY_EXE=$(which python${PYMVER})
if [[ $EXTRA_BUILD_FLAGS == *"-DUSE_VTK=ON"* ]] && [[ $EXTRA_BUILD_FLAGS == *"-DUSE_SYSTEM_VTK=ON"* ]]; then
brew install vtk
fi
BUILD_FLAGS="$BUILD_FLAGS -DPYTHON_EXECUTABLE=$PY_EXE"
( set -ev
# boost is already installed but 1.65 doesn't work so update
brew reinstall boost
# we currently need boost-python
# brew install boost-python
brew install ace
brew install swig
brew install ccache
if [[ $EXTRA_BUILD_FLAGS == *"SYSTEM_FFTW3=ON"* ]]; then
brew install fftw
else
echo "Not installing FFTW as we are building it"
fi
# need curl to get pip and more recent cmake
brew install curl
#brew install cmake # already present
# alternative: get our own
#curl -L -O https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4-Darwin-x86_64.tar.gz
#tar xzf cmake-*.tar.gz
#mv cmake-*/CMake.app/Contents/* cmake
#export PATH="$PWD/cmake/bin:$PATH"
)
elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
PY_EXE=python$PYMVER
#curl -o cmake.tgz -L https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4-Linux-x86_64.tar.gz
#tar xzf cmake.tgz && rm cmake.tgz
#ln -s cmake-*x86_64 cmake
#export PATH="$PWD/cmake/bin:$PATH"
if [[ $EXTRA_BUILD_FLAGS == *"-DUSE_VTK=ON"* ]] && [[ $EXTRA_BUILD_FLAGS == *"-DUSE_SYSTEM_VTK=ON"* ]]; then
sudo apt install libvtk7-dev
fi
fi
# for counting clones, excluding ours
- |
if [[ -n "$GITHUB_API_TOKEN" ]]; then
git clone https://[email protected]/ccp-petmr-codebot/github-stats --branch CCPPETMR/SIRF-SuperBuild
# update with last fortnight's clones from GitHub API
TRAVIS_REPO_SLUG=CCPPETMR/SIRF-SuperBuild source github-stats/setup.sh
# count unique clones, excluding travis, and print total
TRAVIS_REPO_SLUG=CCPPETMR/SIRF-SuperBuild gh_stats_count -k uniques
fi
- $PY_EXE --version
# ccache compiler override
- ln -s "$(which ccache)" g++
- ln -s "$(which ccache)" g++-6
- ln -s "$(which ccache)" g++-7
- ln -s "$(which ccache)" gcc
- ln -s "$(which ccache)" gcc-6
- ln -s "$(which ccache)" gcc-7
- export PATH="$PWD:$PATH"
- popd
# get pip
- curl -0 https://bootstrap.pypa.io/get-pip.py -o get-pip.py
- $PY_EXE get-pip.py --user
- echo "Using Python executable $PY_EXE"
- $PY_EXE --version
- $PY_EXE -m pip --version
# setuptools may be out of date on osx
- $PY_EXE -m pip install --user -U pip setuptools wheel
- $PY_EXE -m pip freeze
- $PY_EXE -m pip install --user -r requirements.txt
- $PY_EXE -m pip install --user -r ci-requirements.txt
# no point re-downloading SIRF - just use local version
# N.B.: don't put into build matrix to allow caching.
- BUILD_FLAGS="$BUILD_FLAGS -DPYVER=$PYMVER -DSIRF_SOURCE_DIR:PATH=$PWD -DDISABLE_GIT_CHECKOUT_SIRF=ON"
# get SuperBuild
- cd ..
- git clone https://github.com/CCPPETMR/SIRF-SuperBuild --recursive -b master
- cd SIRF-SuperBuild
- cmake --version
- echo "cmake flags $BUILD_FLAGS $EXTRA_BUILD_FLAGS"
install:
- cmake $BUILD_FLAGS $EXTRA_BUILD_FLAGS .
# Job may timeout (>50min) if no ccache, otherwise should be <1min:
- make
- |
if [[ -f INSTALL/share/gadgetron/config/gadgetron.xml.example ]]; then
mv INSTALL/share/gadgetron/config/gadgetron.xml.example INSTALL/share/gadgetron/config/gadgetron.xml
fi
- source $PWD/INSTALL/bin/env_ccppetmr.sh
script:
- ./INSTALL/bin/gadgetron >& gadgetron.log&
# print for debugging
- cat builds/SIRF/build/CMakeCache.txt
- |
cd builds/SIRF/build && ctest --verbose ; test_fail=$?
# echo "----------- Killing gadgetron server"
# killall gadgetron
if [[ $test_fail -ne 0 ]]; then
#echo "----------- Test output"
# cat builds/SIRF/build/Testing/Temporary/LastTest.log
echo "----------- Last 70 lines of gadgetron.log"
tail -n 70 gadgetron.log
travis_terminate $test_fail
fi
after_success:
- pushd ../SIRF
- sed -r 's/SIRF-SuperBuild\/INSTALL\/python\/sirf\/(\w*)\.py/SIRF\/src\/x\1\/p\1\/\1.py/g' ../SIRF-SuperBuild/sources/SIRF/.coverage > .coverage
- codecov
- coveralls
- popd