summaryrefslogtreecommitdiff
path: root/.travis.yml
blob: 33b90729ff10ac46c3e141519187544fa3784373 (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
101
102
103
104
105
106
107
108
109
# Build matrix / environment variables are explained on:
# http://about.travis-ci.org/docs/user/build-configuration/
# This file can be validated on: http://lint.travis-ci.org/

language: cpp
dist: bionic
osx_image: xcode12.5

compiler:
- gcc
- clang
os:
- linux
- osx

env:
  jobs:
  - BUILD_TYPE: Debug
    CPU_LEVEL: BASELINE
  - BUILD_TYPE: Debug
    CPU_LEVEL: AVX
  - BUILD_TYPE: Debug
    CPU_LEVEL: AVX2
  - BUILD_TYPE: RelWithDebInfo
    CPU_LEVEL: BASELINE
  - BUILD_TYPE: RelWithDebInfo
    CPU_LEVEL: AVX
  - BUILD_TYPE: RelWithDebInfo
    CPU_LEVEL: AVX2

jobs:
  exclude:
  # Travis OSX servers seem to run on pre-Haswell CPUs. Attempting to use AVX2
  # results in crashes.
  - env: BUILD_TYPE=Debug CPU_LEVEL=AVX2
    os: osx
  - env: BUILD_TYPE=RelWithDebInfo CPU_LEVEL=AVX2
    os: osx
  allow_failures:
  # Homebrew's GCC is currently broken on XCode 11.
  - compiler: gcc
    os: osx

addons:
  apt:
    sources:
    - sourceline: 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-12 main'
      key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
    - sourceline: 'ppa:ubuntu-toolchain-r/test'
    packages:
    - clang-12
    - cmake
    - gcc-11
    - g++-11
    - ninja-build
  homebrew:
    packages:
    - cmake
    - gcc@11
    - llvm@12
    - ninja
    update: true

install:
# The following Homebrew packages aren't linked by default, and need to be
# prepended to the path explicitly.
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then
    export PATH="$(brew --prefix llvm)/bin:$PATH";
  fi
# Fuzzing is only supported on Clang. Perform fuzzing on Debug builds.
# LibFuzzer doesn't ship with CommandLineTools on osx.
- if [ "$CXX" = "clang++" ] && [ "$BUILD_TYPE" = "Debug" ] && [ "$TRAVIS_OS_NAME" != "osx" ]; then
    export FUZZING=1;
  else
    export FUZZING=0;
  fi
# /usr/bin/gcc points to an older compiler on both Linux and macOS.
- if [ "$CXX" = "g++" ]; then export CXX="g++-11" CC="gcc-11"; fi
# /usr/bin/clang points to an older compiler on both Linux and macOS.
#
# Homebrew's llvm package doesn't ship a versioned clang++ binary, so the values
# below don't work on macOS. Fortunately, the path change above makes the
# default values (clang and clang++) resolve to the correct compiler on macOS.
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
    if [ "$CXX" = "clang++" ]; then export CXX="clang++-12" CC="clang-12"; fi;
  fi
- echo ${CC}
- echo ${CXX}
- ${CXX} --version
- cmake --version

before_script:
- mkdir -p build && cd build
- cmake .. -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE
    -DSNAPPY_REQUIRE_${CPU_LEVEL}=ON -DSNAPPY_FUZZING_BUILD=${FUZZING}
    -DCMAKE_INSTALL_PREFIX=$HOME/.local
- cmake --build .
- cd ..

script:
- build/snappy_unittest
- build/snappy_benchmark
- if [ -f build/snappy_compress_fuzzer ]; then
    build/snappy_compress_fuzzer -runs=1000 -close_fd_mask=3;
  fi
- if [ -f build/snappy_uncompress_fuzzer ]; then
    build/snappy_uncompress_fuzzer -runs=1000 -close_fd_mask=3;
  fi
- cd build && cmake --build . --target install