From e9720a001d4feffe1fc9770859fe9913d0d5ede6 Mon Sep 17 00:00:00 2001 From: costan Date: Tue, 27 Jun 2017 11:11:16 -0700 Subject: [PATCH] Update Travis CI config, add AppVeyor for Windows CI coverage. --- .travis.yml | 67 +++++++++++++++++++++++++++++++++++++++----------- appveyor.yml | 38 ++++++++++++++++++++++++++++ snappy-test.cc | 3 +++ 3 files changed, 93 insertions(+), 15 deletions(-) create mode 100644 appveyor.yml diff --git a/.travis.yml b/.travis.yml index 9f5ffa9..88c28fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,53 @@ -language: generic +# 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/ + +sudo: false +dist: trusty +language: cpp + +compiler: + - gcc + - clang +os: + - linux + - osx + +env: + - BUILD_TYPE=Debug + - BUILD_TYPE=RelWithDebInfo + matrix: - include: - - os: linux - dist: trusty # For Docker. - sudo: required # For Docker. - script: - - echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME" - - docker run --rm -i -v $CI_SOURCE_PATH:$CI_SOURCE_PATH -e "CI_SOURCE_PATH=$CI_SOURCE_PATH" -e "HOME=$HOME" -t ubuntu:xenial sh -c "cd $CI_SOURCE_PATH; apt-get -qq update && apt-get -qq install build-essential cmake libgtest-dev; mkdir build && cd build && cmake ../ && make all && make test" - - os: osx - script: - - echo "Testing branch $TRAVIS_BRANCH of $REPOSITORY_NAME" - - mkdir build && cd build && cmake ../ && make all && make test -before_install: -- export CI_SOURCE_PATH=$(pwd) -- export REPOSITORY_NAME=${PWD##*/} + allow_failures: + - compiler: clang + env: BUILD_TYPE=RelWithDebInfo + +addons: + apt: + # List of whitelisted in travis packages for ubuntu-precise can be found here: + # https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise + # List of whitelisted in travis apt-sources: + # https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json + sources: + - ubuntu-toolchain-r-test + - llvm-toolchain-trusty-4.0 + packages: + - cmake + - gcc-6 + - g++-6 + - clang-4.0 + +install: +# Travis doesn't have a nice way to install homebrew packages yet. +# https://github.com/travis-ci/travis-ci/issues/5377 +- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install gcc@6; fi +# /usr/bin/gcc is stuck to old versions by on both Linux and OSX. +- if [ "$CXX" = "g++" ]; then export CXX="g++-6" CC="gcc-6"; fi +- echo ${CC} +- echo ${CXX} +- ${CXX} --version + +script: +- mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE && + CTEST_OUTPUT_ON_FAILURE=1 make all test \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..886150f --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,38 @@ +# Build matrix / environment variables are explained on: +# https://www.appveyor.com/docs/appveyor-yml/ +# This file can be validated on: https://ci.appveyor.com/tools/validate-yaml + +version: "{build}" + +environment: + matrix: + # AppVeyor currently has no custom job name feature. + # http://help.appveyor.com/discussions/questions/1623-can-i-provide-a-friendly-name-for-jobs + - JOB: Visual Studio 2017 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CMAKE_GENERATOR: Visual Studio 15 2017 + - JOB: Visual Studio 2015 + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + CMAKE_GENERATOR: Visual Studio 14 2015 + +platform: + - x86 + - x64 + +configuration: + - RelWithDebInfo + - Debug + +build: + verbosity: minimal + +build_script: + - git submodule update --init --recursive + - mkdir out + - cd out + - cmake .. -G "%CMAKE_GENERATOR%" + -DCMAKE_CONFIGURATION_TYPES="Debug;RelWithDebInfo" + - cmake --build . --config %CONFIGURATION% + +test_script: + - ctest -C %CONFIGURATION% --output-on-failure diff --git a/snappy-test.cc b/snappy-test.cc index cbcb502..01d5541 100644 --- a/snappy-test.cc +++ b/snappy-test.cc @@ -33,6 +33,9 @@ #endif #ifdef HAVE_WINDOWS_H +// Needed to be able to use std::max without workarounds in the source code. +// https://support.microsoft.com/en-us/help/143208/prb-using-stl-in-windows-program-can-cause-min-max-conflicts +#define NOMINMAX #include #endif