forked from mhm-ufz/mHM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
507 lines (476 loc) · 13 KB
/
.gitlab-ci.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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
# to use the env-var "GIT_CLONE_PATH", set the following in
# ./gitlab-runner/config.toml under [[runners]]:
# [runners.custom_build_dir]
# enabled = true
# This will prevent git clone conflicts for jobs ran in parallel
variables:
GIT_DEPTH: 10
GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_PATH/$CI_COMMIT_REF_NAME/$CI_JOB_NAME
stages:
- info
- build
- valgrind
- check-cases
- code-analysis
- deploy
show-env-vars:
stage: info
variables:
GIT_STRATEGY: none
SEP: "##################################################################"
S00: "commit date - "
S01: "project: ${CI_PROJECT_PATH}"
S02: "branch: ${CI_COMMIT_REF_NAME}"
S03: "commit: ${CI_COMMIT_SHA}"
S04: "commit msg: ${CI_COMMIT_MESSAGE}"
S05: "clone base path: "
S06: "runner token: ${CI_RUNNER_SHORT_TOKEN}"
script:
- echo -e "${SEP}\n${S00}$(date)\n${SEP}\n${S01}\n${S02}\n${S03}\n${S04}\n${SEP}\n${S05}${GIT_CLONE_PATH}\n${S06}\n${SEP}"
pybindings:
stage: build
variables:
GIT_DEPTH: 0 # to have all tags
script:
- module load Anaconda3
- conda create -p ./test_pybind
- conda activate ./test_pybind
- conda install -c conda-forge -y python=3.10 pip netcdf-fortran fortran-compiler c-compiler cxx-compiler python-build black isort
# check source code
- black --check --diff pybind
- isort --check --diff pybind
# create sdist and install it
- python -m build --sdist --outdir dist .
- pip install -v dist/mhm-*.tar.gz
# check installation
- python -c "import mhm; print(mhm.__version__)"
- which mhm
- cat $(which mhm)
- mhm --version
- mhm --help
# will always download from main repo (no testing to prevent errors in forks)
- mhm-download -V
- mhm-download -h
- mhm-download -v --path test_download/
- ls test_download/ && rm -rf test_download/
- mhm test_domain/
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- dist
documentation:
stage: build
script:
- source hpc-module-loads/eve.chs-conda01
- module load GCCcore/9.3.0 texlive/2020
# use doxygen from the chs conda environment
- export PROJECT_NUMBER="$(cat version.txt)"
- doxygen doc/doxygen.config > doxygen_log_dev.txt
# create pdf documentation
- cd latex/ && make > ../doxygen_latex_dev.txt
- cp refman.pdf ../html/mhm_doc.pdf
- cp refman.pdf ../mhm_doc_dev.pdf
- cd .. && mv html html_dev
- mv doxygen_warn.txt doxygen_warn_dev.txt
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- html_dev
- mhm_doc_dev.pdf
- doxygen_log_dev.txt
- doxygen_latex_dev.txt
- doxygen_warn_dev.txt
when: always
documentation_stable:
only:
- develop
stage: build
variables:
GIT_DEPTH: 0 # to have all tags
script:
- source hpc-module-loads/eve.chs-conda01
# doc for latest version tag
- git checkout $(git describe --match "v*" --abbrev=0 --tags $(git rev-list --tags --max-count=1))
- module load GCCcore/9.3.0 texlive/2020
# use doxygen from the chs conda environment
- export PROJECT_NUMBER="$(cat version.txt)"
- doxygen doc/doxygen.config > doxygen_log_tag.txt
- cd latex/ && make > ../doxygen_latex_tag.txt
- cp refman.pdf ../html/mhm_doc.pdf
- cp refman.pdf ../mhm_doc_tag.pdf
- cd .. && mv html html_tag
- mv doxygen_warn.txt doxygen_warn_tag.txt
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- html_tag
- mhm_doc_tag.pdf
- doxygen_log_tag.txt
- doxygen_latex_tag.txt
- doxygen_warn_tag.txt
when: always
cmake-nagfor62:
stage: build
script:
- source hpc-module-loads/eve.nagfor62
- source CI-scripts/compile
- source CI-scripts/compile_debug
artifacts:
paths:
- mhm
- mhm_debug
cmake-gfortran73:
stage: build
script:
- source hpc-module-loads/eve.gfortran73
- source CI-scripts/compile
- source CI-scripts/compile_debug
- source CI-scripts/compile_OpenMP
- source CI-scripts/compile_OpenMP_debug
artifacts:
paths:
- mhm
- mhm_debug
- mhm_openmp
- mhm_openmp_debug
cmake-gfortran73MPI:
stage: build
script:
- source hpc-module-loads/eve.gfortran73MPI
- source CI-scripts/compile_MPI
- source CI-scripts/compile_MPI_debug
artifacts:
paths:
- mhm_mpi
- mhm_mpi_debug
cmake-gfortran83:
stage: build
script:
- source hpc-module-loads/eve.gfortran83
- source CI-scripts/compile
- source CI-scripts/compile_debug
- source CI-scripts/compile_OpenMP
- source CI-scripts/compile_OpenMP_debug
artifacts:
paths:
- mhm
- mhm_debug
- mhm_openmp
- mhm_openmp_debug
cmake-gfortran83MPI:
stage: build
script:
- source hpc-module-loads/eve.gfortran83MPI
- source CI-scripts/compile_MPI
- source CI-scripts/compile_MPI_debug
artifacts:
paths:
- mhm_mpi
- mhm_mpi_debug
cmake-intel18:
stage: build
script:
- source hpc-module-loads/eve.intel18
- source CI-scripts/compile
- source CI-scripts/compile_debug
- source CI-scripts/compile_OpenMP
- source CI-scripts/compile_OpenMP_debug
artifacts:
paths:
- mhm
- mhm_debug
- mhm_openmp
- mhm_openmp_debug
cmake-intel18MPI:
stage: build
script:
- source hpc-module-loads/eve.intel18MPI
- source CI-scripts/compile_MPI
- source CI-scripts/compile_MPI_debug
artifacts:
paths:
- mhm_mpi
- mhm_mpi_debug
cmake-intel19:
stage: build
script:
- source hpc-module-loads/eve.intel19
- source CI-scripts/compile
- source CI-scripts/compile_debug
- source CI-scripts/compile_OpenMP
- source CI-scripts/compile_OpenMP_debug
artifacts:
paths:
- mhm
- mhm_debug
- mhm_openmp
- mhm_openmp_debug
cmake-intel19MPI:
stage: build
script:
- source hpc-module-loads/eve.intel19MPI
- source CI-scripts/compile_MPI
- source CI-scripts/compile_MPI_debug
artifacts:
paths:
- mhm_mpi
- mhm_mpi_debug
valgrind-nagfor62:
when: always
stage: valgrind
needs:
- job: cmake-nagfor62
artifacts: true
script:
- source hpc-module-loads/eve.nagfor62
- module load Anaconda3
- source activate /global/apps/mhm_checks/mhm_env
- valgrind --version
- valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose ./mhm_debug
# execute mem-use check
- valgrind --tool=massif --stacks=yes --time-unit=i --massif-out-file=massif.out.0 ./mhm_debug
- ms_print massif.out.0
artifacts:
paths:
- massif.out.0
valgrind-gfortran83:
when: always
stage: valgrind
needs:
- job: cmake-gfortran83
artifacts: true
script:
- source hpc-module-loads/eve.gfortran83
- module load Anaconda3
- source activate /global/apps/mhm_checks/mhm_env
- valgrind --version
- valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose ./mhm_debug
# execute mem-use check
- valgrind --tool=massif --stacks=yes --time-unit=i --massif-out-file=massif.out.0 ./mhm_debug
- ms_print massif.out.0
artifacts:
paths:
- massif.out.0
valgrind-intel19:
when: always
stage: valgrind
needs:
- job: cmake-intel19
artifacts: true
script:
- source hpc-module-loads/eve.intel19
- module load Anaconda3
- source activate /global/apps/mhm_checks/mhm_env
- valgrind --version
- valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose ./mhm_debug
# execute mem-use check
- valgrind --tool=massif --stacks=yes --time-unit=i --massif-out-file=massif.out.0 ./mhm_debug
- ms_print massif.out.0
artifacts:
paths:
- massif.out.0
check-nagfor62:
when: always
stage: check-cases
needs:
- job: cmake-nagfor62
artifacts: true
script:
- source hpc-module-loads/eve.nagfor62
- source CI-scripts/pre_check
- python -u run_mhm_checks.py -l logs -e ../mhm
artifacts:
when: always
paths:
- check/logs/
check-nagfor62DEBUG:
when: always
stage: check-cases
needs:
- job: cmake-nagfor62
artifacts: true
script:
- source hpc-module-loads/eve.nagfor62
- source CI-scripts/pre_check
# skip cases with optimization due to overflow in the random-number-generator (NAG uses -ieee=stop in DEBUG)
- python -u run_mhm_checks.py -l logs -e ../mhm_debug -s case_03 case_06 case_07 case_08 case_11
artifacts:
when: always
paths:
- check/logs/
check-gfortran73:
when: always
stage: check-cases
needs:
- job: cmake-gfortran73
artifacts: true
script:
- source hpc-module-loads/eve.gfortran73
- source CI-scripts/pre_check
- python -u run_mhm_checks.py -l logs -e ../mhm_debug ../mhm ../mhm_openmp_debug ../mhm_openmp -t 4
artifacts:
when: always
paths:
- check/logs/
check-gfortran73MPI:
when: always
stage: check-cases
needs:
- job: cmake-gfortran73MPI
artifacts: true
script:
- source hpc-module-loads/eve.gfortran73MPI
- source CI-scripts/pre_check
- python -u run_mhm_checks.py -l logs -e ../mhm_mpi_debug ../mhm_mpi -m 4
artifacts:
when: always
paths:
- check/logs/
check-gfortran83:
when: always
stage: check-cases
needs:
- job: cmake-gfortran83
artifacts: true
script:
- source hpc-module-loads/eve.gfortran83
- source CI-scripts/pre_check
- python -u run_mhm_checks.py -l logs -e ../mhm_debug ../mhm ../mhm_openmp_debug ../mhm_openmp -t 4
artifacts:
when: always
paths:
- check/logs/
check-gfortran83MPI:
when: always
stage: check-cases
needs:
- job: cmake-gfortran83MPI
artifacts: true
script:
- source hpc-module-loads/eve.gfortran83MPI
- source CI-scripts/pre_check
- python -u run_mhm_checks.py -l logs -e ../mhm_mpi_debug ../mhm_mpi -m 4
artifacts:
when: always
paths:
- check/logs/
check-intel18:
when: always
stage: check-cases
needs:
- job: cmake-intel18
artifacts: true
script:
- source hpc-module-loads/eve.intel18
- source CI-scripts/pre_check
- python -u run_mhm_checks.py -l logs -e ../mhm_debug ../mhm ../mhm_openmp_debug ../mhm_openmp -t 4
artifacts:
when: always
paths:
- check/logs/
check-intel18MPI:
when: always
stage: check-cases
needs:
- job: cmake-intel18MPI
artifacts: true
script:
- source hpc-module-loads/eve.intel18MPI
- source CI-scripts/pre_check
- python -u run_mhm_checks.py -l logs -e ../mhm_mpi_debug ../mhm_mpi -m 4
artifacts:
when: always
paths:
- check/logs/
check-intel19:
when: always
stage: check-cases
needs:
- job: cmake-intel19
artifacts: true
script:
- source hpc-module-loads/eve.intel19
- source CI-scripts/pre_check
- python -u run_mhm_checks.py -l logs -e ../mhm_debug ../mhm ../mhm_openmp_debug ../mhm_openmp -t 4
artifacts:
when: always
paths:
- check/logs/
check-intel19MPI:
when: always
stage: check-cases
needs:
- job: cmake-intel19MPI
artifacts: true
script:
- source hpc-module-loads/eve.intel19MPI
- source CI-scripts/pre_check
- python -u run_mhm_checks.py -l logs -e ../mhm_mpi_debug ../mhm_mpi -m 4
artifacts:
when: always
paths:
- check/logs/
unittest-gfortran83:
when: always
stage: code-analysis
needs:
- job: cmake-gfortran83
script:
# we need pfUnit
- source hpc-module-loads/eve.gfortran83
# run cmake with testing support, build mhm and run pfunit tests
- cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -B build
- cmake --build build --parallel
- cmake --build build --target test
coverage:
when: always
stage: code-analysis
needs: []
script:
# gcov is part of GCC
- source hpc-module-loads/eve.chs-conda01
# run cmake with coverage support and run tests
- cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_WITH_COVERAGE=ON -B build
- cmake --build build --parallel
- cmake --build build --target mhm_coverage_CI
# copy the output to a top-level folder
- mkdir coverage
- cp build/mhm_coverage_CI/* coverage -R
- lcov_cobertura build/mhm_coverage_CI.info
coverage: '/lines[\.]+\: (\d+\.\d+)\%/'
artifacts:
when: always
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- coverage
pages:
only:
- develop
stage: deploy
dependencies:
- documentation
- documentation_stable
- coverage
script:
# create public dir (remove if already present)
- test -d public && rm -rf public
- mkdir -p public
# create the subdir
- mkdir public/stable/
- mkdir public/latest/
# copy the doxygen generated html page to the public site
- cp html_tag/* public/stable/ -R
- cp html_dev/* public/latest/ -R
# create an index.html that redirects to the master documentation (in master folder)
- cp doc/html_files/index.html public/
# create the coverage site
- mkdir -p public/coverage
- cp coverage/* public/coverage/ -R
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- public
when: always