.gitlab-ci.yml 8.44 KB
Newer Older
1
2
3
4
5
6
# 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

7
8
variables:
  GIT_DEPTH: 10
9
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
11

12
13
14
stages:
  - info
  - test
Sebastian Müller's avatar
Sebastian Müller committed
15
  - deploy
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

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}"

Sebastian Müller's avatar
Sebastian Müller committed
31
documentation:
32
  stage: test
Sebastian Müller's avatar
Sebastian Müller committed
33
34
  variables:
    GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_PATH/$CI_COMMIT_REF_NAME/$CI_JOB_NAME
35
    GIT_FETCH_EXTRA_FLAGS: --all --no-tags --prune --quiet
Sebastian Müller's avatar
Sebastian Müller committed
36
  script:
37
38
39
    - source hpc-module-loads/eve.chs-conda01
    - module load GCCcore/9.3.0 texlive/2020
    # use doxygen from the chs conda environment
Sebastian Müller's avatar
Sebastian Müller committed
40
41
42
43
44
45
46
    - doxygen doc/doxygen.config > doxygen_log_dev.txt
    # create pdf documentation
    - cd latex/ && make > ../doxygen_latex_dev.txt
    - cp refman.pdf ../html/forces_doc.pdf
    - cp refman.pdf ../forces_doc_dev.pdf
    - cd .. && mv html html_dev
    - mv doxygen_warn.txt doxygen_warn_dev.txt
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  artifacts:
    name: "$CI_COMMIT_REF_NAME"
    paths:
      - html_dev
      - forces_doc_dev.pdf
      - doxygen_log_dev.txt
      - doxygen_latex_dev.txt
      - doxygen_warn_dev.txt
  when: always

documentation_stable:
  only:
    - develop
  stage: test
  variables:
62
    GIT_DEPTH: 0
63
64
65
66
67
68
    GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_RUNNER_SHORT_TOKEN/$CI_PROJECT_PATH/$CI_COMMIT_REF_NAME/$CI_JOB_NAME
    GIT_FETCH_EXTRA_FLAGS: --all --no-tags --prune --quiet
  script:
    - source hpc-module-loads/eve.chs-conda01
    - module load GCCcore/9.3.0 texlive/2020
    # use doxygen from the chs conda environment
Sebastian Müller's avatar
Sebastian Müller committed
69
    # same for master
70
71
72
73
74
75
    - git checkout master
    - doxygen doc/doxygen.config > doxygen_log_mas.txt
    - cd latex/ && make > ../doxygen_latex_mas.txt
    - cp refman.pdf ../html/forces_doc.pdf
    - cp refman.pdf ../forces_doc_mas.pdf
    - cd .. && mv html html_mas
76
    - mv doxygen_warn.txt doxygen_warn_mas.txt
Sebastian Müller's avatar
Sebastian Müller committed
77
78
79
  artifacts:
    name: "$CI_COMMIT_REF_NAME"
    paths:
80
81
82
83
84
      - html_mas
      - forces_doc_mas.pdf
      - doxygen_log_mas.txt
      - doxygen_latex_mas.txt
      - doxygen_warn_mas.txt
Sebastian Müller's avatar
Sebastian Müller committed
85
86
  when: always

87
88
# how the job build directory is erected
.setup_build: &setup_build_dir
89
  - rm -rf $BUILD_DIR
90
91
92
93
94
95
96
97
98
99
100
  - mkdir -p $BUILD_DIR
  - cd $BUILD_DIR

# make command
.make: &make
  - make $MAKE_FLAGS

# make test command
.make_test: &make_test
  - make $MAKE_FLAGS test

101
# make coverage command
102
.make_coverage: &make_coverage
103
  - make $MAKE_FLAGS coverage
104

105
106
107
108
109
110
111
112
113
# cleanup after scripts
.cleanup: &cleanup
  - cd -

# waiting on https://gitlab.com/groups/gitlab-org/-/epics/3589
# until this is fixed, we need to additionally set the CMAKE_FLAGS in the jobs as the expansion does not work
# debug variables
.debug_vars: &debug_vars
  BUILD_DIR: build_debug
Sebastian Müller's avatar
Sebastian Müller committed
114
  CMAKE_FLAGS: '$CMAKE_FLAGS -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
115
116
117
118

# release variables
.release_vars: &release_vars
  BUILD_DIR: build_release
Sebastian Müller's avatar
Sebastian Müller committed
119
  CMAKE_FLAGS: '$CMAKE_FLAGS -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
120

121
122
# coverage variables
.coverage_vars: &coverage_vars
Sebastian Müller's avatar
Sebastian Müller committed
123
  BUILD_DIR: build_debug
124
  CMAKE_FLAGS: '$CMAKE_FLAGS -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_WITH_COVERAGE=ON'
125

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# #################
# ### TEMPLATES ###
# #################

# template for test jobs
.test_template: &test_template
  stage: test
  script:
    - source $MODULE_LOAD_SCRIPT
    - *setup_build_dir
    - cmake $CMAKE_FLAGS ..
    - *make
    - *make_test
    - *cleanup
  artifacts:
    when: always
    paths:
    - $BUILD_DIR/Testing/Temporary

