IAP GITLAB

.gitlab-ci.yml 14.3 KB
Newer Older
Ralf Ulrich's avatar
Ralf Ulrich committed
1
variables:
Ralf Ulrich's avatar
Ralf Ulrich committed
2
  GIT_STRATEGY: fetch # clone: fresh clone, fetch: update
Ralf Ulrich's avatar
Ralf Ulrich committed
3
  GIT_SSL_NO_VERIFY: "1"
4
  GIT_DEPTH: "1"
5 6
  # to re-use clones also in different forks
  GIT_CLONE_PATH: $CI_BUILDS_DIR/$CI_CONCURRENT_ID/$CI_PROJECT_NAME
7 8 9 10 11 12
  ## Runtime options for sanitizers
  # (detect_leaks=0 because leak detection doesn't work in CI, but you can
  # try to test with leak detection locally by using detect_leaks=1)
  UBSAN_OPTIONS: "print_stacktrace=1"
  LSAN_OPTIONS: "log_threads=1"
  ASAN_OPTIONS: "detect_leaks=0:detect_stack_use_after_return=1"
13
  # location of AirShowerPhysics/corsika-data
14
  CORSIKA_DATA: "${CI_PROJECT_DIR}/Data" # the git submodule
15
  # _alternatively_ corsika-data can be downloaded as submodule:
Ralf Ulrich's avatar
Ralf Ulrich committed
16 17
  GIT_SUBMODULE_STRATEGY: normal # none: we get the submodules in before_script,
                                 # normal: get submodules automatically
18 19 20 21 22


#
# multi-step pipeline for each commit
#
Ralf Ulrich's avatar
Ralf Ulrich committed
23
# Mote: "Draft:" merge request, non-Draft merge requests and "Ready for Code Review" MR are all
24 25
#       handled explicitly
#
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
26
stages:
Ralf M Ulrich's avatar
quality  
Ralf M Ulrich committed
27
  - quality
28
  - config
Ralf M Ulrich's avatar
Ralf M Ulrich committed
29 30
  - build
  - test
31
  - build_test
Remy Prechelt's avatar
Remy Prechelt committed
32
  - python
Ralf M Ulrich's avatar
Ralf M Ulrich committed
33
  - example
34
  - build_test_example
35
  - install
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
36 37 38
  - optional


39 40


41
####### CODE QUALITY CHECK ##############
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
42

43
##########################################################
Ralf M Ulrich's avatar
quality  
Ralf M Ulrich committed
44 45 46 47 48 49 50
check-copyrights:
  image: corsika/devel:u-18.04
  stage: quality
  tags:
    - corsika
  script:
    - ./do-copyright.py
51 52 53
  rules:
    - if: $CI_MERGE_REQUEST_ID
    - if: $CI_COMMIT_TAG
54
    - if: $CI_COMMIT_BRANCH
55
  allow_failure: true
Ralf M Ulrich's avatar
quality  
Ralf M Ulrich committed
56

57
##########################################################
Ralf M Ulrich's avatar
quality  
Ralf M Ulrich committed
58
check-clang-format:
59
  image: corsika/devel:clang-8
Ralf M Ulrich's avatar
quality  
Ralf M Ulrich committed
60 61 62 63 64
  stage: quality
  tags:
    - corsika
  script:
    - ./do-clang-format.py --all
65 66 67
  rules:
    - if: $CI_MERGE_REQUEST_ID
    - if: $CI_COMMIT_TAG
68
    - if: $CI_COMMIT_BRANCH
69
  allow_failure: true
Ralf M Ulrich's avatar
quality  
Ralf M Ulrich committed
70

71 72


73

74 75 76 77 78 79 80
####### CONFIG ##############

##########################################################
# the generic config template job
# job/stage to just prepare cmake
.config:
  stage: config
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
81 82
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
83
  script:    
Ralf Ulrich's avatar
Ralf Ulrich committed
84
    - mkdir -p build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
85
    - cd build
86 87 88 89
    - cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON
  rules:
    - if: $CI_MERGE_REQUEST_ID
    - if: $CI_COMMIT_TAG
90
    - if: $CI_COMMIT_BRANCH
91
  cache:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
92
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
93
      - ${CI_PROJECT_DIR}/build/
94
    untracked: true
95
    policy: pull-push
Ralf M Ulrich's avatar
Ralf M Ulrich committed
96

