-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
256 lines (224 loc) · 7.34 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
# 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/$CI_CONCURRENT_ID
MAKE_FLAGS: -j 4
stages:
- info
- test
- doc
- deploy
workflow:
rules:
- if: $CI_COMMIT_REF_NAME =~ /-wip$/
when: never
- when: always
#############
### INFOS ###
#############
show-env-vars:
stage: info
variables:
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}"
###############
### CONFIGS ###
###############
# doc stable variables
.doc_stable_vars: &doc_stable_vars
GIT_DEPTH: 0
DOC_TYPE: stable
# doc latest variables
.doc_latest_vars: &doc_latest_vars
DOC_TYPE: latest
# debug variables
.debug_vars: &debug_vars
BUILD_DIR: build_debug
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
BUILD_TARGET: test
ARTIFACT_PATH: Testing/Temporary
# release variables
.release_vars: &release_vars
BUILD_DIR: build_release
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
BUILD_TARGET: test
ARTIFACT_PATH: Testing/Temporary
# coverage variables
.coverage_vars: &coverage_vars
BUILD_DIR: build_debug
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_WITH_COVERAGE=ON'
BUILD_TARGET: coverage
ARTIFACT_PATH: coverage
POST_RUN_CMD: 'lcov_cobertura build_debug/coverage.info'
# module loads for intel fortran compiler
.intel_vars_2020b: &intel_vars_2020b
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel2020b
.intel_vars_2023b-classic: &intel_vars_2023b-classic
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel2023b-classic
.intel_vars_2023b-llvm: &intel_vars_2023b-llvm
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel2023b-llvm
# module loads for gfortran compiler
.gnu_vars_102: &gfortran_vars_102
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran102
.gnu_vars_122: &gfortran_vars_122
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran122
# module loads for gfortran compiler from conda
.conda_vars_02: &conda_vars_02
MODULE_LOAD_SCRIPT: hpc-module-loads/eve.chs-conda02
# #################
# ### TEMPLATES ###
# #################
# template for documentation
.doc_template: &doc_template
when: always
stage: doc
needs: []
script:
- source hpc-module-loads/eve.chs-conda02
# create pdf documentation (needs texlive from module system)
- module load GCC/12.2.0 texlive/20230904
# checkout latest tag if there is at least one (and only for stable docs)
- if [ $(git rev-list --tags --max-count=1) ] && [ $DOC_TYPE == "stable" ]; then git checkout $(git describe --tags $(git rev-list --tags --max-count=1)); fi
- export PROJECT_NUMBER="$(cat version.txt)"
# create html documentation
- sed -i '/GENERATE_LATEX.*=/s/^.*$/GENERATE_LATEX = NO/' doc/doxygen.config
- doxygen doc/doxygen.config > doxygen_log_${DOC_TYPE}_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_${DOC_TYPE}_latex.txt 2>&1
# copy files
- cd latex/ && make > ../doxygen_latex_${DOC_TYPE}.txt 2>&1 # ../doxygen_latex_stable.txt
- cp refman.pdf ../html/forces_doc.pdf # same name always
- cp refman.pdf ../forces_doc_${DOC_TYPE}.pdf # ../forces_doc_stable.pdf
- cd .. && mv html html_${DOC_TYPE} # html_stable
- mv doxygen_warn.txt doxygen_warn_${DOC_TYPE}.txt # doxygen_warn_stable.txt
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- html_*
- forces_doc_*.pdf
- doxygen_*.txt
# template for test jobs
.job_template: &job_template
stage: test
script:
- source $MODULE_LOAD_SCRIPT
- cmake -B $BUILD_DIR $CMAKE_FLAGS
- cmake --build $BUILD_DIR --parallel
- cmake --build $BUILD_DIR --parallel --target $BUILD_TARGET
- $POST_RUN_CMD
artifacts:
when: always
paths:
- $BUILD_DIR/$ARTIFACT_PATH
# #################
# ### TEST JOBS ###
# #################
test-gfortran102-release:
variables:
<<: [*release_vars, *gfortran_vars_102]
<<: *job_template
test-gfortran102-debug:
variables:
<<: [*debug_vars, *gfortran_vars_102]
<<: *job_template
test-gfortran122-release:
variables:
<<: [*release_vars, *gfortran_vars_122]
<<: *job_template
test-gfortran122-debug:
variables:
<<: [*debug_vars, *gfortran_vars_122]
<<: *job_template
test-intel2020b-release:
variables:
<<: [*release_vars, *intel_vars_2020b]
<<: *job_template
test-intel2023b-classic-release:
variables:
<<: [*release_vars, *intel_vars_2023b-classic]
<<: *job_template
test-intel2023b-llvm-release:
variables:
<<: [*release_vars, *intel_vars_2023b-llvm]
<<: *job_template
coverage:
variables:
<<: [*coverage_vars, *conda_vars_02]
<<: *job_template
coverage: '/lines[\.]+\: (\d+\.\d+)\%/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- $BUILD_DIR/$ARTIFACT_PATH
conditional_coverage:
variables:
<<: [*coverage_vars, *conda_vars_02]
CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_WITH_COVERAGE=ON -DFORCES_WITH_OPTIMIZATION=OFF -DFORCES_WITH_NETCDF=OFF'
<<: *job_template
################
### DOC JOBS ###
################
documentation_stable:
only:
- main
variables:
<<: *doc_stable_vars
<<: *doc_template
documentation:
variables:
<<: *doc_latest_vars
<<: *doc_template
# ###################
# ### DEPLOY JOBS ###
# ###################
pages:
when: always
only:
- main
stage: deploy
needs:
- job: documentation_stable
artifacts: true
- job: documentation
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_stable/* public/stable/ -R
- cp html_latest/* public/latest/ -R
# create an index.html that redirects to the stable documentation (in stable folder)
- cp doc/html_files/index.html public/
# create the coverage site
- mkdir -p public/coverage
- cp build_debug/coverage/* public/coverage/ -R
artifacts:
name: "$CI_COMMIT_REF_NAME"
paths:
- public