.gitlab-ci.yml 3.01 KB
Newer Older
1 2
image: vladyslavusenko/b_image:latest

3 4 5 6 7 8 9 10
variables:
  GIT_SUBMODULE_STRATEGY: recursive
  BUILD_TYPE: Release

# template for docker builds with ccache
.prepare_docker_template: &prepare_docker_definition
  tags:
    - docker
11 12 13 14
  before_script:
    - mkdir -p ccache
    - export CCACHE_BASEDIR=${PWD}
    - export CCACHE_DIR=${PWD}/ccache
Nikolaus Demmel's avatar
Nikolaus Demmel committed
15
    - ccache -s
16 17 18
  cache:
    paths:
    - ccache/
19
    key: ${CI_JOB_NAME}
20 21 22 23

# template for secondary build & unit test configurations
.compile_and_test_template: &compile_and_test_definition
  stage: build
24 25 26
  script:
    - mkdir build
    - cd build
27
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
28
    - make -j4
29 30 31 32 33 34 35 36 37 38 39 40 41 42
    - ctest

# main build with benchmark and coverage
bionic-release-compile:
  <<: *prepare_docker_definition
  stage: build
  script:
    - mkdir build
    - cd build
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
    - make -j4
    - ctest
    - ./test/benchmark_camera > ../benchmark_camera.txt
    - cd ../
43 44 45 46
    - mkdir build_coverage
    - cd build_coverage
    - cmake .. -DCMAKE_BUILD_TYPE=Coverage
    - make -j4
47
    - ctest
48 49 50
    - lcov --directory . --capture --output-file coverage.info
    - lcov --remove coverage.info '*test/*' '/usr/*' '*thirdparty*' '*googletest*' --output-file coverage.info
    - lcov --list coverage.info
51 52 53 54
  artifacts:
    paths:
    - benchmark_camera.txt

55 56 57 58 59 60 61 62 63 64 65 66
bionic-debug-compile:
  <<: *prepare_docker_definition
  <<: *compile_and_test_definition
  variables:
    BUILD_TYPE: Debug

bionic-relwithdebinfo-compile:
  <<: *prepare_docker_definition
  <<: *compile_and_test_definition
  variables:
    BUILD_TYPE: RelWithDebInfo

67 68 69 70 71 72 73 74 75 76
bionic-asan-build:
  <<: *prepare_docker_definition
  <<: *compile_and_test_definition
  variables:
    CC: clang-8
    CXX: clang++-8
    BUILD_TYPE: SanitizerRelWithDebInfo
    # LeakSanitizer doesn't work in (non-priviliged) container
    ASAN_OPTIONS: "detect_leaks=0"

77 78 79 80 81
xenial-release-compile:
  <<: *prepare_docker_definition
  <<: *compile_and_test_definition
  image: vladyslavusenko/b_image_xenial:latest

82
elcapitan-relwithdebinfo-compile:
83 84
  <<: *compile_and_test_definition
  tags: [macos, "10.11"]
85 86
  variables:
    BUILD_TYPE: RelWithDebInfo
87

Vladyslav Usenko's avatar
Vladyslav Usenko committed
88 89 90 91 92 93
mojave-relwithdebinfo-compile:
  <<: *compile_and_test_definition
  tags: [macos, "10.14"]
  variables:
    BUILD_TYPE: RelWithDebInfo

94 95 96 97 98 99 100 101
mojave-brewedclang-asan-build:
  <<: *compile_and_test_definition
  tags: [macos, "10.14"]
  variables:
    CC: /usr/local/opt/llvm/bin/clang
    CXX: /usr/local/opt/llvm/bin/clang++
    BUILD_TYPE: SanitizerRelWithDebInfo

102 103 104 105 106 107 108 109 110 111 112
# check if clang-format would make any changes
clang-format:
  tags:
    - docker
  stage: build
  variables:
    GIT_SUBMODULE_STRATEGY: none
  script:
    - ./scripts/clang-format-all.sh
    # check if any files are now modified and error if yes
    - (if git diff --name-only --diff-filter=M | grep '\..pp$'; then echo $'\n    Some files are not properly formatted. You can use "./scripts/clang-format-all.sh".\n'; git diff --diff-filter=M; false; fi)
113 114 115 116 117 118 119 120 121 122 123

pages:
  tags:
    - docker
  script:
  - doxygen
  artifacts:
    paths:
    - public
  only:
  - master