97 98 99 100 101 102 103 104 105 106
# config for gcc
config-u-18_04:
  extends: .config
  image: corsika/devel:u-18.04
  cache:
    key: "${CI_COMMIT_REF_SLUG}-gcc"

# config for clang
config-clang-8:
  extends: .config
Ralf M Ulrich's avatar
Ralf M Ulrich committed
107
  image: corsika/devel:clang-8
108 109 110 111 112
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"



113 114

####### BUILD (only manual) ##############
115 116 117 118 119

##########################################################
# the generic build template job
# normal pipeline for each commit
.build:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
120 121 122 123 124 125
  stage: build
  tags:
    - corsika
  script:
    - cd build
    - cmake --build . -- -j4
126 127
  rules:
    - if: $CI_MERGE_REQUEST_ID
128
      when: manual
129
    - if: $CI_COMMIT_TAG
130
      when: manual
131
    - if: $CI_COMMIT_BRANCH
132 133
      when: manual
  allow_failure: true
134
  cache:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
135
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
136
      - ${CI_PROJECT_DIR}/build/
137
    untracked: true
138
    policy: pull-push
Ralf M Ulrich's avatar
Ralf M Ulrich committed
139

140 141 142
# build for gcc
build-u-18_04:
  extends: .build
Ralf M Ulrich's avatar
Ralf M Ulrich committed
143 144
  image: corsika/devel:u-18.04
  dependencies:
145 146 147
    - config-u-18_04
  cache:
    key: "${CI_COMMIT_REF_SLUG}-gcc"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
148

149
# build for clang
150
build-clang-8:
151
  extends: .build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
152 153
  image: corsika/devel:clang-8
  dependencies:
154 155 156 157 158
    - config-clang-8
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"


159 160 161


####### TEST (only manual)  ##############
162 163 164 165 166

##########################################################
# generic test template job
# normal pipeline for each commit
.test:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
167
  stage: test
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
168 169 170 171
  tags:
    - corsika
  script:
    - cd build
172
    - set -o pipefail
173
    - ctest -j4 -VV | gzip -v -9 > test.log.gz
174 175
  rules:
    - if: $CI_MERGE_REQUEST_ID
176
      when: manual
177
    - if: $CI_COMMIT_TAG
178
      when: manual
179
    - if: $CI_COMMIT_BRANCH
180 181
      when: manual
  allow_failure: true
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
182
  artifacts:
183
    when: always
184
    expire_in: 3 days
185 186
    reports:
      junit:
Ralf Ulrich's avatar
Ralf Ulrich committed
187
        - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
188
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
189
      - ${CI_PROJECT_DIR}/build/test.log.gz
190
  cache:
191
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
192
      - ${CI_PROJECT_DIR}/build/
193 194
    untracked: true
    policy: pull-push
Ralf M Ulrich's avatar
Ralf M Ulrich committed
195

196 197 198
# test for gcc
test-u-18_04:
  extends: .test
Ralf M Ulrich's avatar
Ralf M Ulrich committed
199 200 201
  image: corsika/devel:u-18.04
  dependencies:
    - build-u-18_04
202 203 204 205 206 207 208 209 210 211 212 213 214 215
  cache:
    key: "${CI_COMMIT_REF_SLUG}-gcc"

# test for clang
test-clang-8:
  extends: .test
  image: corsika/devel:clang-8
  dependencies:
    - build-clang-8
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"



216

Ralf Ulrich's avatar
Ralf Ulrich committed
217
####### BUILD-TEST (all builds <= Draft, default) ##############
218 219 220 221 222 223 224 225 226 227 228 229

##########################################################
# the generic build_test template job
# normal pipeline for each commit
.build_test:
  stage: build_test
  tags:
    - corsika
  script:
    - cd build
    - cmake --build . -- -j4
    - set -o pipefail
230
    - ctest -j4 -VV | gzip -v -9 > test.log.gz
231
  rules:
Ralf Ulrich's avatar
Ralf Ulrich committed
232
    - if: '$CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/'
Ralf M Ulrich's avatar
failure  
Ralf M Ulrich committed
233
      allow_failure: false
234 235 236 237 238 239 240 241 242
    - if: $CI_MERGE_REQUEST_ID
      when: manual
      allow_failure: true
  allow_failure: true
  artifacts:
    when: always
    expire_in: 3 days
    reports:
      junit:
Ralf Ulrich's avatar
Ralf Ulrich committed
243
        - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
244
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
245
      - ${CI_PROJECT_DIR}/build/test.log.gz
246
  cache:
