IAP GITLAB

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

# 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
  script:
Ralf Ulrich's avatar
Ralf Ulrich committed
45
    - git clone https://gitlab.ikp.kit.edu/AirShowerPhysics/corsika-data.git
46 47
    - mkdir build
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
48 49 50 51 52
    - cmake .. -DCMAKE_BUILD_TYPE=Debug -DWITH_PYTHIA=ON
  artifacts:
    expire_in: 1 day
    paths:
       - build
Ralf Ulrich's avatar
ci  
Ralf Ulrich committed
53
       - corsika-data
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
54

Ralf M Ulrich's avatar
quality  
Ralf M Ulrich committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
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
73
# normal pipeline for each commit
Ralf Ulrich's avatar
Ralf Ulrich committed
74
build-test-u-18_04: 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
75 76 77
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
78
  stage: build_test
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
79 80
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
81 82
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
83 84
  script:
    - cd build
85
    - cmake --build . -- -j4
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
86 87 88
    - set -o pipefail
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
89
    when: always
90
    expire_in: 1 week
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
91 92 93
    reports:
      junit:
        - build/test_outputs/junit*.xml
94 95
    paths:
      - build/test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
96

97
# normal pipeline for each commit
Ralf Ulrich's avatar
Ralf Ulrich committed
98
build-test-clang-8: 
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
99 100
  image: corsika/devel:clang-8
  dependencies:
101 102
    - config-clang-8
  stage: build_test
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
103 104
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
105 106
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
107 108
  script:
    - cd build
109 110
    - cmake --build . -- -j4
    - set -o pipefail
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
111 112
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
113
    when: always
114
    expire_in: 1 week
115 116 117
    reports:
      junit:
        - build/test_outputs/junit*.xml
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
118 119
    paths:
      - build/test.log.gz
120 121
 
# optional release pipeline for each commit
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
122 123 124 125 126
release-u-18_04: 
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  stage: optional
127 128
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
129 130
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
131
  script:
132
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
133
    - cmake .. -DCMAKE_BUILD_TYPE=Release
134
    - cmake --build . -- -j4
135 136 137
    - set -o pipefail
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
138
    when: always
139 140 141 142 143 144
    expire_in: 1 week
    reports:
      junit:
        - build/test_outputs/junit*.xml
    paths:
      - build/test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
145 146
  when: manual    

147
# optional release pipeline for each commit
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
148 149 150 151 152 153 154
release-clang-8: 
  image: corsika/devel:clang-8
  dependencies:
    - config-clang-8
  stage: optional
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
155 156
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
157 158 159 160
  script:
    - cd build
    - cmake .. -DCMAKE_BUILD_TYPE=Release
    - cmake --build . -- -j4
161 162 163
    - set -o pipefail
    - ctest -VV | gzip -v -9 > test.log.gz 
  artifacts:
164
    when: always
165 166 167 168 169 170
    expire_in: 1 week
    reports:
      junit:
        - build/test_outputs/junit*.xml
    paths:
      - build/test.log.gz
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
171 172
  when: manual    

Ralf Ulrich's avatar
Ralf Ulrich committed
173 174
# 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
175 176 177 178 179 180
  image: corsika/devel:u-18.04
  dependencies:
    - config-u-18_04
  stage: optional
  tags:
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
181 182
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
183 184 185 186 187 188 189
  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
190
  coverage: '/^.*functions\.+:\s(.*\%)\s/'
191
  artifacts:
192
    expire_in: 1 year
193
    paths:
194
      - build/coverage-report.tar.gz
Ralf Ulrich's avatar
Ralf Ulrich committed
195

Ralf Ulrich's avatar
Ralf Ulrich committed
196
coverage: # special manual job to run after normal pipeline on branch finished 
Ralf Ulrich's avatar
Ralf Ulrich committed
197
  <<: *coverage_job
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
198
  when: manual    
Ralf Ulrich's avatar
Ralf Ulrich committed
199 200 201
  except:
    refs:
      - master
Ralf Ulrich's avatar
Ralf Ulrich committed
202 203 204 205 206 207

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

Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
209 210 211
documentation:
  image: corsika/devel:u-18.04
  dependencies:
212
    - config-u-18_04
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
213
  stage: optional
Ralf Ulrich's avatar
Ralf Ulrich committed
214
  tags:
Lukas Nellen's avatar
Lukas Nellen committed
215
    - corsika
Ralf Ulrich's avatar
Ralf Ulrich committed
216 217
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
218
  script:
Ralf Ulrich's avatar
Ralf Ulrich committed
219
    - cd build
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
220
    - cmake --build . --target doxygen -- -j4
221 222
    - mkdir .public
    - cp -r Documentation/Doxygen/html .public/
Ralf Ulrich's avatar
Ralf Ulrich committed
223
    - mv .public ../public
224
  artifacts:
225
    expire_in: 3 weeks
226 227
    paths:
      - public
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
228 229 230 231 232 233 234 235 236 237
  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
238 239
  variables:
    CORSIKA_DATA: "${CI_PROJECT_DIR}/corsika-data/"
Ralf Ulrich's avatar
CI  
Ralf Ulrich committed
240 241 242 243 244 245 246
  script:
    - cd build
    - cmake .. -DWITH_CORSIKA_SANITIZERS_ENABLED=ON
    - cmake --build . -- -j4
  when: manual
  allow_failure: true