summaryrefslogtreecommitdiff
path: root/.travis.yml
blob: 727d1125b65717e3cfd615770b3c35a71c9b6b59 (plain)
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
language: c
compiler:
  - gcc
  - clang

os:
  - linux
  - osx

branches:
  only:
    - staging
    - trying
    - master
    - /^release\/.*$/

before_script:
    - if [ "$TRAVIS_OS_NAME" == "osx" ] ; then brew update; brew install redis; fi

addons:
  apt:
    packages:
    - libc6-dbg
    - libc6-dev
    - libc6:i386
    - libc6-dev-i386
    - libc6-dbg:i386
    - gcc-multilib
    - g++-multilib
    - valgrind

env:
  - BITS="32"
  - BITS="64"

script:
  - EXTRA_CMAKE_OPTS="-DENABLE_EXAMPLES:BOOL=ON -DHIREDIS_SSL:BOOL=ON";
    if [ "$TRAVIS_OS_NAME" == "osx" ]; then
      if [ "$BITS" == "32" ]; then
        CFLAGS="-m32 -Werror";
        CXXFLAGS="-m32 -Werror";
        LDFLAGS="-m32";
        EXTRA_CMAKE_OPTS=;
      else
        CFLAGS="-Werror";
        CXXFLAGS="-Werror";
      fi;
    else
      TEST_PREFIX="valgrind --track-origins=yes --leak-check=full";
      if [ "$BITS" == "32" ]; then
        CFLAGS="-m32 -Werror";
        CXXFLAGS="-m32 -Werror";
        LDFLAGS="-m32";
        EXTRA_CMAKE_OPTS=;
      else
        CFLAGS="-Werror";
        CXXFLAGS="-Werror";
      fi;
    fi;
    export CFLAGS CXXFLAGS LDFLAGS TEST_PREFIX EXTRA_CMAKE_OPTS
  - mkdir build/ && cd build/
  - cmake .. ${EXTRA_CMAKE_OPTS}
  - make VERBOSE=1
  - SKIPS_AS_FAILS=1 ctest -V

jobs:
  include:
    # Windows MinGW cross compile on Linux
    - os: linux
      dist: xenial
      compiler: mingw
      addons:
        apt:
          packages:
            - ninja-build
            - gcc-mingw-w64-x86-64
            - g++-mingw-w64-x86-64
      script:
        - mkdir build && cd build
        - CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_WITH_INSTALL_RPATH=on
        - ninja -v

    # Windows MSVC 2017
    - os: windows
      compiler: msvc
      env:
        - MATRIX_EVAL="CC=cl.exe && CXX=cl.exe"
      before_install:
        - eval "${MATRIX_EVAL}"
      install:
        - choco install ninja
        - choco install redis-64 -y
      before_script:
        - redis-server --service-install --service-name Redis --port 6379
        - redis-server --service-start
      script:
        - mkdir build && cd build
        - cmd.exe //C 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat' amd64 '&&'
          cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release '&&' ninja -v
        - ./hiredis-test.exe