247
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
248
      - ${CI_PROJECT_DIR}/build/
249 250 251 252 253 254 255 256 257 258 259 260 261
    untracked: true
    policy: pull-push

# build_test for gcc
build_test-u-18_04:
  extends: .build_test
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  cache:
    key: "${CI_COMMIT_REF_SLUG}-gcc"

# build_test for clang
262
build_test-clang-8:
263 264 265 266 267 268 269 270 271 272
  extends: .build_test
  image: corsika/devel:clang-8
  dependencies:
    - config-clang-8
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"



####### EXAMPLE (only manual)  ##############
273 274 275 276 277

##########################################################
# generic example template job
# normal pipeline for each commit
.example:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
278
  stage: example
Ralf Ulrich's avatar
ci  
Ralf Ulrich committed
279 280
  before_script:
    - apt-get -qq update && apt-get -qq install -y gdb
Ralf M Ulrich's avatar
Ralf M Ulrich committed
281 282 283 284 285
  tags:
    - corsika
  script:
    - cd build
    - set -o pipefail
Ralf Ulrich's avatar
Ralf Ulrich committed
286
    - make -j4 run_examples | gzip -v -9 > examples.log.gz
287
  rules:
Ralf Ulrich's avatar
Ralf Ulrich committed
288
    - if: $CI_MERGE_REQUEST_ID
289
      when: manual
290
    - if: $CI_COMMIT_TAG
Ralf Ulrich's avatar
Ralf Ulrich committed
291
      when: manual
292
    - if: $CI_COMMIT_BRANCH
293 294
      when: manual
  allow_failure: true
Ralf M Ulrich's avatar
Ralf M Ulrich committed
295 296
  artifacts:
    when: always
297
    expire_in: 3 days
Ralf M Ulrich's avatar
Ralf M Ulrich committed
298
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
299
      - ${CI_PROJECT_DIR}/build/examples.log.gz
300
  cache:
301
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
302
      - ${CI_PROJECT_DIR}/build/
303
    untracked: true
304
    policy: pull
Ralf M Ulrich's avatar
Ralf M Ulrich committed
305

306
# example for gcc
307
example-u-18_04:
308 309 310 311 312 313 314 315 316 317
  extends: .example
  image: corsika/devel:u-18.04
  dependencies:
    - build-u-18_04
  cache:
    key: "${CI_COMMIT_REF_SLUG}-gcc"

# example for clang
example-clang-8:
  extends: .example
Ralf M Ulrich's avatar
Ralf M Ulrich committed
318 319 320
  image: corsika/devel:clang-8
  dependencies:
    - build-clang-8
321 322 323 324
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"


325

Ralf Ulrich's avatar
Ralf Ulrich committed
326
####### BUILD-TEST-EXAMPLE (only non-Draft)  ##############
327 328 329 330 331 332 333 334

##########################################################
# generic example template job
# normal pipeline for each commit
.build_test_example:
  stage: build_test_example
  tags:
    - corsika
Ralf Ulrich's avatar
ci  
Ralf Ulrich committed
335 336
  before_script:
    - apt-get -qq update && apt-get -qq install -y gdb
337 338
  script:
    - cd build
Ralf Ulrich's avatar
Ralf Ulrich committed
339
    - cmake --build . -- -j4
340
    - set -o pipefail
Ralf Ulrich's avatar
Ralf Ulrich committed
341
    - ctest -j4 -VV | gzip -v -9 > test.log.gz
342 343
    - make -j4 run_examples | gzip -v -9 > examples.log.gz
  rules:
Ralf Ulrich's avatar
Ralf Ulrich committed
344
    - if: '$CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/'
345 346
      when: manual
      allow_failure: true
347
    - if: $CI_COMMIT_BRANCH
348 349 350 351 352 353 354 355 356
    - if: $CI_MERGE_REQUEST_ID
    - if: $CI_COMMIT_TAG
      when: manual
      allow_failure: true
  artifacts:
    when: always
    expire_in: 3 days
    reports:
      junit:
Ralf Ulrich's avatar
Ralf Ulrich committed
357
        - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
358
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
359 360
      - ${CI_PROJECT_DIR}/build/examples.log.gz
      - ${CI_PROJECT_DIR}/build/test.log.gz
361
  cache:
362
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
363
      - ${CI_PROJECT_DIR}/build/
364 365 366 367
    untracked: true
    policy: pull

