IAP GITLAB

.gitlab-ci.yml 5.42 KB
Newer Older
Ralf Ulrich's avatar
Ralf Ulrich committed
1 2
variables:
  GIT_SSL_NO_VERIFY: "1"
3 4 5 6 7 8
  ## 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"
Ralf Ulrich's avatar
Ralf Ulrich committed
9

Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
10 11 12
# normal multi-step pipeline for each commit
stages:
  - config
13
  - build_test
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
14 15 16 17 18 19 20 21
  - optional

# job/stage to just prepare cmake
config-u-18_04:
  image: corsika/devel:u-18.04
  stage: config
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
22 23
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
24
  script:
Ralf Ulrich's avatar
Ralf Ulrich committed
25
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git    
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
26 27 28 29 30 31 32
    - mkdir build
    - cd build
    - cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON
  artifacts:
    expire_in: 1 day
    paths:
       - build
Ralf Ulrich's avatar
ci  
Ralf Ulrich committed
33
       - corsika-data
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
34 35 36 37 38

# job/stage to just prepare cmake
config-clang-8:
  image: corsika/devel:clang-8
  stage: config
39 40
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
41 42
  variables:
    CORSIKA_DATA: "${CI_BUILDS_DIR}/AirShowerPhysics/corsika/corsika-data/"
43
  script:
Ralf Ulrich's avatar
Ralf Ulrich committed
44
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
45 46
    - mkdir build
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
47 48 49 50 51
    - cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON
  artifacts:
    expire_in: 1 day
    paths:
       - build
Ralf Ulrich's avatar
ci  
Ralf Ulrich committed
52
       - corsika-data
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
53 54

# normal pipeline for each commit
Ralf Ulrich's avatar
Ralf Ulrich committed
55
build-test-u-18_04: 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
56 57 58
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
59
  stage: build_test
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
60 61
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
62 63
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
64 65
  script:
    - cd build
66
    - cmake --build . -- -j4
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
67 68 69
    - set -o pipefail
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
70
    when: always
71
    expire_in: 1 week
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
72 73 74
    reports:
      junit:
        - build/test_outputs/junit*.xml
75 76
    paths:
      - build/test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
77

78
# normal pipeline for each commit
Ralf Ulrich's avatar
Ralf Ulrich committed
79
build-test-clang-8: 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
80 81
  image: corsika/devel:clang-8
  dependencies:
82 83
    - config-clang-8
  stage: build_test
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
84 85
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
86 87
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
88 89
  script:
    - cd build
90 91
    - cmake --build . -- -j4
    - set -o pipefail
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
92 93
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
94
    when: always
95
    expire_in: 1 week
96 97 98
    reports:
      junit:
        - build/test_outputs/junit*.xml
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
99 100
    paths:
      - build/test.log.gz
101 102
 
# optional release pipeline for each commit
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
103 104 105 106 107
release-u-18_04: 
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  stage: optional
108 109
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
110 111
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
112
  script:
113
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
114
    - cmake .. -DCMAKE_BUILD_TYPE=Release
115
    - cmake --build . -- -j4
116 117 118
    - set -o pipefail
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
119
    when: always
120 121 122 123 124 125
    expire_in: 1 week
    reports:
      junit:
        - build/test_outputs/junit*.xml
    paths:
      - build/test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
126 127
  when: manual    

128
# optional release pipeline for each commit
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
129 130 131 132 133 134 135
release-clang-8: 
  image: corsika/devel:clang-8
  dependencies:
    - config-clang-8
  stage: optional
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
136 137
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
138 139 140 141
  script:
    - cd build
    - cmake .. -DCMAKE_BUILD_TYPE=Release
    - cmake --build . -- -j4
142 143 144
    - set -o pipefail
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
145
    when: always
146 147 148 149 150 151
    expire_in: 1 week
    reports:
      junit:
        - build/test_outputs/junit*.xml
    paths:
      - build/test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
152 153
  when: manual    

Ralf Ulrich's avatar
Ralf Ulrich committed
154 155
# the coverage generation should either run when manually requested, OR for all changes on the master
.coverage_job: &coverage_job
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
156 157 158 159 160 161
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  stage: optional
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
162 163
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
164 165 166 167 168 169 170
  script:
    - cd build
    - cmake .. -DCMAKE_BUILD_TYPE=Coverage
    - cmake --build . -- -j4
    - ctest -j4 -V > test.log 
    - cmake --build . --target coverage
    - tar czf coverage-report.tar.gz coverage-report
Ralf Ulrich's avatar
Ralf Ulrich committed
171
  coverage: '/^.*functions\.+:\s(.*\%)\s/'
172
  artifacts:
173
    expire_in: 1 year
174
    paths:
175
      - build/coverage-report.tar.gz
Ralf Ulrich's avatar
Ralf Ulrich committed
176

Ralf Ulrich's avatar
Ralf Ulrich committed
177
coverage: # special manual job to run after normal pipeline on branch finished 
Ralf Ulrich's avatar
Ralf Ulrich committed
178
  <<: *coverage_job
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
179
  when: manual    
Ralf Ulrich's avatar
Ralf Ulrich committed
180 181 182
  except:
    refs:
      - master
Ralf Ulrich's avatar
Ralf Ulrich committed
183 184 185 186 187 188

coverage_master: # special job to run on master banch changes
  <<: *coverage_job
  only:
    refs:
      - master
Ralf Ulrich's avatar
Ralf Ulrich committed
189

Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
190 191 192
documentation:
  image: corsika/devel:u-18.04
  dependencies:
193
    - config-u-18_04
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
194
  stage: optional
Ralf Ulrich's avatar
Ralf Ulrich committed
195
  tags:
Lukas Nellen's avatar
Lukas Nellen committed
196
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
197 198
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
199
  script:
Ralf Ulrich's avatar
Ralf Ulrich committed
200
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
201
    - cmake --build . --target doxygen -- -j4
202 203
    - mkdir .public
    - cp -r Documentation/Doxygen/html .public/
Ralf Ulrich's avatar
Ralf Ulrich committed
204
    - mv .public ../public
205
  artifacts:
206
    expire_in: 3 weeks
207 208
    paths:
      - public
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
209 210 211 212 213 214 215 216 217 218
  when: manual
  allow_failure: true

sanity:
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  stage: optional
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
219 220
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
221 222 223 224 225 226 227
  script:
    - cd build
    - cmake .. -DWITH_CORSIKA_SANITIZERS_ENABLED=ON
    - cmake --build . -- -j4
  when: manual
  allow_failure: true

Ralf M Ulrich's avatar
Ralf M Ulrich committed
228 229 230 231 232 233 234 235
check-copyrights:
  image: corsika/devel:u-18.04
  stage: optional
  tags:
    - corsika
  script:
    - ./do-copyright.py

Ralf M Ulrich's avatar
format  
Ralf M Ulrich committed
236
check-clang-format:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
237
  image: corsika/devel:u-18.04
Ralf M Ulrich's avatar
format  
Ralf M Ulrich committed
238 239
  before_script:
  - apt-get update && apt-get install -y -qq clang-format
Ralf M Ulrich's avatar
Ralf M Ulrich committed
240 241 242 243 244
  stage: optional
  tags:
    - corsika
  script:
    - ./do-clang-format.py --all