forked from GEOS-DEV/GEOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
267 lines (256 loc) · 11.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
267
language: minimal
env:
global:
- GEOSX_TPL_TAG=174-723
- secure: CGs2uH6efq1Me6xJWRr0BnwtwxoujzlowC4FHXHdWbNOkPsXf7nCgdaW5vthfD3bhnOeEUQSrfxdhTRtyU/NfcKLmKgGBnZOdUG4/JJK4gDSJ2Wp8LZ/mB0QEoODKVxbh+YtoAiHe3y4M9PGCs+wkNDw/3eEU00cK12DZ6gad0RbLjI3xkhEr/ZEZDZkcYg9yHAhl5bmpqoh/6QGnIg8mxIqdAtGDw+6tT0EgUqjeqc5bG5WwsamKzJItHSXD5zx8IJAlgDk4EzEGjZe0m56YnNfb9iwqqUsmL3Cuwgs7ByVDYw78JC5Kv42YqoxA5BxMT2mFsEe37TpYNXlzofU7ma2Duw9DGXWQd4IkTCcBxlyR0I0bfo0TmgO+y7PYG9lIyHPUkENemdozsZcWamqqkqegiEdRhDVYlSRo3mu7iCwTS6ZTALliVyEYjYxYb7oAnR3cNywXjblTCI8oKfgLSY+8WijM9SRl57JruIHLkLMCjmRI+cZBfv5tS2tYQTBPkygGrigrrN77ZiC7/TGyfggSN0+y0oYtOAgqEnBcKcreiibMW7tKcV2Z1RFD9ZvIkSc1EXLUPDP8FX1oyhmqBMqVo8LksrYLDJHQ05+F3YNgl2taSt7uMjQ4e8iZ3/IjFeMnbylDw+cj/RbS520HXsFPbWFm2Pb9pceA9n6GnY=
# The integrated test repository contains large data (using git lfs) and we do not use them here.
# To save time (and money) we do not let travis automatically clone all our (lfs) subrepositories and do it by hand.
git:
submodules: false
geosx_before_script: &geosx_before_script
before_script:
- git submodule update --init --recursive src/cmake/blt
- git submodule update --init --recursive src/coreComponents/LvArray
- git submodule update --init --recursive src/coreComponents/constitutive/PVTPackage
- git submodule update --init src/coreComponents/mesh/PAMELA
- git submodule update --init --recursive src/coreComponents/fileIO/coupling/hdf5_interface
geosx_linux_build: &geosx_linux_build
services: docker
<<: *geosx_before_script
script:
# The linux build relies on two environment variables DOCKER_REPOSITORY and GEOSX_TPL_TAG to define the TPL version.
# And another CMAKE_BUILD_TYPE to define the build type we want for GEOSX.
# Optional BUILD_AND_TEST_ARGS to pass arguments to travis_build_and_test.sh script.
#
# We extract the location of the GEOSX_TPL from the container...
- GEOSX_TPL_DIR=$(docker run --rm ${DOCKER_REPOSITORY}:${GEOSX_TPL_TAG} /bin/bash -c 'echo ${GEOSX_TPL_DIR}')
# ... so we can install GEOSX alongside. This is assumed for bundling the binaries, so consider modifying with care.
- GEOSX_DIR=${GEOSX_TPL_DIR}/../GEOSX-${TRAVIS_COMMIT:0:7}
# We need to know where the code folder is mounted inside the container so we can run the script at the proper location!
# Since this information is repeated twice, we use a variable.
- TRAVIS_BUILD_DIR_MOUNT_POINT=/tmp/GEOSX
# We need to keep track of the building container (hence the `CONTAINER_NAME`)
# so we can extract the data from it later (if needed). Another solution would have been to use a mount point,
# but that would not have solved the problem for the TPLs (we would require extra action to copy them to the mount point).
- CONTAINER_NAME=geosx_build
# Now we can build GEOSX.
- while sleep 5m; do echo "... still building ..."; done &
- docker run
--name=${CONTAINER_NAME}
--volume=${TRAVIS_BUILD_DIR}:${TRAVIS_BUILD_DIR_MOUNT_POINT}
--cap-add=ALL
-e HOST_CONFIG=${HOST_CONFIG:-host-configs/environment.cmake}
-e CMAKE_BUILD_TYPE
-e GEOSX_DIR=${GEOSX_DIR}
-e ENABLE_HYPRE=${ENABLE_HYPRE:-OFF}
-e ENABLE_HYPRE_CUDA=${ENABLE_HYPRE_CUDA:-OFF}
-e ENABLE_TRILINOS=${ENABLE_TRILINOS:-ON}
${DOCKER_REPOSITORY}:${GEOSX_TPL_TAG}
${TRAVIS_BUILD_DIR_MOUNT_POINT}/scripts/travis_build_and_test.sh ${BUILD_AND_TEST_ARGS};
geosx_osx_build: &geosx_osx_build
os: osx
osx_image: xcode12.5
install:
- TPL_METADATA_URL=https://www.googleapis.com/storage/v1/b/geosx/o/TPL%2Fosx-${GEOSX_TPL_TAG}.tar
- TPL_BULK_URL=${TPL_METADATA_URL}?alt=media
# Extracting the GEOSX_TPL installation directory
- METADATA=$(curl -s "${TPL_METADATA_URL}")
- GEOSX_TPL_DIR=$(echo -n ${METADATA} | python3 -c "import sys, json; print(json.load(sys.stdin)['metadata']['GEOSX_TPL_DIR'], end='')")
- sudo mkdir -p -m a=rwx ${GEOSX_TPL_DIR}
# Then download the TPLs and uncompress where needed
- curl -s "${TPL_BULK_URL}" | tar --strip-component=1 --directory=${GEOSX_TPL_DIR} -xf -
# Now let's deal with Homebrew third parties
- BREW_HASH=$(echo -n ${METADATA} | python3 -c "import sys, json; print(json.load(sys.stdin)['metadata']['BREW_HASH'], end='')")
- BREW_URL=https://raw.github.com/Homebrew/homebrew-core/${BREW_HASH}
- wget ${BREW_URL}/Formula/open-mpi.rb
- brew update
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ./open-mpi.rb
- for dep in `brew deps open-mpi.rb`; do brew install $dep; done
<<: *geosx_before_script
script:
- python ${TRAVIS_BUILD_DIR}/scripts/config-build.py
-hc ${TRAVIS_BUILD_DIR}/host-configs/darwin-clang.cmake
-DBLT_MPI_COMMAND_APPEND:STRING="--oversubscribe"
- cd build-darwin-clang-debug
- make -j $(nproc) VERBOSE=1
# - ctest -V -E "testUncrustifyCheck|testDoxygenCheck|blt_mpi_smoke"
geosx_totalenergies_cluster_build: &geosx_totalenergies_cluster_build
<<: *geosx_linux_build
# We use the most recent ubuntu distribution available in travis-ci to ensure maximum support of google cloud's sdk.
dist: bionic
addons:
apt:
sources:
- sourceline: 'deb https://packages.cloud.google.com/apt cloud-sdk main'
key_url: 'https://packages.cloud.google.com/apt/doc/apt-key.gpg'
packages:
- google-cloud-sdk
after_success:
# The temporary variable used at multiple locations.
- TMP_DIR=/tmp
# Extracting both GEOSX and its TPL from the stopped container...
- GEOSX_EXPORT_DIR=GEOSX-and-TPL-${TRAVIS_COMMIT:0:7}
- docker cp -a ${CONTAINER_NAME}:${GEOSX_TPL_DIR}/.. ${TMP_DIR}/${GEOSX_EXPORT_DIR}
# ... and packing it.
- GEOSX_BUNDLE=${TMP_DIR}/${GEOSX_EXPORT_DIR}.tar.gz
- tar czf ${GEOSX_BUNDLE} --directory=${TMP_DIR} ${GEOSX_EXPORT_DIR}
# Uploading to GCP/GCS using gcloud CLI
- GEOSX_GCLOUD_KEY=/tmp/geosx-key.json
- openssl aes-256-cbc -K $encrypted_5ac030ea614b_key -iv $encrypted_5ac030ea614b_iv
-in ${TRAVIS_BUILD_DIR}/geosx-key.json.enc -out ${GEOSX_GCLOUD_KEY} -d
- gcloud auth activate-service-account --key-file=${GEOSX_GCLOUD_KEY}
- CLOUDSDK_PYTHON=python3 gsutil cp -a public-read ${GEOSX_BUNDLE} gs://${GCP_BUCKET}/
draft_script: &draft_script
script:
# TRAVIS_PULL_REQUEST is false if job is not from a PR
- if [[ $TRAVIS_PULL_REQUEST == false ]]; then exit 0; fi;
- |
is_draft=$(curl -H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST | \
jq ".draft")
# CI jobs will be cancelled if PR is a draft.
# PR status must be "Open" to run CI.
- |
if [[ $is_draft == true ]]; then
curl -sS -H "Travis-API-Version: 3" \
-H "Authorization: token $AUTH_VAR" \
-X POST https://api.travis-ci.com/build/$TRAVIS_BUILD_ID/cancel
exit 1
else
exit 0
fi
# PR must be assigned to be merged.
# This script will fail if this is not the case.
assigned_script: &assigned_script
script:
# TRAVIS_PULL_REQUEST is false if job is not from a PR
- if [[ $TRAVIS_PULL_REQUEST == false ]]; then exit 0; fi;
- |
is_assigned=$(curl -H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST | \
jq ".assignees|length")
- if [[ $is_assigned == 0 ]]; then exit 1; else exit 0; fi
return_script: &return_script
script:
# Verifies if all the "checks" jobs passed
- |
exit $(curl -sS -H "Travis-API-Version: 3" \
-X GET https://api.travis-ci.com/build/$TRAVIS_BUILD_ID/jobs | \
jq '[ .jobs[] | select( (.stage.name == "checks") and (.allow_failure == true) and (.state != "passed")) ] | length')
stages:
- checks
- builds
- return_status
jobs:
allow_failures:
- name: code_style
- name: documentation
- name: check_submodules
- name: check_pr_is_assigned
include:
- stage: checks
name: check_pr_is_not_a_draft
<<: *draft_script
- stage: checks
name: code_style
<<: *geosx_linux_build
env:
- DOCKER_REPOSITORY=geosx/ubuntu20.04-gcc9
- CMAKE_BUILD_TYPE=Release
- BUILD_AND_TEST_ARGS=--test-code-style
- stage: checks
name: documentation
<<: *geosx_linux_build
env:
- DOCKER_REPOSITORY=geosx/ubuntu20.04-gcc9
- CMAKE_BUILD_TYPE=Release
- BUILD_AND_TEST_ARGS=--test-documentation
- stage: checks
name: check_submodules
script: scripts/test_submodule_updated.sh
- stage: checks
name: check_pr_is_assigned
<<: *assigned_script
- stage: builds
name: Ubuntu CUDA debug (18.04, clang 8.0.0 + gcc 8.3.1, open-mpi 2.1.1, cuda-10.1.243)
<<: *geosx_linux_build
# Builds only the geosx executable (timeout when building tests)
env:
- DOCKER_REPOSITORY=geosx/ubuntu18.04-clang8.0.0-cuda10.1.243
- CMAKE_BUILD_TYPE=Debug
- BUILD_AND_TEST_ARGS="--disable-unit-tests --build-exe-only"
- ENABLE_HYPRE=ON
- ENABLE_HYPRE_CUDA=ON
- ENABLE_TRILINOS=OFF
- stage: builds
name: Ubuntu CUDA (18.04, clang 8.0.0 + gcc 8.3.1, open-mpi 2.1.1, cuda-10.1.243)
<<: *geosx_linux_build
env:
- DOCKER_REPOSITORY=geosx/ubuntu18.04-clang8.0.0-cuda10.1.243
- CMAKE_BUILD_TYPE=Release
- BUILD_AND_TEST_ARGS=--disable-unit-tests
- ENABLE_HYPRE=ON
- ENABLE_HYPRE_CUDA=ON
- ENABLE_TRILINOS=OFF
- stage: builds
name: Centos (7.6, gcc 8.3.1, open-mpi 1.10.7, cuda 10.1.243)
<<: *geosx_linux_build
env:
- DOCKER_REPOSITORY=geosx/centos7.6.1810-gcc8.3.1-cuda10.1.243
- CMAKE_BUILD_TYPE=Release
- BUILD_AND_TEST_ARGS=--disable-unit-tests
- stage: builds
name: Pecan GPU (centos 7.7, gcc 8.2.0, open-mpi 4.0.1, mkl 2019.5, cuda 10.2.89p2)
<<: *geosx_totalenergies_cluster_build
env:
- DOCKER_REPOSITORY=geosx/pecan-gpu-gcc8.2.0-openmpi4.0.1-mkl2019.5-cuda10.2.89p2
- CMAKE_BUILD_TYPE=Release
- BUILD_AND_TEST_ARGS=--disable-unit-tests
- HOST_CONFIG=host-configs/TOTAL/pecan-GPU.cmake
- GCP_BUCKET=geosx/Pecan-GPU
- stage: builds
name: Pecan CPU (centos 7.7, gcc 8.2.0, open-mpi 4.0.1, mkl 2019.5)
<<: *geosx_totalenergies_cluster_build
env:
- DOCKER_REPOSITORY=geosx/pecan-cpu-gcc8.2.0-openmpi4.0.1-mkl2019.5
- CMAKE_BUILD_TYPE=Release
- HOST_CONFIG=host-configs/TOTAL/pecan-CPU.cmake
- GCP_BUCKET=geosx/Pecan-CPU
- stage: builds
name: Pangea 2 (centos 7.6, gcc 8.3.0, open-mpi 2.1.5, mkl 2019.3)
<<: *geosx_totalenergies_cluster_build
env:
- DOCKER_REPOSITORY=geosx/pangea2-gcc8.3.0-openmpi2.1.5-mkl2019.3
- CMAKE_BUILD_TYPE=Release
- GCP_BUCKET=geosx/Pangea2
- ENABLE_HYPRE=ON
- ENABLE_TRILINOS=OFF
- stage: builds
name: Mac_OSX
<<: *geosx_osx_build
- stage: builds
name: Centos (7.7, clang 9.0.0 + gcc 4.9.3, open-mpi 1.10.7)
<<: *geosx_linux_build
env:
- DOCKER_REPOSITORY=geosx/centos7.7.1908-clang9.0.0
- CMAKE_BUILD_TYPE=Release
- stage: builds
name: Ubuntu (20.04, gcc 9.3.0, open-mpi 4.0.3)
<<: *geosx_linux_build
env:
- DOCKER_REPOSITORY=geosx/ubuntu20.04-gcc9
- CMAKE_BUILD_TYPE=Release
- stage: builds
name: Ubuntu debug (20.04, gcc 10.3.0, open-mpi 4.0.3)
<<: *geosx_linux_build
env:
- DOCKER_REPOSITORY=geosx/ubuntu20.04-gcc10
- CMAKE_BUILD_TYPE=Debug
- stage: builds
name: Ubuntu (20.04, gcc 10.3.0, open-mpi 4.0.3)
<<: *geosx_linux_build
env:
- DOCKER_REPOSITORY=geosx/ubuntu20.04-gcc10
- CMAKE_BUILD_TYPE=Release
- stage: return_status
<<: *return_script