# build_test_example for gcc
368
build_test_example-u-18_04:
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387
  extends: .build_test_example
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  cache:
    key: "${CI_COMMIT_REF_SLUG}-gcc"

# build_test_example for clang
build_test_example-clang-8:
  extends: .build_test_example
  image: corsika/devel:clang-8
  dependencies:
    - config-clang-8
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"




388 389 390 391 392 393 394
####### INSTALL  ##############

##########################################################
# generic install template job
# make install
.install:
  stage: install
Ralf M Ulrich's avatar
Ralf M Ulrich committed
395 396 397 398 399
  tags:
    - corsika
  script:
    - cd build
    - set -o pipefail
Ralf Ulrich's avatar
Ralf Ulrich committed
400
    - make -j2 install
401
  rules:
Ralf Ulrich's avatar
Ralf Ulrich committed
402
    - if: $CI_MERGE_REQUEST_ID
403
      when: manual
404
    - if: $CI_COMMIT_TAG
Ralf Ulrich's avatar
Ralf Ulrich committed
405
      when: manual
406
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
407
    - if: $CI_COMMIT_BRANCH
408 409
      when: manual
  allow_failure: true
410
  cache:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
411
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
412
      - ${CI_PROJECT_DIR}/build/
413
    untracked: true
414
    policy: pull
Ralf M Ulrich's avatar
Ralf M Ulrich committed
415

416
# install for gcc
417
install-u-18_04:
418
  extends: .install
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
419 420
  image: corsika/devel:u-18.04
  dependencies:
421 422 423 424 425 426 427 428 429 430 431 432 433 434 435
    - build-u-18_04
  cache:
    key: "${CI_COMMIT_REF_SLUG}-gcc"

# install for clang
install-clang-8:
  extends: .install
  image: corsika/devel:clang-8
  dependencies:
    - build-clang-8
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"



436

437 438 439 440 441 442
####### OPTIONAL ##############

##########################################################
# generic release template job
# optional release pipeline for each commit
.release:
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
443
  stage: optional
444 445
  tags:
    - corsika
Ralf Ulrich's avatar
ci  
Ralf Ulrich committed
446 447
  before_script:
    - apt-get -qq update && apt-get -qq install -y gdb
448
  script:
449
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
450
    - cmake .. -DCMAKE_BUILD_TYPE=Release
451
    - cmake --build . -- -j4
452
    - set -o pipefail
453
    - ctest -j4 -VV | gzip -v -9 > test.log.gz
Ralf Ulrich's avatar
Ralf Ulrich committed
454
    - make -j4 run_examples | gzip -v -9 > examples.log.gz
455 456 457 458 459 460 461 462 463 464 465
  rules:
    - if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      when: manual
      allow_failure: true
    - if: $CI_MERGE_REQUEST_ID
      when: manual
      allow_failure: true
    - if: $CI_COMMIT_TAG
      when: manual
      allow_failure: true
466
  cache:
467
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
468
      - ${CI_PROJECT_DIR}/build/
469
    untracked: true
470
    policy: pull
471
  artifacts:
472
    when: always
473
    expire_in: 3 days
474 475
    reports:
      junit:
Ralf Ulrich's avatar
Ralf Ulrich committed
476
        - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
477
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
478 479
      - ${CI_PROJECT_DIR}/build/test.log.gz
      - ${CI_PROJECT_DIR}/build/examples.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
480

481 482 483 484 485 486 487 488 489 490
# release for gcc
release-full-u-18_04:
  extends: .release
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  cache:
    key: "${CI_COMMIT_REF_SLUG}-gcc"

# release for clang
491
release-full-clang-8:
492
  extends: .release
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
493 494 495
  image: corsika/devel:clang-8
  dependencies:
    - config-clang-8
496 497 498
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"

Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
499

500 501


502 503
##########################################################
# the coverage generation should either run when manually requested, OR always on the master
504

505
coverage:
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
506 507 508 509 510 511 512 513 514 515
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  stage: optional
  tags:
    - corsika
  script:
    - cd build
    - cmake .. -DCMAKE_BUILD_TYPE=Coverage
    - cmake --build . -- -j4
516
    - ctest -j4 -VV | gzip -v -9 > test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
517 518
    - cmake --build . --target coverage
    - tar czf coverage-report.tar.gz coverage-report
Ralf Ulrich's avatar
Ralf Ulrich committed
519
  coverage: '/^.*functions\.+:\s(.*\%)\s/'
