IAP GITLAB

.gitlab-ci.yml 7.16 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
Ralf M Ulrich's avatar
quality  
Ralf M Ulrich committed
13
  - quality
Ralf M Ulrich's avatar
Ralf M Ulrich committed
14 15
  - build
  - test
Ralf M Ulrich's avatar
Ralf M Ulrich committed
16
  - example
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
17 18 19 20 21 22 23 24
  - 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
25 26
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
27 28 29 30 31 32 33 34 35 36 37 38 39
  script:
    - mkdir build
    - cd build
    - cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON
  artifacts:
    expire_in: 1 day
    paths:
       - build

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

Ralf M Ulrich's avatar
quality  
Ralf M Ulrich committed
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
check-copyrights:
  image: corsika/devel:u-18.04
  stage: quality
  tags:
    - corsika
  script:
    - ./do-copyright.py

check-clang-format:
  image: corsika/devel:u-18.04
  before_script:
  - apt-get update && apt-get install -y -qq clang-format
  stage: quality
  tags:
    - corsika
  script:
    - ./do-clang-format.py --all

Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
71
# normal pipeline for each commit
Ralf M Ulrich's avatar
Ralf M Ulrich committed
72
build-u-18_04: 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
73 74 75
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
Ralf M Ulrich's avatar
Ralf M Ulrich committed
76
  stage: build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
77 78
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
79 80
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
81 82
  script:
    - cd build
83
    - cmake --build . -- -j4
Ralf M Ulrich's avatar
Ralf M Ulrich committed
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
  artifacts:
    expire_in: 1 hour
    paths:
      - build

# normal pipeline for each commit
build-clang-8: 
  image: corsika/devel:clang-8
  dependencies:
    - config-clang-8
  stage: build
  tags:
    - corsika
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
  script:
    - cd build
    - cmake --build . -- -j4
  artifacts:
    expire_in: 1 hour
    reports:
    paths:
      - build

# normal pipeline for each commit
test-u-18_04: 
  image: corsika/devel:u-18.04
  dependencies:
    - build-u-18_04
  stage: test
  tags:
    - corsika
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
  script:
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
121 122 123
    - set -o pipefail
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
124
    when: always
125
    expire_in: 1 week
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
126 127 128
    reports:
      junit:
        - build/test_outputs/junit*.xml
129 130
    paths:
      - build/test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
131

132
# normal pipeline for each commit
Ralf M Ulrich's avatar
Ralf M Ulrich committed
133
test-clang-8: 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
134 135
  image: corsika/devel:clang-8
  dependencies:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
136 137
    - build-clang-8
  stage: test
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
138 139
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
140 141
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
142
  script:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
143
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
144
    - cd build
145
    - set -o pipefail
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
146 147
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
148
    when: always
149
    expire_in: 1 week
150 151 152
    reports:
      junit:
        - build/test_outputs/junit*.xml
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
153 154
    paths:
      - build/test.log.gz
Ralf M Ulrich's avatar
Ralf M Ulrich committed
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169

# normal pipeline for each commit
example-u-18_04: 
  image: corsika/devel:u-18.04
  dependencies:
    - build-u-18_04
  stage: example
  tags:
    - corsika
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
  script:
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
    - cd build
    - set -o pipefail
Ralf M Ulrich's avatar
Ralf M Ulrich committed
170
    - make run_examples | gzip -v -9 > examples.log.gz
Ralf M Ulrich's avatar
Ralf M Ulrich committed
171 172 173 174
  artifacts:
    when: always
    expire_in: 1 week
    paths:
Ralf M Ulrich's avatar
typo  
Ralf M Ulrich committed
175
      - build/examples.log.gz
Ralf M Ulrich's avatar
Ralf M Ulrich committed
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190

# normal pipeline for each commit
example-clang-8: 
  image: corsika/devel:clang-8
  dependencies:
    - build-clang-8
  stage: example
  tags:
    - corsika
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
  script:
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
    - cd build
    - set -o pipefail
Ralf M Ulrich's avatar
Ralf M Ulrich committed
191
    - make run_examples | gzip -v -9 > examples.log.gz
