.gitlab-ci.yml 9.67 KB
Newer Older
Simon Spannagel's avatar
Simon Spannagel committed
1
2
variables:
    EOS_PATH: "/eos/project/c/corryvreckan/www/"
Simon Spannagel's avatar
Simon Spannagel committed
3
4
    DOCKER_FILE: etc/docker/Dockerfile

Simon Spannagel's avatar
Simon Spannagel committed
5
stages:
Simon Spannagel's avatar
Simon Spannagel committed
6
    - compilation
7
    - testing
Simon Spannagel's avatar
Simon Spannagel committed
8
    - formatting
9
    - documentation
Simon Spannagel's avatar
Simon Spannagel committed
10
    - packaging
Simon Spannagel's avatar
Simon Spannagel committed
11
    - deployment
Simon Spannagel's avatar
Simon Spannagel committed
12
13
14
15
16
17

#######################
# Compilation targets #
#######################

cmp:slc6-gcc:
Simon Spannagel's avatar
Simon Spannagel committed
18
    stage: compilation
Simon Spannagel's avatar
Simon Spannagel committed
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
    tags:
        - docker
    image: clicdp/slc6-base
    script:
        - export COMPILER_TYPE="gcc"
        - source .gitlab-ci.d/init_x86_64.sh
        - source .gitlab-ci.d/load_deps.sh
        - mkdir build
        - cd build
        - cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS ..
        - ninja
        - ninja install
    artifacts:
        paths:
            - build
            - bin
            - lib
        expire_in: 3 hour

cmp:slc6-llvm:
Simon Spannagel's avatar
Simon Spannagel committed
39
    stage: compilation
Simon Spannagel's avatar
Simon Spannagel committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
    tags:
        - docker
    image: clicdp/slc6-base
    script:
        - export COMPILER_TYPE="llvm"
        - source .gitlab-ci.d/init_x86_64.sh
        - mkdir build
        - cd build
        - cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS ..
        - ninja
        - ninja install
    artifacts:
        paths:
            - build
            - bin
            - lib
        expire_in: 3 hour

cmp:cc7-gcc:
Simon Spannagel's avatar
Simon Spannagel committed
59
    stage: compilation
Simon Spannagel's avatar
Simon Spannagel committed
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
    tags:
        - docker
    image: clicdp/cc7-base
    script:
        - export COMPILER_TYPE="gcc"
        - source .gitlab-ci.d/init_x86_64.sh
        - source .gitlab-ci.d/load_deps.sh
        - mkdir build
        - cd build
        - cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS ..
        - ninja
        - ninja install
    artifacts:
        paths:
            - build
            - bin
            - lib
        expire_in: 3 hour

79
80
81
82
cmp:cc7-docker:
    stage: compilation
    tags:
        - docker
83
84
    image:
        name: gitlab-registry.cern.ch/corryvreckan/corryvreckan/corryvreckan-deps
Simon Spannagel's avatar
Simon Spannagel committed
85
        entrypoint: [""]
86
    before_script:
Simon Spannagel's avatar
Simon Spannagel committed
87
        - source scl_source enable devtoolset-7 || echo " "
88
    script:
89
90
        - mkdir build
        - cd build
Simon Spannagel's avatar
Simon Spannagel committed
91
92
93
        - cmake3 -DBUILD_EventLoaderEUDAQ2=ON -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS ..
        - make
        - make install
94
95
96
97
98
99
100
    artifacts:
        paths:
            - build
            - bin
            - lib
        expire_in: 3 hour

Simon Spannagel's avatar
Simon Spannagel committed
101
cmp:cc7-llvm:
Simon Spannagel's avatar
Simon Spannagel committed
102
    stage: compilation
Simon Spannagel's avatar
Simon Spannagel committed
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
    tags:
        - docker
    image: clicdp/cc7-base
    script:
        - export COMPILER_TYPE="llvm"
        - source .gitlab-ci.d/init_x86_64.sh
        - mkdir build
        - cd build
        - cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS ..
        - ninja
        - ninja install
    artifacts:
        paths:
            - build
            - bin
            - lib
        expire_in: 3 hour

