.gitlab-ci.yml 11 KB
Newer Older
Tobias Lasser's avatar
Tobias Lasser committed
1
stages:
Jens Petit's avatar
Jens Petit committed
2
- static-test
Tobias Lasser's avatar
Tobias Lasser committed
3 4
- compile
- test
5
- sanitizer
6
- coverage
Tobias Lasser's avatar
Tobias Lasser committed
7
- docs
David Frank's avatar
David Frank committed
8
- docker
Tobias Lasser's avatar
Tobias Lasser committed
9

10 11 12
### variables ###

variables:
13
  CLANG_FORMAT_IMAGE: "elsa/clang-format:10"
14 15 16 17
  CLANG_TIDY_IMAGE: "elsa/clang-tidy:8"
  GCC_IMAGE: "elsa/gcc-pybinds:10"
  CLANG9_IMAGE: "elsa/clang-pybinds:9"
  CLANG10_IMAGE: "elsa/clang-pybinds:10"
18
  CUDA_IMAGE: "elsa/cuda:10.2"
19 20 21
  UBUNTU_IMAGE: "elsa/ubuntu:20.04"
  GPU_ONLY_IMAGE: "elsa/cuda-clang:10.0"
  COVERAGE_IMAGE: "elsa/coverage:10.2"
22

23 24 25 26 27 28
### Cache setup ###

# Caches should only be used for caching
# between pipelines not jobs, artifacts should be prefered for that
cache:
  paths:
