IAP GITLAB

.gitlab-ci.yml 13.9 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
Ralf Ulrich's avatar
Ralf Ulrich committed
173
    - ctest -j4 
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
188
  cache:
189
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
190
      - ${CI_PROJECT_DIR}/build/
191 192
    untracked: true
    policy: pull-push
Ralf M Ulrich's avatar
Ralf M Ulrich committed
193

194 195 196
# test for gcc
test-u-18_04:
  extends: .test
Ralf M Ulrich's avatar
Ralf M Ulrich committed
197 198 199
  image: corsika/devel:u-18.04
  dependencies:
    - build-u-18_04
200 201 202 203 204 205 206 207 208 209 210 211 212 213
  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"



214

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

##########################################################
# 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
Ralf Ulrich's avatar
Ralf Ulrich committed
228
    - ctest -j4 
229
  rules:
Ralf Ulrich's avatar
Ralf Ulrich committed
230
    - if: '$CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/'
Ralf M Ulrich's avatar
failure  
Ralf M Ulrich committed
231
      allow_failure: false
232 233 234 235 236 237 238 239 240
    - 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
241
        - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
242
  cache:
243
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
244
      - ${CI_PROJECT_DIR}/build/
245 246 247 248 249 250 251 252 253 254 255 256 257
    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
258
build_test-clang-8:
259 260 261 262 263 264 265 266 267 268
  extends: .build_test
  image: corsika/devel:clang-8
  dependencies:
    - config-clang-8
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"



####### EXAMPLE (only manual)  ##############
269 270 271 272 273

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

302
# example for gcc
303
example-u-18_04:
304 305 306 307 308 309 310 311 312 313
  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
314 315 316
  image: corsika/devel:clang-8
  dependencies:
    - build-clang-8
317 318 319 320
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"


321

Ralf Ulrich's avatar
Ralf Ulrich committed
322
####### BUILD-TEST-EXAMPLE (only non-Draft)  ##############
323 324 325 326 327 328 329 330

##########################################################
# 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
331 332
  before_script:
    - apt-get -qq update && apt-get -qq install -y gdb
333 334
  script:
    - cd build
Ralf Ulrich's avatar
Ralf Ulrich committed
335
    - cmake --build . -- -j4
336
    - set -o pipefail
Ralf Ulrich's avatar
Ralf Ulrich committed
337
    - ctest -j4 
338 339
    - make -j4 run_examples | gzip -v -9 > examples.log.gz
  rules:
Ralf Ulrich's avatar
Ralf Ulrich committed
340
    - if: '$CI_MERGE_REQUEST_ID && $CI_MERGE_REQUEST_TITLE =~ /^Draft:/'
341 342
      when: manual
      allow_failure: true
343
    - if: $CI_COMMIT_BRANCH
344 345 346 347 348 349 350 351 352
    - 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
353
        - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
354
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
355
      - ${CI_PROJECT_DIR}/build/examples.log.gz
356
  cache:
357
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
358
      - ${CI_PROJECT_DIR}/build/
359 360 361 362
    untracked: true
    policy: pull

# build_test_example for gcc
363
build_test_example-u-18_04:
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382
  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"




383 384 385 386 387 388 389
####### INSTALL  ##############

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

411
# install for gcc
412
install-u-18_04:
413
  extends: .install
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
414 415
  image: corsika/devel:u-18.04
  dependencies:
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
    - 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"



431

432 433 434 435 436 437
####### OPTIONAL ##############

##########################################################
# generic release template job
# optional release pipeline for each commit
.release:
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
438
  stage: optional
439 440
  tags:
    - corsika
Ralf Ulrich's avatar
ci  
Ralf Ulrich committed
441 442
  before_script:
    - apt-get -qq update && apt-get -qq install -y gdb
443
  script:
444
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
445
    - cmake .. -DCMAKE_BUILD_TYPE=Release
446
    - cmake --build . -- -j4
447
    - set -o pipefail
Ralf Ulrich's avatar
Ralf Ulrich committed
448
    - ctest -j4 
Ralf Ulrich's avatar
Ralf Ulrich committed
449
    - make -j4 run_examples | gzip -v -9 > examples.log.gz
450 451 452 453 454 455 456 457 458 459 460
  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
