IAP GITLAB

.gitlab-ci.yml 7.32 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 Ulrich's avatar
CI  
Ralf Ulrich committed
16 17 18 19 20 21 22 23
  - 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
24 25
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
26
  script:
Ralf Ulrich's avatar
Ralf Ulrich committed
27
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git    
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
28 29 30 31 32 33 34
    - 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
35
       - corsika-data
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
36 37 38 39 40

# job/stage to just prepare cmake
config-clang-8:
  image: corsika/devel:clang-8
  stage: config
41 42
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
43 44
  variables:
    CORSIKA_DATA: "${CI_BUILDS_DIR}/AirShowerPhysics/corsika/corsika-data/"
45 46 47
  script:
    - mkdir build
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
48 49 50 51 52 53
    - 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
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
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
72
# normal pipeline for each commit
Ralf M Ulrich's avatar
Ralf M Ulrich committed
73
build-u-18_04: 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
74 75 76
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
Ralf M Ulrich's avatar
Ralf M Ulrich committed
77
  stage: build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
78 79
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
80 81
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
82 83
  script:
    - cd build
84
    - cmake --build . -- -j4
Ralf M Ulrich's avatar
Ralf M Ulrich committed
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 121
  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
122 123 124
    - set -o pipefail
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
125
    when: always
126
    expire_in: 1 week
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
127 128 129
    reports:
      junit:
        - build/test_outputs/junit*.xml
130 131
    paths:
      - build/test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
132

133
# normal pipeline for each commit
Ralf M Ulrich's avatar
Ralf M Ulrich committed
134
test-clang-8: 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
135 136
  image: corsika/devel:clang-8
  dependencies:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
137 138
    - build-clang-8
  stage: test
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
139 140
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
141 142
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
143
  script:
Ralf M Ulrich's avatar
Ralf M Ulrich committed
144
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
145
    - cd build
146
    - set -o pipefail
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
147 148
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
149
    when: always
150
    expire_in: 1 week
151 152 153
    reports:
      junit:
        - build/test_outputs/junit*.xml
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
154 155
    paths:
      - build/test.log.gz
Ralf M Ulrich's avatar
Ralf M Ulrich committed
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204

# 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
    - make run_examples
  artifacts:
    when: always
    expire_in: 1 week
    reports:
      junit:
        - build/example_outputs/junit*.xml
    paths:
      - build/example.log.gz

# 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
    - make run_examples
  artifacts:
    when: always
    expire_in: 1 week
    reports:
      junit:
        - build/example_outputs/junit*.xml
    paths:
      - build/example.log.gz

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

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

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

Ralf Ulrich's avatar
Ralf Ulrich committed
284
coverage: # special manual job to run after normal pipeline on branch finished 
Ralf Ulrich's avatar
Ralf Ulrich committed
285
  <<: *coverage_job
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
286
  when: manual    
Ralf Ulrich's avatar
Ralf Ulrich committed
287 288 289
  except:
    refs:
      - master
Ralf Ulrich's avatar
Ralf Ulrich committed
290 291 292 293 294 295

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

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