-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
371 lines (344 loc) · 13 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
#####################################################################################
# (c) Copyright 1998-2024 CERN for the benefit of the LHCb and ATLAS collaborations #
# #
# This software is distributed under the terms of the Apache version 2 licence, #
# copied verbatim in the file "LICENSE". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
#####################################################################################
variables:
CMAKE_GENERATOR: 'Ninja' # default build system
TARGET_BRANCH: master
# Job templates
.build: &template_build
tags:
- cvmfs
before_script:
# Add Ninja and CMake to the PATH
- export PATH="/cvmfs/sft.cern.ch/lcg/contrib/CMake/3.20.0/Linux-$(uname -m)/bin:/cvmfs/sft.cern.ch/lcg/contrib/ninja/1.11.1/Linux-$(uname -m)/bin:$PATH"
- export CCACHE_DIR=$PWD/.ccache
- "export LCG_VERSION=$(cut -d: -f2 <<< $CI_JOB_NAME)"
- "export platform=$(cut -d: -f3 <<< $CI_JOB_NAME)"
- "export PRESET=$(cut -d: -f4 <<< $CI_JOB_NAME)"
- if [ -z "$PRESET" ] ; then PRESET=full ; fi
script:
- git clone https://gitlab.cern.ch/lhcb-core/lcg-toolchains.git
- cmake --version
- cmake -S . -B build -Wno-dev -DCMAKE_TOOLCHAIN_FILE=lcg-toolchains/LCG_${LCG_VERSION}/${platform}.cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DGAUDI_TEST_PUBLIC_HEADERS_BUILD=yes -C ci-utils/preset-${PRESET}.cmake
- ccache -z
# pre-heat ccache cache for GaudiKernel
- jobs=$(nproc)
- while [[ $jobs -ge 1 ]] ; do
- cmake --build build -j $jobs --target GaudiKernel && break || true
- jobs=$(( $jobs / 2 ))
- done
# build from scratch
- cmake --build build --target clean
- cmake --build build 2>&1 | tee build.log
- ccache -s
- cp build/compile_commands.json .
# run the tests
- cd build
- if ctest -T test -j $(nproc) --repeat until-pass:3 --no-compress-output ; then result=success ; else result=failure ; fi
- cp Testing/$(head -1 Testing/TAG)/Test.xml ..
- cd ..
- xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml
- echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml"
# FIXME: Many tests require AIDA, so we ignore them in that case
- test "$PRESET" = "no-AIDA" -o "$result" = "success"
artifacts:
paths:
- build.log
- compile_commands.json
- Test.xml
reports:
junit:
- results.xml
when: always
expire_in: 1 week
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- .ccache
- build/Testing
.lhcb_build: &template_lhcb_build
<<: *template_build
script:
- shopt -s expand_aliases
- . /cvmfs/lhcb.cern.ch/lib/LbEnv
- cmake --version
- lb-set-platform $platform
- lb-project-init --overwrite
- ccache -z
- mkdir build.${BINARY_TAG}
- if [ -e build/Testing ] ; then mv build/Testing build.${BINARY_TAG} ; fi
# pre-heat ccache cache for GaudiKernel
- jobs=$(nproc)
- while [[ $jobs -ge 1 ]] ; do
- make BUILDFLAGS=-j$jobs GaudiKernel && break || true
- jobs=$(( $jobs / 2 ))
- done
# build from scratch
- make clean
- make 2>&1 | tee build.log
- ccache -s
# run the tests
- if make test ARGS="-j $(nproc) --repeat until-pass:3 --no-compress-output" ; then result=success ; else result=failure ; fi
- cp build.${BINARY_TAG}/Testing/$(head -1 build.${BINARY_TAG}/Testing/TAG)/Test.xml .
- mkdir -p build && mv build.${BINARY_TAG}/Testing build
- cp build.${BINARY_TAG}/compile_commands.json .
- mv build.${BINARY_TAG}/html .
- xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml
- echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml"
- test "$result" = "success"
artifacts:
paths:
- build.log
- compile_commands.json
- Test.xml
- html
reports:
junit:
- results.xml
when: always
expire_in: 1 week
.lcg_view_build: &template_lcg_view_build
<<: *template_build
script:
- . /cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/${platform}/setup.sh
- export CONFIGURABLE_DB_IGNORE=/cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/${platform}/lib/Gaudi.confdb
- cmake --version
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
- ccache -z
# pre-heat ccache cache for GaudiKernel
- jobs=$(nproc)
- while [[ $jobs -ge 1 ]] ; do
- cmake --build build -j $jobs --target GaudiKernel && break || true
- jobs=$(( $jobs / 2 ))
- done
# build from scratch
- cmake --build build --target clean
- cmake --build build 2>&1 | tee build.log
- ccache -s
- cp build/compile_commands.json .
# run the tests
- cd build
- if ctest -T test -j $(nproc) --repeat until-pass:3 --no-compress-output ; then result=success ; else result=failure ; fi
- cp Testing/$(head -1 Testing/TAG)/Test.xml ..
- cd ..
- xsltproc ci-utils/CTest2JUnit.xslt Test.xml > results.xml
- echo "Test results can be browsed at https://lhcb-nightlies.web.cern.ch/utils/test_report?url=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/raw/Test.xml"
- test "$result" = "success"
.warnings-check: &template_warnings_check
image: gitlab-registry.cern.ch/linuxsupport/alma9-base:latest
variables:
LOG: build.log
script:
- ci-utils/build-check ${LOG}
allow_failure: true
### Regular builds
lcg:105c:x86_64-el9-gcc13-opt:
<<: *template_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lcg:105c:x86_64-el9-gcc13-opt:
<<: *template_warnings_check
needs:
- job: "lcg:105c:x86_64-el9-gcc13-opt"
artifacts: true
lcg:105c:x86_64-el9-gcc13-dbg:
<<: *template_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lcg:105c:x86_64-el9-gcc13-dbg:
<<: *template_warnings_check
needs:
- job: "lcg:105c:x86_64-el9-gcc13-dbg"
artifacts: true
### Special builds
lcg:105c:x86_64-el9-gcc13-opt:minimal:
<<: *template_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lcg:105c:x86_64-el9-gcc13-opt:minimal:
<<: *template_warnings_check
needs:
- job: "lcg:105c:x86_64-el9-gcc13-opt:minimal"
artifacts: true
lcg:105c:x86_64-el9-gcc13-opt:no-AIDA:
<<: *template_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lcg:105c:x86_64-el9-gcc13-opt:no-AIDA:
<<: *template_warnings_check
needs:
- job: "lcg:105c:x86_64-el9-gcc13-opt:no-AIDA"
artifacts: true
lcg:105c:x86_64-el9-gcc13-opt:no-GaudiAlg:
<<: *template_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lcg:105c:x86_64-el9-gcc13-opt:no-GaudiAlg:
<<: *template_warnings_check
needs:
- job: "lcg:105c:x86_64-el9-gcc13-opt:no-GaudiAlg"
artifacts: true
lcg:105c:x86_64-el9-gcc13-opt:no-examples:
<<: *template_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lcg:105c:x86_64-el9-gcc13-opt:no-examples:
<<: *template_warnings_check
needs:
- job: "lcg:105c:x86_64-el9-gcc13-opt:no-examples"
artifacts: true
# LHCb-style build
lhcb:105c:x86_64_v3-el9-gcc13-opt+g:
<<: *template_lhcb_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lhcb:105c:x86_64_v3-el9-gcc13-opt+g:
<<: *template_warnings_check
needs:
- job: "lhcb:105c:x86_64_v3-el9-gcc13-opt+g"
artifacts: true
# Build on LCG View
lcg-view:105c:x86_64-el9-gcc13-opt:
<<: *template_lcg_view_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lcg-view:105c:x86_64-el9-gcc13-opt:
<<: *template_warnings_check
needs:
- job: "lcg-view:105c:x86_64-el9-gcc13-opt"
artifacts: true
# Compatibility
lcg-view:105c:x86_64-el9-clang16-opt:
<<: *template_lcg_view_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lcg-view:105c:x86_64-el9-clang16-opt:
<<: *template_warnings_check
needs:
- job: "lcg-view:105c:x86_64-el9-clang16-opt"
artifacts: true
lcg-view:106:x86_64-el9-gcc13-opt:
<<: *template_lcg_view_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lcg-view:106:x86_64-el9-gcc13-opt:
<<: *template_warnings_check
needs:
- job: "lcg-view:106:x86_64-el9-gcc13-opt"
artifacts: true
lcg-view:104:x86_64-el9-gcc13-opt:
<<: *template_lcg_view_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
warnings-check:lcg-view:104:x86_64-el9-gcc13-opt:
<<: *template_warnings_check
needs:
- job: "lcg-view:104:x86_64-el9-gcc13-opt"
artifacts: true
### Misc checks
check-unused:
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
needs:
- job: "lcg:105c:x86_64-el9-gcc13-opt"
artifacts: true
script:
- ci-utils/check-sources compile_commands.json
allow_failure: true
pre-commit-checks:
image: registry.cern.ch/docker.io/library/python:3.9
variables:
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
cache:
paths:
- ${PRE_COMMIT_HOME}
before_script:
- |
python -m venv ${CI_PROJECT_DIR}/.cache/pre-commit-venv
. ${CI_PROJECT_DIR}/.cache/pre-commit-venv/bin/activate
pip install pre-commit
git fetch origin $TARGET_BRANCH
git config user.name "Gitlab CI"
git config user.email "[email protected]"
script:
- |
if ! pre-commit run --show-diff-on-failure --from-ref FETCH_HEAD --to-ref HEAD ; then
echo ""
echo "Generating patch file..."
git commit -a -m "pre-commit fixes
patch generated by ${CI_JOB_URL}" > /dev/null
git format-patch HEAD~
cat <<EOF
=======================================
You can apply these changes with:
curl ${CI_JOB_URL}/artifacts/raw/0001-pre-commit-fixes.patch | git am
=======================================
EOF
exit 1
fi
artifacts:
paths:
- 0001-pre-commit-fixes.patch
when: on_failure
expire_in: 1 week
check-copyright:
image: registry.cern.ch/docker.io/library/python:3.9
script:
- |
curl -o lb-check-copyright "https://gitlab.cern.ch/lhcb-core/LbDevTools/-/raw/master/LbDevTools/SourceTools.py?inline=false"
python lb-check-copyright \
--exclude lhcbproject.yml \
--exclude ci-utils/preset-default.cmake \
--exclude ci-utils/preset-full.cmake \
--exclude ci-utils/preset-minimal.cmake \
--exclude ci-utils/preset-no-AIDA.cmake \
--exclude ci-utils/preset-no-examples.cmake \
--exclude ci-utils/preset-no-GaudiAlg.cmake \
--exclude ci-utils/preset-no-test.cmake \
origin/${TARGET_BRANCH}
### Documentation
website:
image: registry.cern.ch/docker.io/library/python:3.9
script:
- rm -rf public
- mkdir -p public
- cd docs
- pip install -r source/requirements.txt
- make html
- cp -a build/html/. ../public/.
artifacts:
paths:
- public
expire_in: 1 day
doxygen:105c:x86_64-el9-gcc13-opt:
<<: *template_build
image: gitlab-registry.cern.ch/lhcb-docker/os-base/alma9-devel:latest
script:
- . /cvmfs/sft.cern.ch/lcg/views/LCG_${LCG_VERSION}/${platform}/setup.sh
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- cmake --build build --target doc
- rm -rf public
- mkdir -p public/doxygen
- cp -r GaudiRelease/web_helpers/. public/doxygen/.
- mv build/doxygen/html ${CI_COMMIT_REF_SLUG}
- zip -r -q public/doxygen/${CI_COMMIT_REF_SLUG}.zip ${CI_COMMIT_REF_SLUG}
artifacts:
paths:
- public
expire_in: 1 day
# see https://gitlab.cern.ch/gitlabci-examples/deploy_eos for the details
# of the configuration
deploy-website:
needs:
- job: "website"
artifacts: true
- job: "doxygen:105c:x86_64-el9-gcc13-opt"
artifacts: true
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_TAG
image: gitlab-registry.cern.ch/ci-tools/ci-web-deployer:latest
script:
- test -z "$EOS_ACCOUNT_USERNAME" -o -z "$EOS_ACCOUNT_PASSWORD" -o -z "$EOS_PATH" && exit 0 || true
# Script that performs the deploy to EOS. Makes use of the variables defined in the project
# It will copy the generated content to the folder in EOS
- export CI_OUTPUT_DIR=public/
- deploy-eos
# do not run any globally defined before_script or after_script for this step
before_script: []
after_script: []