Ralf M Ulrich's avatar
Ralf M Ulrich committed
192 193 194 195
  artifacts:
    when: always
    expire_in: 1 week
    paths:
Ralf M Ulrich's avatar
typo  
Ralf M Ulrich committed
196
      - build/examples.log.gz
Ralf M Ulrich's avatar
Ralf M Ulrich committed
197

198
# optional release pipeline for each commit
Ralf M Ulrich's avatar
Ralf M Ulrich committed
199
release-full-u-18_04: 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
200 201 202 203
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  stage: optional
204 205
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
206 207
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
208
  script:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
209
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
210
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
211
    - cmake .. -DCMAKE_BUILD_TYPE=Release
212
    - cmake --build . -- -j4
213 214
    - set -o pipefail
    - ctest -VV | gzip -v -9 > test.log.gz 
Ralf M Ulrich's avatar
Ralf M Ulrich committed
215
    - make run_examples
216
  artifacts:
217
    when: always
218 219 220 221 222 223
    expire_in: 1 week
    reports:
      junit:
        - build/test_outputs/junit*.xml
    paths:
      - build/test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
224 225
  when: manual    

226
# optional release pipeline for each commit
Ralf M Ulrich's avatar
Ralf M Ulrich committed
227
release-full-clang-8: 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
228 229 230 231 232 233
  image: corsika/devel:clang-8
  dependencies:
    - config-clang-8
  stage: optional
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
234 235
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
236
  script:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
237
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
238 239 240
    - cd build
    - cmake .. -DCMAKE_BUILD_TYPE=Release
    - cmake --build . -- -j4
241
    - set -o pipefail
Ralf M Ulrich's avatar
Ralf M Ulrich committed
242 243
    - ctest -VV | gzip -v -9 > test.log.gz
    - make run_examples
244
  artifacts:
245
    when: always
246 247 248 249 250 251
    expire_in: 1 week
    reports:
      junit:
        - build/test_outputs/junit*.xml
    paths:
      - build/test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
252 253
  when: manual    

Ralf Ulrich's avatar
Ralf Ulrich committed
254 255
# 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
256 257 258 259 260 261
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  stage: optional
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
262 263
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
264 265 266 267 268 269 270
  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
271
  coverage: '/^.*functions\.+:\s(.*\%)\s/'
272
  artifacts:
273
    expire_in: 1 year
274
    paths:
275
      - build/coverage-report.tar.gz
Ralf Ulrich's avatar
Ralf Ulrich committed
276

Ralf Ulrich's avatar
Ralf Ulrich committed
277
coverage: # special manual job to run after normal pipeline on branch finished 
Ralf Ulrich's avatar
Ralf Ulrich committed
278
  <<: *coverage_job
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
279
  when: manual    
Ralf Ulrich's avatar
Ralf Ulrich committed
280 281 282
  except:
    refs:
      - master
Ralf Ulrich's avatar
Ralf Ulrich committed
283 284 285 286 287 288

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

Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
290 291 292
documentation:
  image: corsika/devel:u-18.04
  dependencies:
293
    - config-u-18_04
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
294
  stage: optional
Ralf Ulrich's avatar
Ralf Ulrich committed
295
  tags:
Lukas Nellen's avatar
Lukas Nellen committed
296
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
297 298
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
299
  script:
Ralf Ulrich's avatar
Ralf Ulrich committed
300
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
301
    - cmake --build . --target doxygen -- -j4
302 303
    - mkdir .public
    - cp -r Documentation/Doxygen/html .public/
Ralf Ulrich's avatar
Ralf Ulrich committed
304
    - mv .public ../public
305
  artifacts:
306
    expire_in: 3 weeks
307 308
    paths:
      - public
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
309 310 311 312 313 314 315 316 317 318
  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
319 320
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
321 322 323 324 325 326 327
  script:
    - cd build
    - cmake .. -DWITH_CORSIKA_SANITIZERS_ENABLED=ON
    - cmake --build . -- -j4
  when: manual
  allow_failure: true