461
  cache:
462
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
463
      - ${CI_PROJECT_DIR}/build/
464
    untracked: true
465
    policy: pull
466
  artifacts:
467
    when: always
468
    expire_in: 3 days
469 470
    reports:
      junit:
Ralf Ulrich's avatar
Ralf Ulrich committed
471
        - ${CI_PROJECT_DIR}/build/test_outputs/junit*.xml
472
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
473
      - ${CI_PROJECT_DIR}/build/examples.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
474

475 476 477 478 479 480 481 482 483 484
# 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
485
release-full-clang-8:
486
  extends: .release
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
487 488 489
  image: corsika/devel:clang-8
  dependencies:
    - config-clang-8
490 491 492
  cache:
    key: "${CI_COMMIT_REF_SLUG}-clang"

Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
493

494 495


496 497
##########################################################
# the coverage generation should either run when manually requested, OR always on the master
498

499
coverage:
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
500 501 502 503 504 505 506 507 508 509
  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
Ralf Ulrich's avatar
Ralf Ulrich committed
510
    - ctest -j4 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
511 512
    - cmake --build . --target coverage
    - tar czf coverage-report.tar.gz coverage-report
Ralf Ulrich's avatar
Ralf Ulrich committed
513
  coverage: '/^.*functions\.+:\s(.*\%)\s/'
514 515 516 517 518 519 520 521 522
  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
523
  artifacts:
524
    when: always
525
    expire_in: 1 year
526
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
527
      - ${CI_PROJECT_DIR}/build/coverage-report.tar.gz
528
  cache:
529
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
530
      - ${CI_PROJECT_DIR}/build/
531
    untracked: true
532 533
    policy: pull
    key: "${CI_COMMIT_REF_SLUG}-gcc"
Ralf Ulrich's avatar
Ralf Ulrich committed
534

Ralf Ulrich's avatar
Ralf Ulrich committed
535

536 537


538
##########################################################
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
539 540 541
documentation:
  image: corsika/devel:u-18.04
  dependencies:
542
    - config-u-18_04
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
543
  stage: optional
Ralf Ulrich's avatar
Ralf Ulrich committed
544
  tags:
Lukas Nellen's avatar
Lukas Nellen committed
545
    - corsika
546
  script:
Ralf Ulrich's avatar
Ralf Ulrich committed
547
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
548
    - cmake --build . --target doxygen -- -j4
Ralf Ulrich's avatar
Ralf Ulrich committed
549
    - mkdir -p .public
550
    - cp -r Documentation/Doxygen/html .public/
Ralf Ulrich's avatar
Ralf Ulrich committed
551
    - mv .public ../public
552 553 554 555 556 557 558 559 560 561 562
  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
563
  artifacts:
564
    expire_in: 3 weeks
565
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
566
      - ${CI_PROJECT_DIR}/public
567
  cache:
568
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
569
      - ${CI_PROJECT_DIR}/build/
570
    untracked: true
571 572 573
    policy: pull
    key: "${CI_COMMIT_REF_SLUG}-gcc"

Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
574

575

576
##########################################################
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
577 578 579 580 581 582 583 584 585 586 587
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
588 589 590 591 592 593 594 595 596 597 598
  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
599
  cache:
600
    paths:
Ralf Ulrich's avatar
Ralf Ulrich committed
601
      - ${CI_PROJECT_DIR}/build/
602
    untracked: true
603 604
    policy: pull
    key: "${CI_COMMIT_REF_SLUG}-gcc"
Remy Prechelt's avatar
Remy Prechelt committed
605 606 607 608 609 610 611 612 613 614 615 616 617



##########################################################
# 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
618 619
    - echo "finished" >> python-test.log # create even an empty file...
    - cd ${CI_PROJECT_DIR}  # reset the directory    
Remy Prechelt's avatar
Remy Prechelt committed
620 621 622 623 624
  artifacts:
    when: always
    expire_in: 1 year
    paths:
      - ${CI_PROJECT_DIR}/Python/python-test.log
Ralf Ulrich's avatar
Ralf Ulrich committed
625
  allow_failure: true
Remy Prechelt's avatar
Remy Prechelt committed
626 627 628 629 630 631 632 633 634 635 636 637 638 639

# 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