-
Notifications
You must be signed in to change notification settings - Fork 147
/
.travis.yml
258 lines (205 loc) · 8.43 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
# Travis configuration
#
# Note: building Fortran code is not supported (yet): see https://docs.travis-ci.com/user/language-specific/
# this is using C as a base and installs gfortran in the test environment
language: c
dist: bionic
os: linux
arch:
- ppc64le # IBM Power
# - amd64 # travis default
# - arm64 # ARM
compiler: gcc
# deprecated
#sudo: required
env:
global:
- FC=gfortran
- MPIFC=mpif90
- CC=gcc
- OMP_NUM_THREADS=2
- WORKDIR=`pwd`
matrix:
# for test cases, we use
# TESTID - identification number for test
# TESTDIR - test directory id
# TESTFLAGS - flags used for configuration
# TESTCOV - determines whether or not (0/1) code coverage flags are used
# CUDA - flag for compilation with CUDA
# CUDA_VERSION - specifies CUDA toolkit version
# code coverage: vectorization & mpi, using code coverage flags
- TESTID=0 TESTDIR=1 TESTCOV=1 TESTFLAGS="--without-mpi" CUDA=false
# code coverage: vectorization & mpi, using code coverage flags
- TESTID=1 TESTDIR=1 TESTCOV=1 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# default test with make tests
- TESTID=2 TESTDIR=0 TESTCOV=0 TESTFLAGS="" CUDA=false
# compilation w/ CUDA
- TESTID=3 TESTDIR=1 TESTCOV=0 TESTFLAGS="--with-cuda=cuda5 --without-mpi" CUDA=true CUDA_VERSION=6.5-14
# compilation w/ CUDA and MPI
- TESTID=4 TESTDIR=1 TESTCOV=0 TESTFLAGS="--with-cuda=cuda5 --with-mpi" CUDA=true CUDA_VERSION=6.5-14
# debug flags (tested on github actions)
#- TESTID=5 TESTDIR=1 TESTCOV=0 TESTFLAGS="--enable-debug" CUDA=false
# debug & double precision (tested on github actions)
#- TESTID=6 TESTDIR=1 TESTCOV=0 TESTFLAGS="--enable-double-precision --enable-debug" CUDA=false
# vectorization
- TESTID=7 TESTDIR=1 TESTCOV=0 TESTFLAGS="--enable-vectorization --without-mpi" CUDA=false
# example w/ PML
- TESTID=8 TESTDIR=2 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ MPI and Stacey
- TESTID=9 TESTDIR=3 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ kernel calculation
- TESTID=10 TESTDIR=4 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ poroelastic/acoustic media
- TESTID=11 TESTDIR=5 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ noise
- TESTID=12 TESTDIR=6 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ axisymmetric & attenuation (tested on github actions)
#- TESTID=13 TESTDIR=7 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ PML and MPI
- TESTID=14 TESTDIR=8 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ MPI and SEP format (tested on github actions)
#- TESTID=15 TESTDIR=9 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ initialfield Rayleigh wave (disabled, takes too long)
#- TESTID=16 TESTDIR=10 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ initialfield Rayleigh wave and manual crack (disabled, takes too long)
#- TESTID=17 TESTDIR=11 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ SH waves and checkerboard model
- TESTID=18 TESTDIR=12 TESTCOV=0 TESTFLAGS="--without-mpi" CUDA=false
# check amplitudes pressure
- TESTID=19 TESTDIR=13 TESTCOV=0 TESTFLAGS="--without-mpi" CUDA=false
# check amplitudes elastic
- TESTID=20 TESTDIR=14 TESTCOV=0 TESTFLAGS="--without-mpi" CUDA=false
# check amplitudes viscoelastic
- TESTID=21 TESTDIR=15 TESTCOV=0 TESTFLAGS="--without-mpi" CUDA=false
# fluid solid
- TESTID=22 TESTDIR=16 TESTCOV=0 TESTFLAGS="--with-mpi" CUDA=false
# poroelastic
- TESTID=23 TESTDIR=17 TESTCOV=0 TESTFLAGS="--with-mpi" CUDA=false
# example w/ noise kernel
- TESTID=24 TESTDIR=6 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ LDDRK
- TESTID=25 TESTDIR=18 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# example w/ NO_BACKWARD_RECONSTRUCTION
- TESTID=26 TESTDIR=4 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# moving sources (tested on github actions)
#- TESTID=27 TESTDIR=19 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# anisotropic/isotropic model (tested on github actions)
#- TESTID=28 TESTDIR=20 TESTCOV=0 TESTFLAGS="--enable-vectorization --with-mpi" CUDA=false
# infinite_homogeneous_moment_tensor_vertical_dip_slip example
- TESTID=29 TESTDIR=21 TESTCOV=0 TESTFLAGS="" CUDA=false
# additional ARM tests
jobs:
include:
- arch: arm64
env: TESTID=2 TESTDIR=0 TESTCOV=0 TESTFLAGS="" CUDA=false
- arch: arm64
env: TESTID=5 TESTDIR=1 TESTCOV=0 TESTFLAGS="--enable-debug" CUDA=false
before_install:
# informations on git
- |
git --version
git rev-parse --verify HEAD
git branch -a
# infos on commits
- |
echo "request: Branch($TRAVIS_BRANCH) Pull Request($TRAVIS_PULL_REQUEST) Tag($TRAVIS_TAG)"
echo "commit : Commit($TRAVIS_COMMIT) Range($TRAVIS_COMMIT_RANGE)"
# checks file changes
- |
echo "check file changes"
if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
# Push
echo "Push request:"
#COMMIT_RANGE="$(echo ${TRAVIS_COMMIT_RANGE} | cut -d '.' -f 1,4 --output-delimiter '..')"
#DIFF="$(git diff --name-only ${COMMIT_RANGE} --)"
DIFF=$(git diff --name-only ${TRAVIS_COMMIT_RANGE})
else
# PR build
echo "Pull request:"
DIFF=$(git diff --name-only ${TRAVIS_BRANCH}..HEAD --)
fi
echo "$DIFF"
# Escape newlines (replace \n with %0A)
#NEWDIFF=($( echo "$DIFF" | sed ':a;N;$!ba;s/\n/%0A/g' ))
#echo "$NEWDIFF"
#DIFF=$NEWDIFF
RUN_CHECKS=0
# Loop by lines
while read path; do
# Set $directory to substring before /
directory="$( echo $path | cut -d'/' -f1 -s )"
echo "file: $path - directory: $directory"
if [ -z "$directory" ]; then
# root directory
RUN_CHECKS=1
elif [ "$directory" == src ]; then
# src/ directory
RUN_CHECKS=1
elif [ "$directory" == setup ]; then
# setup/ directory
RUN_CHECKS=1
elif [ "$directory" == EXAMPLES ]; then
# EXAMPLES/ directory
RUN_CHECKS=1
elif [ "$directory" == tests ]; then
# tests/ directory
RUN_CHECKS=1
elif [ "$directory" == .travis ]; then
# .travis/ directory
RUN_CHECKS=1
fi
done <<< "$DIFF"
echo
echo "run checks: ${RUN_CHECKS}"
echo
export RUN_CHECKS=${RUN_CHECKS}
#abort: if [[ ${RUN_CHECKS} -eq 0 ]]; then echo "nothing to check, exiting..."; exit 1; fi
# recommended for MPI projects to unset CC: see https://docs.travis-ci.com/user/languages/c
#- test -n $CC && unset CC
# updates repository
# (fails currently...)
#- |
# travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6B05F25D762E3157
# travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 78BD65473CB3BD13
# travis_retry sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 762E3157
# apt explicit update
#- |
# echo "update apt-get"
# travis_retry sudo apt-get update
# echo
addons:
# apt update
apt:
update: true
install:
# installs compilers
- bash .travis/run_install.sh
script:
# builds configurations
- bash .travis/run_build.sh
# runs test examples
- bash .travis/run_tests.sh
after_success:
###########################################################
# code coverage
###########################################################
- |
if [ "$TESTCOV" == "1" ]; then
gcov --version
echo `pwd`
ls -al obj/
#echo
#env
#echo
fi
# produces coverage reports (done manually because of different naming for source & object files)
- |
if [ "$TESTCOV" == "1" ]; then
find obj/ -iname '*.o' | sort | awk '{print "gcov -o obj/ "$1;}'
# executes gcov-commands
find obj/ -iname '*.o' | sort | awk '{print "gcov -o obj/ "$1;}' | sh
fi
# code coverage:
# see script : https://github.com/codecov/codecov-bash/blob/master/codecov
# see example: https://github.com/codecov/example-fortran/blob/master/.travis.yml
- if [ "$TESTCOV" == "1" ]; then bash <(curl -s https://codecov.io/bash) -X gcov; fi