about summary refs log tree commit diff
path: root/.travis.yml
blob: cdbe09bf92fb3d2946622e80cb0b0df579d10ddf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
language: nix
dist: trusty

git:
  depth: false

matrix:
  include:
    - env: DO=check TYPE=Debug TOOLCHAIN=llvm-5 SANITIZE=true
    - env: DO=check TYPE=Release TOOLCHAIN=llvm-5 BENCHMARKS=true
    - env: DO=check TYPE=Debug TOOLCHAIN=gnu-6 COVERAGE=true
    - env: DO=check TYPE=Release TOOLCHAIN=gnu-6 BENCHMARKS=true
    - env: DO=check TYPE=Debug TOOLCHAIN=gnu-7 STD=17
    - env: DO=check TYPE=Debug TOOLCHAIN=llvm-9 STD=17 FUZZERS=true
    - env: DO=build
    - env: DO=docs

before_install:
  - |
    : ${TOOLCHAIN:=gnu-6}
    : ${TYPE:=Debug}
    : ${STD:=14}
    function build-p { [[ "${DO}" == build ]]; }
    function check-p { [[ "${DO}" == check ]]; }
    function docs-p  { [[ "${DO}" == docs ]]; }
    function coverage-p { [[ "${COVERAGE}" == true ]]; }
    function benchmarks-p { [[ "${BENCHMARKS}" == true ]]; }
    function deploy-p {
        [[ "${TRAVIS_PULL_REQUEST}" == "false" && \
           "${TRAVIS_BRANCH}" == "master" ]]
    }
    function upload-p {
        [[ -n "$encrypted_1c8d51d72e41_key" && \
           -n "$encrypted_1c8d51d72e41_iv" ]]
    }
    function decrypt-ssh-key {
        openssl aes-256-cbc \
            -K  $encrypted_1c8d51d72e41_key \
            -iv $encrypted_1c8d51d72e41_iv \
            -in tools/travis/ssh-key.enc \
            -out tools/travis/ssh-key -d
        chmod 600 tools/travis/ssh-key
    }
    function with-nix {
        nix-shell --argstr toolchain $TOOLCHAIN --run "set -e; $1"
    }

install:
  - with-nix "echo == nix environment ok"

before_script:
  - |
    with-nix "
        mkdir build && cd build
        cmake .. \
            -DCMAKE_BUILD_TYPE=${TYPE} \
            -DCHECK_SLOW_TESTS=false \
            -DCXX_STANDARD=${STD} \
            -DCHECK_BENCHMARKS=${BENCHMARKS} \
            -DENABLE_COVERAGE=${COVERAGE} \
            -DENABLE_SANITIZE=${SANITIZE} \
            -DCHECK_FUZZERS=${FUZZERS} \
            -DDISABLE_FREE_LIST=${SANITIZE}
    "

script:
  - |
    set -e
    ! build-p || nix-build
    ! check-p || with-nix "cd build && make -j2 check"
    ! docs-p  || with-nix "cd build && make docs"

after_success:
  - |
    ! coverage-p || with-nix "
        cd build
        find . -name \"*.gcno\" | xargs gcov -bcprs ${PWD}
        bash <(curl -s https://codecov.io/bash) -x gcov
    "
    if upload-p; then
        decrypt-ssh-key
        ! benchmarks-p || with-nix "cd build && make upload-benchmark-reports"
        ! docs-p || ! deploy-p || with-nix "cd build && make upload-docs"
    fi