29
    - build/_deps/*
30

Tobias Lasser's avatar
Tobias Lasser committed
31 32
### job templates ###

David Frank's avatar
David Frank committed
33 34 35
#### Schedule jobs ####

# run job only only on schedules
David Frank's avatar
David Frank committed
36
.job_template: &nightly_job
37 38
  rules:
    - if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "schedule"'
David Frank's avatar
David Frank committed
39

40
# run job if connected to a schedule, merge request or some other things
41
.job_template: &run_on_merge_requests
42 43
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
44
    - if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "schedule"'
45
    - when: never
46 47 48

# always run this job
.job_template: &run_always
49 50
  rules:
    - when: always
51

David Frank's avatar
David Frank committed
52
#### Build job templates ####
David Frank's avatar
David Frank committed
53

Tobias Lasser's avatar
Tobias Lasser committed
54
.job_template: &build_job_artifact
David Frank's avatar
David Frank committed
55
  <<: *run_always
Tobias Lasser's avatar
Tobias Lasser committed
56 57 58 59
  stage: compile
  artifacts:
    name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
    paths:
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
      # The actual build artifacts
      - build/bin
      - build/lib
      - build/pyelsa/
      - build/elsa/elsaConfig.cmake
      - build/elsa/elsaConfigVersion.cmake

      # If we ever generate headers, store them as well
      - build/elsa/**/*.h

      # CTest files
      - build/**/CTestTestfile.cmake
      - build/**/tests/test_*include-*.cmake
      - build/**/tests/test_*tests-*.cmake
      - build/Testing

      # Add elsa install to artifact 
      - install-elsa/include/elsa/**/*.h
      - install-elsa/include/elsa/**/*.hpp
      - install-elsa/include/elsa/**/*.cuh
      - install-elsa/lib/cmake/elsa/**/*.cmake
      - install-elsa/lib/libelsa*.a
      # Add quickvec install to artifact 
      - install-elsa/include/Quickvec/**/*.h
      - install-elsa/include/Quickvec/**/*.hpp
      - install-elsa/lib/cmake/Quickvec/*.cmake
      - install-elsa/lib/libquickvec.a
      # Add doctest install to artifact 
      - install-elsa/include/doctest/**/*.h
      - install-elsa/lib/cmake/doctest/**/*.cmake
      # Add spdlog install to artifact 
      - install-elsa/include/spdlog/**/*.h
      - install-elsa/lib/cmake/spdlog/**/*.cmake
      - install-elsa/lib/libspdlog.a
      - install-elsa/lib/pkgconfig/spdlog.pc
    exclude:
      - build/_deps/*
97
    expire_in: 60 mins
98

Tobias Lasser's avatar
Tobias Lasser committed
99 100 101 102
.buildjob_script_clang:
  script: &buildjob_clang
    - mkdir -p build
    - cd build
103
    - cmake .. -GNinja -DELSA_BENCHMARKS=ON -DELSA_CREATE_JUNIT_REPORTS=ON -DCMAKE_INSTALL_PREFIX="../install-elsa" -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
104
    - ninja
105
    - ninja build-tests
David Frank's avatar
David Frank committed
106 107
    - ninja build-benchmarks
    - ninja build-examples
108
    - ninja install
Tobias Lasser's avatar
Tobias Lasser committed
109 110 111 112 113

.buildjob_script_normal:
  script: &buildjob_normal
    - mkdir -p build
    - cd build
114
    - cmake .. -GNinja -DELSA_BENCHMARKS=ON -DELSA_CREATE_JUNIT_REPORTS=ON -DCMAKE_INSTALL_PREFIX="../install-elsa"
115
    - ninja
116
    - ninja build-tests
David Frank's avatar
David Frank committed
117 118
    - ninja build-benchmarks
    - ninja build-examples
119
    - ninja install
Tobias Lasser's avatar
Tobias Lasser committed
120

David Frank's avatar
David Frank committed
121 122 123
#### Test job templates ####

.testjob_template: &test_job_artifact
David Frank's avatar
David Frank committed
124 125
  <<: *run_always
  script:
126
    - cd build
127
    - ctest --output-on-failure --schedule-random
128
  artifacts:
129 130 131 132
    name: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
    paths:
      - build/
    expire_in: 60 mins
133
    reports:
David Frank's avatar
David Frank committed
134
      junit: "build/test_reports/test_*.xml"
135

David Frank's avatar
David Frank committed
136
#### Install job templates ####
David Frank's avatar
David Frank committed
137

David Frank's avatar
David Frank committed
138 139 140 141 142
.installjob_clang_anchors:
  script: &installjob_script_clang
    - git clone https://gitlab.lrz.de/IP/elsa_testing.git /tmp/elsa_testing
    - cd /tmp/elsa_testing
    - mkdir -p build/ && cd build/
143
    - cmake .. -GNinja -DELSA_INSTALL_DIR="$CI_PROJECT_DIR/install-elsa" -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
David Frank's avatar
David Frank committed
144
    - ninja
David Frank's avatar
David Frank committed
145 146 147 148 149 150

.installjob_default_anchors:
  script: &installjob_script
    - git clone https://gitlab.lrz.de/IP/elsa_testing.git /tmp/elsa_testing
    - cd /tmp/elsa_testing
    - mkdir -p build/ && cd build/
151
    - cmake .. -GNinja -DELSA_INSTALL_DIR="$CI_PROJECT_DIR/install-elsa"
David Frank's avatar
David Frank committed
152
    - ninja
153

David Frank's avatar
David Frank committed
154
.installjob_anchors: &install_job
David Frank's avatar
David Frank committed
155
  <<: *run_on_merge_requests
David Frank's avatar
David Frank committed
156
  cache: &install_cache
157
    key: "$CI_COMMIT_REF_SLUG"
David Frank's avatar
David Frank committed
158
    paths:
159 160 161 162 163 164
      - $CPM_SOURCE_CACHE/eigen3/*
      - $CPM_SOURCE_CACHE/spdlog/*
      - $CPM_SOURCE_CACHE/doctest/*
      - $CPM_SOURCE_CACHE/pybind11/*
      - $CPM_SOURCE_CACHE/quickvec/*
      # - /tmp/elsa_testing/*
David Frank's avatar
David Frank committed
165

Jens Petit's avatar
Jens Petit committed
166 167 168
### static test ###

clang-format:
David Frank's avatar
David Frank committed
169
  <<: *run_always
Jens Petit's avatar
Jens Petit committed
170
  stage: static-test
171
  image: $CLANG_FORMAT_IMAGE
Jens Petit's avatar
Jens Petit committed
172 173 174 175 176 177
  script:
    ./tools/ci_scripts/clang-format-test.sh
  tags:
    - linux
    - elsa
    - clang
Tobias Lasser's avatar
Tobias Lasser committed
178

179
clang-tidy:
David Frank's avatar
David Frank committed
180
  <<: *run_always
181
  stage: static-test
182
  image: $CLANG_TIDY_IMAGE
183 184 185 186 187 188 189
  script:
    ./tools/ci_scripts/clang-tidy.sh
  tags:
    - linux
    - elsa
    - clang

190 191 192 193 194 195 196 197 198 199 200
comment-formating:
  <<: *run_always
  stage: static-test
  image: $CLANG_FORMAT_IMAGE
  script:
    ./tools/ci_scripts/check-comment-style.sh
  allow_failure: true
  tags:
    - linux
    - elsa
    - clang
201

Tobias Lasser's avatar
Tobias Lasser committed
202 203 204 205
### compile jobs ###

build-ubuntu:
  <<: *build_job_artifact
206
  image: $UBUNTU_IMAGE
Tobias Lasser's avatar
Tobias Lasser committed
207
  script: *buildjob_normal
Tobias Lasser's avatar
Tobias Lasser committed
208 209 210
  tags:
    - linux
    - elsa
Jens Petit's avatar
Jens Petit committed
211

212
build-gcc:
Tobias Lasser's avatar
Tobias Lasser committed
213
  <<: *build_job_artifact
214
  image: $GCC_IMAGE
Tobias Lasser's avatar
Tobias Lasser committed
215
  script: *buildjob_normal
Tobias Lasser's avatar
Tobias Lasser committed
216 217 218 219
  tags:
    - linux
    - elsa
    - gcc
220

221 222 223 224 225 226 227 228 229 230
build-clang9:
  <<: *build_job_artifact
  image: $CLANG9_IMAGE
  script: *buildjob_clang
  tags:
    - linux
    - elsa
    - clang

build-clang10:
Tobias Lasser's avatar
Tobias Lasser committed
231
  <<: *build_job_artifact
232
  image: $CLANG10_IMAGE
Tobias Lasser's avatar
Tobias Lasser committed
233
  script: *buildjob_clang
Tobias Lasser's avatar
Tobias Lasser committed
234 235 236 237 238
  tags:
    - linux
    - elsa
    - clang

239
build-cuda:
Tobias Lasser's avatar
Tobias Lasser committed
240
  <<: *build_job_artifact
241
  image: $CUDA_IMAGE
Tobias Lasser's avatar
Tobias Lasser committed
242
  script: *buildjob_normal
Tobias Lasser's avatar
Tobias Lasser committed
243 244 245 246 247 248
  tags:
    - linux
    - elsa
    - gcc
    - cuda

249 250 251 252 253 254
build-gpu-only:
  <<: *build_job_artifact
  image: $GPU_ONLY_IMAGE
  script:
    - mkdir -p build
    - cd build
255
    - cmake .. -GNinja -DELSA_BENCHMARKS=ON -DELSA_CUDA_VECTOR=ON -DELSA_CREATE_JUNIT_REPORTS=ON -DCMAKE_INSTALL_PREFIX="../install-elsa" -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
256
    - ninja
257
    - ninja build-tests 
David Frank's avatar
David Frank committed
258 259
    - ninja build-benchmarks
    - ninja build-examples
260
    - ninja install 
261 262 263 264 265 266
  tags:
    - linux
    - elsa
    - gcc
    - cuda

Tobias Lasser's avatar
Tobias Lasser committed
267 268 269 270

### test jobs ###

test-ubuntu:
271
  <<: *test_job_artifact
Tobias Lasser's avatar
Tobias Lasser committed
272
  stage: test
273
  image: $UBUNTU_IMAGE
274
  dependencies:
Tobias Lasser's avatar
Tobias Lasser committed
275 276 277 278
    - build-ubuntu
  tags:
    - linux
    - elsa
Jens Petit's avatar
Jens Petit committed
279

280
test-gcc:
281
  <<: *test_job_artifact
Tobias Lasser's avatar
Tobias Lasser committed
282
  stage: test
283
  image: $GCC_IMAGE
Tobias Lasser's avatar
Tobias Lasser committed
284
  dependencies:
285
    - build-gcc
Tobias Lasser's avatar
Tobias Lasser committed
286 287 288 289
  tags:
    - linux
    - elsa
    - gcc
290

291
test-clang9:
292
  <<: *test_job_artifact
Tobias Lasser's avatar
Tobias Lasser committed
293
  stage: test
294
  image: $CLANG9_IMAGE
Tobias Lasser's avatar
Tobias Lasser committed
295
  dependencies:
296 297 298 299 300 301 302 303 304 305 306 307
    - build-clang9
  tags:
    - linux
    - elsa
    - clang

test-clang10:
  <<: *test_job_artifact
  stage: test
  image: $CLANG10_IMAGE
  dependencies:
    - build-clang10
Tobias Lasser's avatar
Tobias Lasser committed
308 309 310 311
  tags:
    - linux
    - elsa
    - clang
Tobias Lasser's avatar
Tobias Lasser committed
312

313
test-cuda:
314
  <<: *test_job_artifact
Tobias Lasser's avatar
Tobias Lasser committed
315
  stage: test
316
  image: $CUDA_IMAGE
Tobias Lasser's avatar
Tobias Lasser committed
317
  dependencies:
318
    - build-cuda
Tobias Lasser's avatar
Tobias Lasser committed
319 320 321 322 323 324
  tags:
    - linux
    - elsa
    - gcc
    - cuda

325
test-gpu-only:
326
  <<: *test_job_artifact
327 328 329 330 331 332 333 334 335 336
  stage: test
  image: $GPU_ONLY_IMAGE
  dependencies:
    - build-gpu-only
  tags:
    - linux
    - elsa
    - gcc
    - cuda

David Frank's avatar
David Frank committed
337 338 339 340 341 342 343 344 345 346 347 348
install-gcc:
  <<: *install_job
  stage: test
  image: $GCC_IMAGE
  dependencies:
    - build-gcc
  script: *installjob_script
  tags:
    - linux
    - elsa
    - gcc

349
install-clang9:
David Frank's avatar
David Frank committed
350 351
  <<: *install_job
  stage: test
352
  image: $CLANG9_IMAGE
David Frank's avatar
David Frank committed
353
  dependencies:
354 355 356 357 358 359 360 361 362 363 364 365 366
    - build-clang9
  script: *installjob_script_clang
  tags:
    - linux
    - elsa
    - clang

install-clang10:
  <<: *install_job
  stage: test
  image: $CLANG10_IMAGE
  dependencies:
    - build-clang10
David Frank's avatar
David Frank committed
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
  script: *installjob_script_clang
  tags:
    - linux
    - elsa
    - clang

install-cuda:
  <<: *install_job
  stage: test
  image: $CUDA_IMAGE
  dependencies:
    - build-cuda
  script: *installjob_script
  tags:
    - linux
    - elsa
    - gcc
    - cuda

install-gpu-only:
  <<: *install_job
  stage: test
  image: $GPU_ONLY_IMAGE
  dependencies:
    - build-gpu-only
David Frank's avatar
David Frank committed
392
  script:
David Frank's avatar
David Frank committed
393 394 395
    - git clone https://gitlab.lrz.de/IP/elsa_testing.git /tmp/elsa_testing
    - cd /tmp/elsa_testing
    - mkdir -p build/ && cd build/
396
    - cmake .. -GNinja -DELSA_INSTALL_DIR="$CI_PROJECT_DIR/install-elsa" -Dquickvec_DIR="$CI_PROJECT_DIR/install-elsa/lib/cmake/Quickvec" -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi" -DELSA_CUDA_VECTOR=ON
David Frank's avatar
David Frank committed
397 398 399 400 401 402
    - ninja
  tags:
    - linux
    - elsa
    - gcc
    - cuda
Tobias Lasser's avatar
Tobias Lasser committed
403

David Frank's avatar
David Frank committed
404
### sanitizers ###
405

406
cuda-memcheck:
407
  <<: *run_on_merge_requests
408 409 410 411 412 413 414 415 416 417 418 419
  stage: sanitizer
  image: $GPU_ONLY_IMAGE
  script:
    ./tools/ci_scripts/cuda-memcheck.sh
  dependencies:
    - test-gpu-only
  tags:
    - linux
    - elsa
    - gcc
    - cuda

420
# Be sure to run this job with container which has privaledge mode set
421
asan-ubsan:
422
  <<: *run_on_merge_requests
David Frank's avatar
David Frank committed
423 424
  stage: sanitizer
  image: $CUDA_IMAGE
David Frank's avatar
David Frank committed
425
  dependencies: []
David Frank's avatar
David Frank committed
426 427 428
  script:
    - mkdir -p build
    - cd build
David Frank's avatar
David Frank committed
429
    - cmake -GNinja -DELSA_BUILD_CUDA_PROJECTORS=OFF -DELSA_BUILD_PYTHON_BINDINGS=OFF -DCMAKE_BUILD_TYPE=Debug -DELSA_SANITIZER="Address;Undefined" ..
David Frank's avatar
David Frank committed
430 431 432 433 434 435 436
    - ninja tests
  tags:
    - linux
    - elsa
    - gcc
    - cuda

Jens Petit's avatar
Jens Petit committed
437

438 439
### test coverage ###

David Frank's avatar
David Frank committed
440
# Enforce GCC for test coverage, as our coverage only works with gcov and acts weird with clang
441
test-coverage:
442
  <<: *run_on_merge_requests
443
  stage: coverage
444
  image: $COVERAGE_IMAGE
David Frank's avatar
David Frank committed
445
  dependencies: []
446 447 448
  script:
    - mkdir -p build
    - cd build
David Frank's avatar
David Frank committed
449
    - CXX=g++ cmake .. -GNinja -DELSA_BUILD_PYTHON_BINDINGS=OFF -DCMAKE_BUILD_TYPE=Debug -DELSA_COVERAGE=ON
450 451
    - ninja tests
    - ninja test_coverage
452 453 454
  cache:
    key: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
    paths:
David Frank's avatar
David Frank committed
455
      - $CPM_SOURCE_CACHE
456
      - build/
457 458 459 460
  artifacts:
    name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME-coverage"
    paths:
      - build/test_coverage/
461
    expire_in: 60 mins
462 463 464 465 466 467 468
  tags:
    - linux
    - elsa
    - gcc
    - cuda


Jens Petit's avatar
Jens Petit committed
469
### deploy docs and coverage report ###
Tobias Lasser's avatar
Tobias Lasser committed
470 471

deploy-docs:
David Frank's avatar
David Frank committed
472
  <<: *nightly_job
Tobias Lasser's avatar
Tobias Lasser committed
473
  stage: docs
Jens Petit's avatar
Jens Petit committed
474 475
  dependencies:
    - test-coverage
Tobias Lasser's avatar
Tobias Lasser committed
476 477 478
  script:
    - mkdir -p build
    - cd build
Tobias Lasser's avatar
Tobias Lasser committed
479 480
    - cmake .. -GNinja
    - ninja docs
Tobias Lasser's avatar
Tobias Lasser committed
481
    - cp -r docs/sphinx/* /var/www/ciip/elsadocs/
Jens Petit's avatar
Jens Petit committed
482
    - cd ..
Tobias Lasser's avatar
Tobias Lasser committed
483
    - cp -r build/test_coverage/* /var/www/ciip/elsacoverage/
Tobias Lasser's avatar
Tobias Lasser committed
484 485
  tags:
    - elsa-docs-deploy
Tobias Lasser's avatar
Tobias Lasser committed
486

487 488 489 490 491

### build, test and deploy docker images ###
.deploy-docker:
  <<: *nightly_job
  stage: docker
David Frank's avatar
David Frank committed
492
  dependencies: []
493 494 495 496
  rules:
    - if: '$CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "schedule"'
    - changes:
      - tools/docker/*
497 498 499
  script:
    - cd tools/docker
    - ./buildDockerContainers.sh
500 501 502 503
  tags:
    - elsa
    - shell

504 505 506 507 508 509

### Test jobs ###

# These jobs, are for local build and test all in one job, should not be run with pipeline

.all-clang:
510 511 512
  image: $CLANG9_IMAGE
  rules:
    - when: never
David Frank's avatar
David Frank committed
513
  script:
514 515
    - mkdir -p build
    - cd build
516 517 518
    - cmake .. -GNinja -DELSA_BENCHMARKS=ON -DELSA_CREATE_JUNIT_REPORTS=ON -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"
    - ninja
    - ninja tests
519 520 521

.all-gcc:
  image: $GCC_IMAGE
522 523
  rules:
    - when: never
David Frank's avatar
David Frank committed
524
  script:
525 526 527
    - *buildjob_normal
    - ninja tests
    - *installjob_script