121
cmp:mac1014-clang:
Simon Spannagel's avatar
Simon Spannagel committed
122
    stage: compilation
Simon Spannagel's avatar
Simon Spannagel committed
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    tags:
        - mac
    script:
        - source .gitlab-ci.d/init_mac.sh
        - source .gitlab-ci.d/load_deps.sh
        - mkdir build
        - cd build
        - cmake -GNinja -DCMAKE_BUILD_TYPE=RELEASE -DROOT_DIR=$ROOTSYS -DCMAKE_USE_RELATIVE_PATHS=TRUE ..
        - ninja
        - ninja install
    artifacts:
        paths:
            - build
            - bin
            - lib
        expire_in: 3 hour
Simon Spannagel's avatar
Simon Spannagel committed
139

140
141
142
143
144
145
146
147
148
##############
# Unit tests #
##############

.test:
    stage: testing
    tags:
        - docker
    dependencies:
149
        - cmp:cc7-docker
150
151
152
    image:
        name: gitlab-registry.cern.ch/corryvreckan/corryvreckan/corryvreckan-deps
        entrypoint: [""]
153
154
    before_script:
        - source scl_source enable devtoolset-7 || echo " "
155
156
157
158
159

tst:telescope:
    extends: .test
    script:
        - cd build/
160
        - mkdir -p ../testing/data
161
162
        - ctest -R test_timepix3tel --output-on-failure -j4

Simon Spannagel's avatar
Simon Spannagel committed
163
164
165
166
167
168
169
170

############################
# Format and Lint Checking #
############################

# SLC 6

fmt:slc6-llvm-format:
Simon Spannagel's avatar
Simon Spannagel committed
171
    stage: formatting
Simon Spannagel's avatar
Simon Spannagel committed
172
173
174
175
176
177
178
179
180
181
182
    tags:
        - docker
    dependencies:
        - cmp:slc6-llvm
    image: clicdp/slc6-base
    script:
        - export COMPILER_TYPE="llvm"
        - source .gitlab-ci.d/init_x86_64.sh
        - cd build/
        - ninja check-format

Simon Spannagel's avatar
Simon Spannagel committed
183
184
185
186
187
188
189
190
191
192
193
194
195
fmt:slc6-llvm-lint:
    stage: formatting
    tags:
        - docker
    dependencies:
        - cmp:slc6-llvm
    image: clicdp/slc6-base
    script:
        - export COMPILER_TYPE="llvm"
        - source .gitlab-ci.d/init_x86_64.sh
        - cd build/
        - ninja check-lint

Simon Spannagel's avatar
Simon Spannagel committed
196
197
198
# CentOS 7

fmt:centos7-llvm-format:
Simon Spannagel's avatar
Simon Spannagel committed
199
    stage: formatting
Simon Spannagel's avatar
Simon Spannagel committed
200
201
202
203
204
205
206
207
208
209
    tags:
        - docker
    dependencies:
        - cmp:cc7-llvm
    image: clicdp/cc7-base
    script:
        - export COMPILER_TYPE="llvm"
        - source .gitlab-ci.d/init_x86_64.sh
        - cd build/
        - ninja check-format
210

Simon Spannagel's avatar
Simon Spannagel committed
211
212
213
214
215
216
217
218
219
220
221
222
223
fmt:cc7-llvm-lint:
    stage: formatting
    tags:
        - docker
    dependencies:
        - cmp:cc7-llvm
    image: clicdp/cc7-base
    script:
        - export COMPILER_TYPE="llvm"
        - source .gitlab-ci.d/init_x86_64.sh
        - cd build/
        - ninja check-lint

224
225
226
227
228

#############################
# Documentation Compilation #
#############################