520 521 522 523 524 525 526 527 528
  rules:
    - if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - if: $CI_MERGE_REQUEST_ID
      when: manual
      allow_failure: true
    - if: $CI_COMMIT_TAG
      when: manual
      allow_failure: true
529
  artifacts:
530
    when: always
531
    expire_in: 1 year
532
    paths:
533
      - ${CI_PROJECT_DIR}/build/test.log.gz
Ralf Ulrich's avatar
Ralf Ulrich committed
534
      - ${CI_PROJECT_DIR}/build/coverage-report.tar.gz
535
  cache:
536
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
537
      - ${CI_PROJECT_DIR}/build/
538
    untracked: true
539 540
    policy: pull
    key: "${CI_COMMIT_REF_SLUG}-gcc"
Ralf Ulrich's avatar
Ralf Ulrich committed
541

Ralf Ulrich's avatar
Ralf Ulrich committed
542

543 544


545
##########################################################
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
546 547 548
documentation:
  image: corsika/devel:u-18.04
  dependencies:
549
    - config-u-18_04
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
550
  stage: optional
Ralf Ulrich's avatar
Ralf Ulrich committed
551
  tags:
Lukas Nellen's avatar
Lukas Nellen committed
552
    - corsika
553
  script:
Ralf Ulrich's avatar
Ralf Ulrich committed
554
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
555
    - cmake --build . --target doxygen -- -j4
Ralf Ulrich's avatar
Ralf Ulrich committed
556
    - mkdir -p .public
557
    - cp -r Documentation/Doxygen/html .public/
Ralf Ulrich's avatar
Ralf Ulrich committed
558
    - mv .public ../public
559 560 561 562 563 564 565 566 567 568 569
  rules:
    - if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      when: manual
      allow_failure: true
    - if: $CI_MERGE_REQUEST_ID
      when: manual
      allow_failure: true
    - if: $CI_COMMIT_TAG
      when: manual
      allow_failure: true
570
  artifacts:
571
    expire_in: 3 weeks
572
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
573
      - ${CI_PROJECT_DIR}/public
574
  cache:
575
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
576
      - ${CI_PROJECT_DIR}/build/
577
    untracked: true
578 579 580
    policy: pull
    key: "${CI_COMMIT_REF_SLUG}-gcc"

Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
581

582

583
##########################################################
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
584 585 586 587 588 589 590 591 592 593 594
sanity:
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  stage: optional
  tags:
    - corsika
  script:
    - cd build
    - cmake .. -DWITH_CORSIKA_SANITIZERS_ENABLED=ON
    - cmake --build . -- -j4
595 596 597 598 599 600 601 602 603 604 605
  rules:
    - if: '$CI_MERGE_REQUEST_LABELS =~ /Ready for code review/' # run on merge requests, if label 'Ready for code review' is set
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
      when: manual
      allow_failure: true
    - if: $CI_MERGE_REQUEST_ID
      when: manual
      allow_failure: true
    - if: $CI_COMMIT_TAG
      when: manual
      allow_failure: true
606
  cache:
607
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
608
      - ${CI_PROJECT_DIR}/build/
609
    untracked: true
610 611
    policy: pull
    key: "${CI_COMMIT_REF_SLUG}-gcc"
Remy Prechelt's avatar
Remy Prechelt committed
612 613 614 615 616 617 618 619 620 621 622 623 624



##########################################################
# template for all Python jobs
.python:
  stage: python
  tags:
    - corsika
  script:
    - cd ${CI_PROJECT_DIR}/Python  # change into the Python directory
    - pip install --user -e '.[test]'  # install the package + test deps
    - make all 2&>1 | tee python-test.log  # this runs all of the Python tests
Ralf Ulrich's avatar
Ralf Ulrich committed
625 626
    - echo "finished" >> python-test.log # create even an empty file...
    - cd ${CI_PROJECT_DIR}  # reset the directory    
Remy Prechelt's avatar
Remy Prechelt committed
627 628 629 630 631
  artifacts:
    when: always
    expire_in: 1 year
    paths:
      - ${CI_PROJECT_DIR}/Python/python-test.log
Ralf Ulrich's avatar
Ralf Ulrich committed
632
  allow_failure: true
Remy Prechelt's avatar
Remy Prechelt committed
633 634 635 636 637 638 639 640 641 642 643 644 645 646

# we now configure the jobs for the three
# supported Python versions
python-3.6:
  extends: .python
  image: python:3.6

python-3.7:
  extends: .python
  image: python:3.7

python-3.8:
  extends: .python
  image: python:3.8