-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.gitlab-ci.yml
488 lines (460 loc) · 14.1 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
# 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
- check-cases
- code-analysis
- doc
- 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 Mamba/23.3.1-1
- mamba create -p ./mhm_env -y python=3.10 pip netcdf-fortran fortran-compiler c-compiler cxx-compiler fypp python-build black isort pytest-cov xarray netCDF4
- source activate ./mhm_env
# 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 .
# check installation
- python -c "import mhm; print(mhm.__version__)"
- python -c "import mhm; print(mhm.f_version)"
- which mhm
- mhm --version
# will always download from main repo (no testing to prevent errors in forks)
- which mhm-download
- mhm-download -V
- mhm-download -h
- python -m pytest --cov mhm --cov-report term-missing --cov-report html --cov-report xml -v pybind/tests/
# check editable installation last to not mess with pytest
- pip install -v -e .
- rm -rf mhm_env/
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
name: "$CI_COMMIT_REF_NAME"
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- dist
- htmlcov
cmake-gfortran102:
stage: build
script:
- source hpc-module-loads/eve.gfortran102
- 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-gfortran102MPI:
stage: build
script:
- source hpc-module-loads/eve.gfortran102MPI
- source CI-scripts/compile_MPI
- source CI-scripts/compile_MPI_debug
artifacts:
paths:
- mhm_mpi
- mhm_mpi_debug
cmake-gfortran122:
stage: build
script:
- source hpc-module-loads/eve.gfortran122
- 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-gfortran122MPI:
stage: build
script:
- source hpc-module-loads/eve.gfortran122MPI
- source CI-scripts/compile_MPI
- source CI-scripts/compile_MPI_debug
artifacts:
paths:
- mhm_mpi
- mhm_mpi_debug
cmake-intel2020b:
stage: build
script:
- source hpc-module-loads/eve.intel2020b
- 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-intel2020bMPI:
stage: build
script:
- source hpc-module-loads/eve.intel2020bMPI
- source CI-scripts/compile_MPI
- source CI-scripts/compile_MPI_debug
artifacts:
paths:
- mhm_mpi
- mhm_mpi_debug
cmake-intel2023b-classic:
stage: build
script:
- source hpc-module-loads/eve.intel2023b-classic
- 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-intel2023bMPI-classic:
stage: build
script:
- source hpc-module-loads/eve.intel2023bMPI-classic
- source CI-scripts/compile_MPI
- source CI-scripts/compile_MPI_debug
artifacts:
paths:
- mhm_mpi
- mhm_mpi_debug
check-gfortran102:
when: always
stage: check-cases
needs:
- job: cmake-gfortran102
artifacts: true
script:
- source hpc-module-loads/eve.gfortran102
- 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-gfortran102MPI:
when: always
stage: check-cases
needs:
- job: cmake-gfortran102MPI
artifacts: true
script:
- source hpc-module-loads/eve.gfortran102MPI
- 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-gfortran122:
when: always
stage: check-cases
needs:
- job: cmake-gfortran122
artifacts: true
script:
- source hpc-module-loads/eve.gfortran122
- 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-gfortran122MPI:
when: always
stage: check-cases
needs:
- job: cmake-gfortran122MPI
artifacts: true
script:
- source hpc-module-loads/eve.gfortran122MPI
- 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-intel2020b:
when: always
stage: check-cases
needs:
- job: cmake-intel2020b
artifacts: true
script:
- source hpc-module-loads/eve.intel2020b
- 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-intel2020bMPI:
when: always
stage: check-cases
needs:
- job: cmake-intel2020bMPI
artifacts: true
script:
- source hpc-module-loads/eve.intel2020bMPI
- 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-intel2023b-classic:
when: always
stage: check-cases
needs:
- job: cmake-intel2023b-classic
artifacts: true
script:
- source hpc-module-loads/eve.intel2023b-classic
- 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-intel2023bMPI-classic:
when: always
stage: check-cases
needs:
- job: cmake-intel2023bMPI-classic
artifacts: true
script:
- source hpc-module-loads/eve.intel2023bMPI-classic
- 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-gfortran122:
when: always
stage: code-analysis
needs:
- job: cmake-gfortran122
script:
# we need pfUnit
- source hpc-module-loads/eve.gfortran122
# 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
unittest-intel2023b-classic:
when: always
stage: code-analysis
needs:
- job: cmake-intel2023b-classic
script:
# we need pfUnit
- source hpc-module-loads/eve.intel2023b-classic
# 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
valgrind-gfortran122:
when: always
stage: code-analysis
needs:
- job: cmake-gfortran122
artifacts: true
script:
- source hpc-module-loads/eve.gfortran122
- module load Mamba/23.3.1-1
- 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-intel2023b-classic:
when: always
stage: code-analysis
needs:
- job: cmake-intel2023b-classic
artifacts: true
script:
- source hpc-module-loads/eve.intel2023b-classic
- module load Mamba/23.3.1-1
- 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
coverage:
when: always
stage: code-analysis
needs: []
script:
# gcov is part of GCC
- source hpc-module-loads/eve.chs-conda02
# 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
documentation:
when: always
stage: doc
needs: []
script:
- source hpc-module-loads/eve.chs-conda02
- module load GCC/12.2.0 texlive/20230904
# use doxygen from the chs conda environment
- export PROJECT_NUMBER="$(cat version.txt)"
- sed -i '/GENERATE_LATEX.*=/s/^.*$/GENERATE_LATEX = NO/' doc/doxygen.config
- doxygen doc/doxygen.config > doxygen_log_dev_html.txt 2>&1
# create pdf documentation (no files and namespaces there)
- sed -i '/GENERATE_HTML.*=/s/^.*$/GENERATE_HTML = NO/' doc/doxygen.config
- sed -i '/GENERATE_LATEX.*=/s/^.*$/GENERATE_LATEX = YES/' doc/doxygen.config
- sed -i '/SHOW_FILES.*=/s/^.*$/SHOW_FILES = NO/' doc/doxygen.config
- sed -i '/SHOW_NAMESPACES.*=/s/^.*$/SHOW_NAMESPACES = NO/' doc/doxygen.config
- sed -i '/ALPHABETICAL_INDEX.*=/s/^.*$/ALPHABETICAL_INDEX = NO/' doc/doxygen.config
- doxygen doc/doxygen.config > doxygen_log_dev_latex.txt 2>&1
# rename second "Module Documentation" chapter to "Package Documentation" to match html docs
- sed -i '/\\chapter{Module Documentation}/{x;s/^/x/;/xx/{x;s/.*/\\chapter{Package Documentation}/;b};x;}' latex/refman.tex
- cd latex/ && make -j > ../doxygen_latex_dev.txt 2>&1
- 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
documentation_stable:
when: always
only:
- develop
stage: doc
needs: []
variables:
GIT_DEPTH: 0 # to have all tags
script:
- source hpc-module-loads/eve.chs-conda02
# doc for latest version tag
- git checkout $(git describe --match "v*" --abbrev=0 --tags $(git rev-list --tags --max-count=1))
- module load GCC/12.2.0 texlive/20230904
# use doxygen from the chs conda environment
- export PROJECT_NUMBER="$(cat version.txt)"
- sed -i '/GENERATE_LATEX.*=/s/^.*$/GENERATE_LATEX = NO/' doc/doxygen.config
- doxygen doc/doxygen.config > doxygen_log_tag_html.txt 2>&1
# create pdf documentation (no files and namespaces there)
- sed -i '/GENERATE_HTML.*=/s/^.*$/GENERATE_HTML = NO/' doc/doxygen.config
- sed -i '/GENERATE_LATEX.*=/s/^.*$/GENERATE_LATEX = YES/' doc/doxygen.config
- sed -i '/SHOW_FILES.*=/s/^.*$/SHOW_FILES = NO/' doc/doxygen.config
- sed -i '/SHOW_NAMESPACES.*=/s/^.*$/SHOW_NAMESPACES = NO/' doc/doxygen.config
- sed -i '/ALPHABETICAL_INDEX.*=/s/^.*$/ALPHABETICAL_INDEX = NO/' doc/doxygen.config
- doxygen doc/doxygen.config > doxygen_log_tag_latex.txt 2>&1
# rename second "Module Documentation" chapter to "Package Documentation" to match html docs
- sed -i '/\\chapter{Module Documentation}/{x;s/^/x/;/xx/{x;s/.*/\\chapter{Package Documentation}/;b};x;}' latex/refman.tex
- cd latex/ && make -j > ../doxygen_latex_tag.txt 2>&1
- 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
pages:
only:
- develop
stage: deploy
needs:
- job: documentation
artifacts: true
- job: documentation_stable
artifacts: true
- job: coverage
artifacts: true
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