Simon Spannagel's avatar
Simon Spannagel committed
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# Compile Doxygen reference
cmp:doxygen:
    stage: documentation
    tags:
        - docker
    image: clicdp/cc7-base
    dependencies: []
    script:
        - source .gitlab-ci.d/init_x86_64.sh
        - source .gitlab-ci.d/load_deps.sh
        - mkdir -p public/usermanual
        - mkdir build
        - cd build
        - cmake -DBUILD_DOCS_ONLY=ON ..
        - make reference
        - mv reference/html ../public/reference
    artifacts:
        paths:
            - public
        expire_in: 24 hour
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266

# Compile LaTeX user manual:
cmp:usermanual:
    stage: documentation
    tags:
      - docker
    image: gitlab-registry.cern.ch/clicdp/publications/templates/custom_ci_worker:fedora-latex-latest
    dependencies: []
    script:
        - mkdir -p public/usermanual
        - mkdir build
        - cd build
        - cmake -DBUILD_DOCS_ONLY=ON ..
        - make pdf
        - mv usermanual/corryvreckan-manual.pdf ../public/usermanual
    artifacts:
        paths:
          - public
Simon Spannagel's avatar
Simon Spannagel committed
267
268
        expire_in: 24 hour

Simon Spannagel's avatar
Simon Spannagel committed
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
################################
# Packaging of Binary Tarballs #
################################

pkg:slc6-gcc:
    stage: packaging
    tags:
        - docker
    image: clicdp/slc6-base
    only:
        - tags
        - schedules
    dependencies:
        - cmp:slc6-gcc
    script:
        - export COMPILER_TYPE="gcc"
        - source .gitlab-ci.d/init_x86_64.sh
        - source .gitlab-ci.d/load_deps.sh
        - mkdir -p public/releases
        - cd build
        - 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:cc7-gcc:
    stage: packaging
    tags:
        - docker
    image: clicdp/cc7-base
    only:
        - tags
        - schedules
    dependencies:
        - cmp:cc7-gcc
    script:
        - export COMPILER_TYPE="gcc"
        - source .gitlab-ci.d/init_x86_64.sh
        - source .gitlab-ci.d/load_deps.sh
        - mkdir -p public/releases
        - cd build
        - cmake -GNinja -DCMAKE_SKIP_RPATH=ON -DCMAKE_INSTALL_PREFIX=/tmp ..
        - ninja package
        - mv *.tar.gz ../public/releases
    artifacts:
        paths:
            - public
        expire_in: 24 hour

Simon Spannagel's avatar
Simon Spannagel committed
321
322
323
324
########################
# Automatic Deployment #
########################

Simon Spannagel's avatar
Simon Spannagel committed
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
# 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
    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
        - schedules # Only execute this on scheduled "nightly" pipelines
    dependencies:
        - pkg:cc7-gcc
        - pkg:slc6-gcc
    # 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: []

368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
deploy-cvmfs:
    stage: deployment
    dependencies:
        - pkg:cc7-gcc
        - pkg:slc6-gcc
    tags:
        - cvmfs-deploy
    only:
        - tags
        - schedules # Only execute this on scheduled "nightly" pipelines
    script:
        - ./.gitlab-ci.d/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.d/gitlab_deploy.sh $RUNNER_LOCATION $BUILD_PATH
        - rm -f corryvreckan-*.tar.gz
    retry: 1

Simon Spannagel's avatar
Simon Spannagel committed
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
deploy-docker-latest:
    stage: deployment
    tags:
        - docker-image-build
    dependencies: []
    only:
        - schedules # Only execute this on scheduled "nightly" pipelines
    script:
        - "echo" # unused but this line is required by GitLab CI
    variables:
        TO: gitlab-registry.cern.ch/corryvreckan/corryvreckan

deploy-docker-tag:
    stage: deployment
    tags:
        - docker-image-build
    dependencies: []
    only:
        - tags
    script:
        - "echo" # unused but this line is required by GitLab CI
    variables:
        TO: gitlab-registry.cern.ch/corryvreckan/corryvreckan:${CI_COMMIT_TAG}