145
# template for coverage jobs
Sebastian Müller's avatar
Sebastian Müller committed
146
147
148
149
150
151
152
153
154
155
156
157
158
.coverage_template: &coverage_template
  stage: test
  script:
    - source $MODULE_LOAD_SCRIPT
    - *setup_build_dir
    - cmake $CMAKE_FLAGS ..
    - *make
    - *make_coverage
    - *cleanup
  artifacts:
    when: always
    paths:
    - $BUILD_DIR/coverage
159

160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# ##################
# ### BUILD JOBS ###
# ##################

# ######################
# ### ANALYTICS JOBS ###
# #####################

# #################
# ### TEST JOBS ###
# #################

# # NAG fails on lightweight_lib
# test-nag62-debug:
#   needs:
#     - job: build-nag62-debug
#       artifacts: true
#   variables:
#     <<: *debug_vars
179
#     MODULE_LOAD_SCRIPT: hpc-module-loads/eve.nagfor62
180
181
182
183
184
185
#     CMAKE_FLAGS: '-DCMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=64 -DCMAKE_BUILD_TYPE=Debug'
#   <<: *test_template

test-nag62-release:
  variables:
    <<: *release_vars
186
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.nagfor62
Sebastian Müller's avatar
Sebastian Müller committed
187
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX=64 -DCMAKE_BUILD_TYPE=Release'
188
189
190
191
192
  <<: *test_template

test-gfortran83MPI-release:
  variables:
    <<: *release_vars
193
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran83MPI
Sebastian Müller's avatar
Sebastian Müller committed
194
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
195
196
197
198
199
  <<: *test_template

test-gfortran83MPI-debug:
  variables:
    <<: *debug_vars
200
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran83MPI
Sebastian Müller's avatar
Sebastian Müller committed
201
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
202
203
  <<: *test_template

204
205
206
test-gfortran102MPI-release:
  variables:
    <<: *release_vars
207
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran102MPI
Sebastian Müller's avatar
Sebastian Müller committed
208
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
209
210
211
212
213
  <<: *test_template

test-gfortran102MPI-debug:
  variables:
    <<: *debug_vars
214
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran102MPI
Sebastian Müller's avatar
Sebastian Müller committed
215
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
216
217
  <<: *test_template

Robert Schweppe's avatar
Robert Schweppe committed
218
219
220
test-gfortran73MPI-release:
  variables:
    <<: *release_vars
221
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran73MPI
Sebastian Müller's avatar
Sebastian Müller committed
222
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
Robert Schweppe's avatar
Robert Schweppe committed
223
224
225
226
227
  <<: *test_template

test-gfortran73MPI-debug:
  variables:
    <<: *debug_vars
228
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.gfortran73MPI
Sebastian Müller's avatar
Sebastian Müller committed
229
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
Robert Schweppe's avatar
Robert Schweppe committed
230
231
232
233
234
  <<: *test_template

test-intel18-release:
  variables:
    <<: *release_vars
235
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel18
Sebastian Müller's avatar
Sebastian Müller committed
236
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
Robert Schweppe's avatar
Robert Schweppe committed
237
238
  <<: *test_template

239
240
241
242
243
244
245
# # intel18debug takes ages for test_mcmc
# test-intel18-debug:
#   variables:
#     <<: *debug_vars
#     MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel18
#     CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug'
#   <<: *test_template
Robert Schweppe's avatar
Robert Schweppe committed
246

247
test-intel19-release:
248
249
  variables:
    <<: *release_vars
250
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel19
Sebastian Müller's avatar
Sebastian Müller committed
251
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
252
253
  <<: *test_template

254
test-intel19MPI-release:
255
256
  variables:
    <<: *release_vars
257
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel19MPI
Sebastian Müller's avatar
Sebastian Müller committed
258
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
259
260
  <<: *test_template

Sebastian Müller's avatar
Sebastian Müller committed
261
262
263
264
265
266
267
test-intel2020b-release:
  variables:
    <<: *release_vars
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.intel2020b
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release'
  <<: *test_template

Sebastian Müller's avatar
Sebastian Müller committed
268
coverage:
269
270
271
  variables:
    <<: *debug_vars
    <<: *coverage_vars
272
    MODULE_LOAD_SCRIPT: hpc-module-loads/eve.chs-conda01
273
274
    CMAKE_FLAGS: '-DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_WITH_COVERAGE=ON'
  <<: *coverage_template
275

276
277
278
# ###################
# ### DEPLOY JOBS ###
# ###################
Sebastian Müller's avatar
Sebastian Müller committed
279
280

pages:
281
  when: always
Sebastian Müller's avatar
Sebastian Müller committed
282
283
284
  only:
    - develop
  stage: deploy
285
  needs:
286
287
    - job: documentation_stable
      artifacts: true
288
289
    - job: documentation
      artifacts: true
Sebastian Müller's avatar
Sebastian Müller committed
290
291
    - job: coverage
      artifacts: true
Sebastian Müller's avatar
Sebastian Müller committed
292
293
294
295
296
297
298
299
  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
300
    - cp html_mas/* public/stable/ -R
Sebastian Müller's avatar
Sebastian Müller committed
301
302
303
    - 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/
Sebastian Müller's avatar
Sebastian Müller committed
304
305
306
    # create the coverage site
    - mkdir -p public/coverage
    - cp  build_debug/coverage/* public/coverage/ -R
Sebastian Müller's avatar
Sebastian Müller committed
307
308
309
310
  artifacts:
    name: "$CI_COMMIT_REF_NAME"
    paths:
      - public