-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
422 lines (369 loc) · 10.9 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
# SPDX-FileCopyrightText: 2018-2022 CERN and the Corryvreckan authors
# SPDX-License-Identifier: MIT
variables:
REPOSITORY: "https://gitlab.cern.ch/corryvreckan/corryvreckan.git"
EOS_PATH: "/eos/project/c/corryvreckan/www/"
DOCKER_FILE: etc/docker/Dockerfile
stages:
- compilation
- testing
- formatting
- documentation
- packaging
- deployment
############################
# General target templates #
############################
.centos7:
image: gitlab-registry.cern.ch/sft/docker/centos7:latest
tags:
- docker
variables:
COMPILER_TYPE: "gcc"
before_script:
- source .ci/init_x86_64.sh
- mkdir -p build/ && cd build/
.centos8:
image: gitlab-registry.cern.ch/sft/docker/centos8:latest
tags:
- docker
variables:
COMPILER_TYPE: "gcc"
before_script:
- source .ci/init_x86_64.sh
- mkdir -p build/ && cd build/
.docker:
image: gitlab-registry.cern.ch/corryvreckan/corryvreckan/corryvreckan-deps:latest
tags:
- docker
before_script:
- mkdir -p build/ && cd build/
.lxplus:
image: gitlab-registry.cern.ch/sft/docker/centos7:latest
tags:
- docker
variables:
COMPILER_TYPE: "gcc"
before_script:
- source etc/setup_lxplus.sh
- mkdir -p build/ && cd build/
.macos:
tags:
- mac
variables:
COMPILER_TYPE: "llvm"
before_script:
- source .ci/init_x86_64.sh
- mkdir -p build/ && cd build/
#######################
# Compilation targets #
#######################
# Hidden key to define the default compile job:
.compile:
stage: compilation
needs: []
script:
- export CCACHE_DIR=`pwd`/ccache
- cmake -GNinja -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- ninja -k0
- ninja install
artifacts:
paths:
- build
- bin
- lib
expire_in: 24 hour
cmp:lxplus-gcc:
extends:
- .centos7
- .compile
script:
- cmake -GNinja -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- ninja -k0
- ninja install
cmp:docker:
extends:
- .docker
- .compile
script:
- cmake -DCMAKE_CXX_FLAGS="-Werror" -DBUILD_EventLoaderEUDAQ2=ON -DBUILD_EventDefinitionM26=ON -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR -Deudaq_DIR=/opt/eudaq2/cmake ..
- make
- make install
cmp:cc7-gcc:
extends:
- .centos7
- .compile
cmp:cc7-llvm:
extends:
- .centos7
- .compile
variables:
COMPILER_TYPE: "llvm"
cmp:cc8-gcc:
extends:
- .centos8
- .compile
cmp:macos-clang:
extends:
- .macos
- .compile
script:
- cmake -GNinja -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DCMAKE_USE_RELATIVE_PATHS=TRUE -DEigen3_DIR=$Eigen3_DIR ..
- ninja -k0
- ninja install
##############
# Unit tests #
##############
.test:
extends: .docker
stage: testing
needs:
- job: cmp:docker
artifacts: true
after_script:
- source .ci/init_x86_64.sh
- .gitlab/ci/transform_ctest_junit.py build/Testing/`head -n 1 build/Testing/TAG`/Test.xml .gitlab/ci/ctest-to-junit.xsl corry-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}.xml
artifacts:
when: always
expire_in: 1 week
name: "corry-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
paths:
- corry-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}.xml
reports:
junit: corry-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}.xml
tst:tracking:
extends: .test
script:
- mkdir -p ../testing/data
- ctest -R test_tracking --no-compress-output --test-action Test -j1
tst:align:
extends: .test
script:
- mkdir -p ../testing/data
- ctest -R test_align --no-compress-output --test-action Test -j1
tst:io:
extends: .test
script:
- mkdir -p ../testing/data
- ctest -R test_io --no-compress-output --test-action Test -j1
tst:sim:
extends: .test
script:
- mkdir -p ../testing/data
- ctest -R test_sim --no-compress-output --test-action Test -j1
############################
# Format and Lint Checking #
############################
# Hidden key to define the basis for linting and formatting:
.format:
stage: formatting
needs: []
dependencies: []
extends: .docker
variables:
COMPILER_TYPE: "llvm"
before_script:
- export CXX=/usr/bin/clang++-12
- export PATH=~/.local/bin:$PATH
- mkdir -p build/ && cd build/
fmt:centos7-llvm-format:
extends: .format
script:
- cmake -DCMAKE_CXX_FLAGS="-Werror" -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR ..
- make check-format
fmt:cc7-llvm-lint:
extends: .format
script:
- cmake -DCMAKE_CXX_FLAGS="-Werror" -DBUILD_EventLoaderEUDAQ2=ON -DBUILD_EventDefinitionM26=ON -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR -Deudaq_DIR=/opt/eudaq2/cmake ..
- make check-lint 2> /dev/null
only:
- schedules
- tags
fmt:cc7-llvm-lint-diff:
extends: .format
script:
- git remote add upstream $REPOSITORY && git fetch upstream
- cmake -DCMAKE_CXX_FLAGS="-Werror" -DBUILD_EventLoaderEUDAQ2=ON -DBUILD_EventDefinitionM26=ON -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DEigen3_DIR=$Eigen3_DIR -Deudaq_DIR=/opt/eudaq2/cmake -DTARGET_REMOTE="upstream" ..
- make check-lint-diff 2> /dev/null
fmt:cmake-lint:
extends: .format
script:
- cmake ..
- make lint-cmake
fmt:codespell:
extends: .format
script:
- cd ../
- codespell --ignore-words .gitlab/ci/codespell_ignored_words.txt --quiet-level 2 --skip ".git,.gitlab,cmake,3rdparty,*.svg"
#############################
# Documentation Compilation #
#############################
.doc:
stage: documentation
needs: []
dependencies: []
tags:
- docker
before_script:
- mkdir -p public/usermanual
- mkdir build && cd build
artifacts:
paths:
- public
expire_in: 24 hour
# Compile Doxygen reference
cmp:doxygen:
extends: .doc
image: gitlab-registry.cern.ch/sft/docker/centos7:latest
script:
- source ../.ci/init_x86_64.sh
- cmake -GNinja -DBUILD_DOCS_ONLY=ON ..
- ninja corry_docs_reference
- mv doc/reference/html ../public/reference
# Compile LaTeX user manual:
cmp:usermanual:
extends: .doc
image: gitlab-registry.cern.ch/clicdp/publications/templates/custom_ci_worker:fedora-latex-latest
script:
- cmake -DBUILD_DOCS_ONLY=ON ..
- make pdf
- mv usermanual/corryvreckan-manual.pdf ../public/usermanual
################################
# Packaging of Binary Tarballs #
################################
.pack:
stage: packaging
only:
- tags@corryvreckan/corryvreckan
- schedules@corryvreckan/corryvreckan
before_script:
- export CCACHE_DIR=`pwd`/ccache
- source .ci/init_x86_64.sh
- mkdir -p public/releases
- cd build
script:
- cmake -GNinja -DCMAKE_SKIP_RPATH=ON -DCMAKE_INSTALL_PREFIX=/tmp ..
- ninja package
- mv *.tar.gz ../public/releases
artifacts:
paths:
- public
expire_in: 24 hour
pkg:cc8-gcc:
extends:
- .centos8
- .pack
needs:
- job: cmp:cc8-gcc
artifacts: true
pkg:cc7-gcc:
extends:
- .centos7
- .pack
needs:
- job: cmp:cc7-gcc
artifacts: true
pkg:cc7-llvm:
extends:
- .centos7
- .pack
needs:
- job: cmp:cc7-llvm
artifacts: true
variables:
COMPILER_TYPE: "llvm"
pkg:macos-clang:
extends:
- .macos
- .pack
tags:
- mac
needs:
- job: cmp:macos-clang
artifacts: true
########################
# Automatic Deployment #
########################
# Automatically deploy documentation to the website
# Deployment job only executed for new tag pushs, not for every commit.
deploy:documentation:
stage: deployment
tags:
- docker
variables:
GIT_STRATEGY: none
# Only run for new tags:
only:
- tags@corryvreckan/corryvreckan
dependencies:
- cmp:usermanual
- cmp:doxygen
# Docker image with tools to deploy to EOS
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
script:
- deploy-eos
# do not run any globally defined before_script or after_script for this step
before_script: []
after_script: []
deploy:eos:
stage: deployment
tags:
- docker
variables:
GIT_STRATEGY: none
# Only run for new tags:
only:
- tags@corryvreckan/corryvreckan
- schedules@corryvreckan/corryvreckan
dependencies:
- pkg:cc7-gcc
- pkg:cc8-gcc
- pkg:macos-clang
# Docker image with tools to deploy to EOS
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
script:
- deploy-eos
# do not run any globally defined before_script or after_script for this step
before_script: []
after_script: []
deploy:cvmfs:
stage: deployment
dependencies:
- pkg:cc7-gcc
- pkg:cc7-llvm
- pkg:cc8-gcc
- pkg:macos-clang
tags:
- cvmfs-deploy
only:
- tags@corryvreckan/corryvreckan
- schedules@corryvreckan/corryvreckan
script:
- ./.gitlab/ci/download_artifacts.py $API_TOKEN $CI_PROJECT_ID $CI_PIPELINE_ID
- export RUNNER_LOCATION=$(pwd)
- if [ -z ${CI_COMMIT_TAG} ]; then export BUILD_PATH='latest'; else export BUILD_PATH=${CI_COMMIT_TAG}; fi
- sudo -u cvclicdp -i $RUNNER_LOCATION/.gitlab/ci/gitlab_deploy.sh $RUNNER_LOCATION $BUILD_PATH
- rm -f corryvreckan-*.tar.gz
retry: 1
.deploy-docker:
stage: deployment
image:
name: gitlab-registry.cern.ch/ci-tools/docker-image-builder
entrypoint: [""]
dependencies: []
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/$DOCKER_FILE --destination $IMAGE_DESTINATION
- echo "Image pushed successfully to ${IMAGE_DESTINATION}"
deploy:docker-latest:
extends: .deploy-docker
variables:
IMAGE_DESTINATION: ${CI_REGISTRY_IMAGE}:latest
only:
- schedules@corryvreckan/corryvreckan
deploy:docker-tag:
extends: .deploy-docker
variables:
IMAGE_DESTINATION: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}
only:
- tags@corryvreckan/corryvreckan