forked from acts-project/acts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
395 lines (351 loc) · 11.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
stages:
- check
- build
- test
- analysis
- deploy
variables:
# everything on except legacy, dd4hp, tgeo
COMMON_BUILD_OPTIONS: -DACTS_BUILD_DIGITIZATION_PLUGIN=on -DACTS_BUILD_IDENTIFICATION_PLUGIN=on -DACTS_BUILD_JSON_PLUGIN=on -DACTS_BUILD_BENCHMARKS=on -DACTS_BUILD_FATRAS=on -DACTS_BUILD_EXAMPLES=on -DACTS_BUILD_INTEGRATIONTESTS=on -DACTS_BUILD_UNITTESTS=on
CLICOLOR_FORCE: 1
before_script:
# CI executor uses fail on error by default
# setup scripts do not like that
- set +e && source CI/setup_lcg96.sh; set -e
# pre-build checks
no_needs:
stage: check
before_script: []
script:
- echo "This build is a workaround for 'https://gitlab.com/gitlab-org/gitlab/issues/30631'"
dependencies: []
format:
stage: check
image: gitlab-registry.cern.ch/acts/machines/check_llvm8:latest
before_script: []
script:
- CI/check_format .
artifacts:
paths:
- changed
when: on_failure
license:
stage: check
image: python:alpine3.6
before_script: []
script:
- apk add --no-cache git
- CI/check_license.py . --exclude "*thirdparty/*"
include_guards:
stage: check
image: python:alpine3.6
before_script: []
script:
- CI/check_include_guards.py . --fail-global --exclude "*thirdparty/*"
# job templates w/ default settings
#
# the build directory is always `build`. To select a specific build version
# you always have to define the correct `dependencies` settings to only
# load the artifacts from one build.
.build: &template_build
stage: build
needs: ["no_needs"]
tags:
- cvmfs
variables:
BUILD_TYPE: Release
BUILD_OPTIONS: ${COMMON_BUILD_OPTIONS} -DACTS_BUILD_LEGACY=on -DACTS_BUILD_DD4HEP_PLUGIN=on -DACTS_BUILD_TGEO_PLUGIN=on
script:
- mkdir build
- cd build
- cmake -GNinja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-Werror -fdiagnostics-color=always" ${BUILD_OPTIONS} ..
- cmake --build . -- -j${ACTS_NCPUS}
- find . -name "*.o" -delete
artifacts:
paths:
- build
expire_in: 6 hours
.unit_tests: &template_unit_tests
stage: test
tags:
- cvmfs
variables:
CTEST_OUTPUT_ON_FAILURE: 1
script:
- cd build
- ctest -T test --no-compress-output
- xsltproc ../CI/ctest2junit.xsl Testing/$(head -n1 Testing/TAG)/Test.xml > junit.xml
artifacts:
reports:
junit: build/junit.xml
paths:
- build
expire_in: 6 hours
.integration_tests: &template_integration_tests
stage: test
tags:
- cvmfs
variables:
CTEST_OUTPUT_ON_FAILURE: 1
script:
- cmake --build build -- integrationtests
# CC7, LCG96
build_cc7_lcg96_debug:
<<: *template_build
variables:
BUILD_TYPE: Debug # for coverage check
BUILD_OPTIONS: ${COMMON_BUILD_OPTIONS} -DACTS_BUILD_LEGACY=on -DACTS_BUILD_DD4HEP_PLUGIN=on -DACTS_BUILD_TGEO_PLUGIN=on
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg96.sh; set -e
- export ACTS_NCPUS=4
build_cc7_lcg96:
<<: *template_build
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg96.sh; set -e
# this build tests whether we can do an incremental build
# from the last tag to this commit.
build_cc7_lcg96_incremental:
<<: *template_build
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg96.sh; set -e
script:
- export prev_tag=$(CI/incremental_prev_tag.py)
- export current_head=$(git rev-parse HEAD)
- git checkout $prev_tag
- mkdir build
- cd build
- cmake -GNinja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-Werror -fdiagnostics-color=always" ${BUILD_OPTIONS} ..
- 'echo "Build previous tag: $prev_tag"'
- cmake --build . -- -j${ACTS_NCPUS}
- git checkout $current_head
- 'echo "Build current head: $current_head"'
- cmake --build . -- -j${ACTS_NCPUS}
- find . -name "*.o" -delete
allow_failure: true
coverage:
<<: *template_unit_tests
dependencies:
- build_cc7_lcg96_debug
needs: ["build_cc7_lcg96_debug"]
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg96.sh; set -e
# replace script to also calculate code coverage
script:
- cmake --build build -- test
- cd build
# we need a clean environment so we can install gcovr (pip), but we need to use gcov from lcg
- env -i bash ../CI/coverage_environment.sh "../CI/test_coverage --gcov $(which gcov)"
coverage: '/^TOTAL.*\s+(\d+\%)$/'
artifacts:
paths:
- build/coverage
unit_tests_cc7_lcg96:
<<: *template_unit_tests
dependencies:
- build_cc7_lcg96
needs: ["build_cc7_lcg96"]
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg96.sh; set -e
integration_tests_cc7_lcg96:
<<: *template_integration_tests
dependencies:
- build_cc7_lcg96
needs: ["build_cc7_lcg96"]
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg96.sh; set -e
# CC7, LCG96, LLVM9 + libstdc++
build_cc7_lcg96_llvm9:
<<: *template_build
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg96.sh; set -e
- export LLVM_ACTS_VERSION=9.0.0
- set +e && source CI/setup_llvm.sh; set -e
unit_tests_cc7_lcg96_llvm9:
<<: *template_unit_tests
dependencies:
- build_cc7_lcg96_llvm9
needs: ["build_cc7_lcg96_llvm9"]
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg96.sh; set -e
- export LLVM_ACTS_VERSION=9.0.0
- set +e && source CI/setup_llvm.sh; set -e
integration_tests_cc7_lcg96_llvm9:
<<: *template_integration_tests
dependencies:
- build_cc7_lcg96_llvm9
needs: ["build_cc7_lcg96_llvm9"]
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg96.sh; set -e
- export LLVM_ACTS_VERSION=9.0.0
- set +e && source CI/setup_llvm.sh; set -e
# SLC6, LCG96, build w/ legacy disabled
build_cc7_lcg96_no_legacy:
<<: *template_build
# need to set all variables again since we are overriding the template section
variables:
BUILD_TYPE: Release
BUILD_OPTIONS: ${COMMON_BUILD_OPTIONS} -DACTS_BUILD_DD4HEP_PLUGIN=on -DACTS_BUILD_TGEO_PLUGIN=on
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg96.sh; set -e
script:
- mkdir build
- cd build
- cmake -GNinja -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_CXX_FLAGS="-Werror -fdiagnostics-color=always" ${COMMON_BUILD_OPTIONS} -DACTS_BUILD_LEGACY=off ..
- cmake --build . -- -j${ACTS_NCPUS}
- find . -name "*.o" -delete
# SLC6, LCG95
build_slc6_lcg95:
<<: *template_build
image: gitlab-registry.cern.ch/acts/machines/slc6:latest
before_script:
- set +e && source CI/setup_lcg95.sh; set -e
unit_tests_slc6_lcg95:
<<: *template_unit_tests
dependencies:
- build_slc6_lcg95
needs: ["build_slc6_lcg95"]
image: gitlab-registry.cern.ch/acts/machines/slc6:latest
before_script:
- set +e && source CI/setup_lcg95.sh; set -e
integration_tests_slc6_lcg95:
<<: *template_integration_tests
dependencies:
- build_slc6_lcg95
needs: ["build_slc6_lcg95"]
image: gitlab-registry.cern.ch/acts/machines/slc6:latest
before_script:
- set +e && source CI/setup_lcg95.sh; set -e
# Ubuntu, LLVM90
build_ubuntu1804_llvm90:
<<: *template_build
image: gitlab-registry.cern.ch/acts/machines/ubuntu1804_llvm9:latest
before_script:
- source CI/env_info.sh
variables:
BUILD_TYPE: Release
BUILD_OPTIONS: ${COMMON_BUILD_OPTIONS} -DACTS_BUILD_LEGACY=on -DCMAKE_CXX_FLAGS="-stdlib=libc++"
unit_tests_ubuntu1804_llvm90:
<<: *template_unit_tests
dependencies:
- build_ubuntu1804_llvm90
needs: ["build_ubuntu1804_llvm90"]
image: gitlab-registry.cern.ch/acts/machines/ubuntu1804_llvm9:latest
before_script: []
integration_tests_ubuntu1804_llvm90:
<<: *template_integration_tests
dependencies:
- build_ubuntu1804_llvm90
needs: ["build_ubuntu1804_llvm90"]
image: gitlab-registry.cern.ch/acts/machines/ubuntu1804_llvm9:latest
before_script: []
# CC7, LCG95
build_cc7_lcg95:
<<: *template_build
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg95.sh; set -e
unit_tests_cc7_lcg95:
<<: *template_unit_tests
dependencies:
- build_cc7_lcg95
needs: ["build_cc7_lcg95"]
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg95.sh; set -e
integration_tests_cc7_lcg95:
<<: *template_integration_tests
dependencies:
- build_cc7_lcg95
needs: ["build_cc7_lcg95"]
image: gitlab-registry.cern.ch/acts/machines/cc7:latest
before_script:
- set +e && source CI/setup_lcg95.sh; set -e
doc:
stage: build
needs: ["no_needs"]
tags:
- cvmfs
script:
- mkdir build
- cd build
- cmake -GNinja -DACTS_BUILD_DOC=on ..
- cmake --build . -- doc
artifacts:
paths:
- build/doc/html
# post build/test analysis
clang_tidy:
stage: analysis
needs: ["no_needs"]
dependencies: []
tags:
- cvmfs
image: gitlab-registry.cern.ch/acts/machines/static_analysis/cc7-clang-tidy
before_script: []
script:
- mkdir report
- mkdir build && cd build
# contain LCG to only where needed
- /bin/sh -c "set +e && source ../CI/setup_lcg96.sh; set -e && cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ${COMMON_BUILD_OPTIONS} -DACTS_BUILD_DD4HEP_PLUGIN=on -DACTS_BUILD_TGEO_PLUGIN=on"
- cd ..
- run-clang-tidy.py -p build -export-fixes report/clang-tidy-fixes.yml -j$(nproc) 1> report/clang-tidy.log || true
- virtualenv civenv
- source civenv/bin/activate
- pip install -r CI/requirements.txt
- CI/make_report.py clang-tidy report/clang-tidy.log report/clang-tidy.json -e "$PWD/Tests/*" -e "$PWD/Legacy/*" -e "$PWD/Plugins/Json/include/Acts/Plugins/Json/lib/*" --filter "$PWD/*"
- 'codereport report/clang-tidy.json report --title="clang-tidy - commit: ${CI_COMMIT_SHA:0:8}" --prefix $PWD'
- CI/static_analysis_results.py --limitfile .static_analysis_limits.yml --itemfile report/clang-tidy.json -v
artifacts:
paths:
- report
when: always
.deploy_base: &deploy_base
image: alpine:3.8
before_script:
- apk --no-cache add python3 py3-cffi alpine-sdk python3-dev libffi-dev libxml2-dev libxslt-dev py3-lxml openssl-dev py3-pynacl
- pip3 install --upgrade pip
- pip3 install -r CI/requirements.txt
doc_deploy:
<<: *deploy_base
stage: deploy
dependencies:
- doc
script:
- CI/deploy_tag.py --doc-source build/doc/html --ref=$CI_COMMIT_TAG
only:
- tags
website_deploy:
stage: deploy
dependencies: []
script:
- curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master https://gitlab.cern.ch/api/v4/projects/36428/trigger/pipeline
only:
- master
- tags
coverage_deploy:
<<: *deploy_base
stage: deploy
dependencies:
- coverage
script:
- CI/publish_coverage.py --coverage-source=build/coverage --project-id=$CI_PROJECT_ID
only:
- master
- tags
sync_releases:
<<: *deploy_base
stage: deploy
script:
- CI/sync_releases.py
only:
- tags