Skip to content

Commit

Permalink
Redo build matrix on .travis for C++14 and up
Browse files Browse the repository at this point in the history
* Use Xenial as the base distribution
* Remove C++11 builds
* Add a lot more C++14 builds
* Add some C++17 builds
* Include newer versions of Clang and GCC
  • Loading branch information
horenmar committed Oct 31, 2019
1 parent 7c48ea6 commit 2c6ace0
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .conan/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ find_package(Catch2 REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} CONAN_PKG::Catch2)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14)
227 changes: 61 additions & 166 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,187 +1,149 @@
language: cpp
dist: xenial


branches:
except:
- /dev-appveyor.*/

common_sources: &all_sources
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty
- llvm-toolchain-trusty-3.9
- llvm-toolchain-trusty-4.0
- llvm-toolchain-xenial
- llvm-toolchain-xenial-3.8
- llvm-toolchain-xenial-3.9
- llvm-toolchain-xenial-4.0
- llvm-toolchain-xenial-5.0
- llvm-toolchain-xenial-6.0
- llvm-toolchain-xenial-7
- llvm-toolchain-xenial-8


matrix:
include:

# 1/ Linux Clang Builds
- os: linux
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-3.5']
env: COMPILER='clang++-3.5'

# Clang builds
- os: linux
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-3.6']
env: COMPILER='clang++-3.6'

# Clang 3.7 is intentionally skipped as we cannot get it easily on
# TravisCI container
apt:
sources: *all_sources
packages: ['clang-3.8']
env: COMPILER='clang++-3.8' CPP14=1

- os: linux
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['lcov', 'clang-3.8']
env: COMPILER='clang++-3.8'
packages: ['clang-3.8', 'lcov']
env: COMPILER='clang++-3.8' CPP14=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1

- os: linux
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-3.9']
env: COMPILER='clang++-3.9'
env: COMPILER='clang++-3.9' CPP14=1

- os: linux
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-4.0']
env: COMPILER='clang++-4.0'
env: COMPILER='clang++-4.0' CPP14=1

- os: linux
dist: xenial
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-5.0']
env: COMPILER='clang++-5.0'
env: COMPILER='clang++-5.0' CPP14=1

- os: linux
dist: xenial
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-6.0']
env: COMPILER='clang++-6.0'

# 2/ Linux GCC Builds
- os: linux
compiler: gcc
addons:
apt:
sources: *all_sources
packages: ['g++-4.9']
env: COMPILER='g++-4.9'

- os: linux
compiler: gcc
addons:
apt:
sources: *all_sources
packages: ['g++-5']
env: COMPILER='g++-5'

- os: linux
compiler: gcc
addons: &gcc6
apt:
sources: *all_sources
packages: ['g++-6']
env: COMPILER='g++-6'

- os: linux
compiler: gcc
addons: &gcc7
apt:
sources: *all_sources
packages: ['g++-7']
env: COMPILER='g++-7'

- os: linux
compiler: gcc
addons: &gcc8
apt:
sources: *all_sources
packages: ['g++-8']
env: COMPILER='g++-8'
env: COMPILER='clang++-6.0' CPP14=1

# 3b/ Linux C++14 Clang builds
# Note that we need newer libstdc++ for C++14 support
- os: linux
compiler: clang
addons:
apt:
packages: ['clang-3.8', 'libstdc++-6-dev']
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty
env: COMPILER='clang++-3.8' CPP14=1
sources: *all_sources
packages: ['clang-6.0', 'libstdc++-8-dev']
env: COMPILER='clang++-6.0' CPP17=1

- os: linux
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-3.9', 'libstdc++-6-dev']
env: COMPILER='clang++-3.9' CPP14=1
packages: ['clang-7']
env: COMPILER='clang++-7' CPP14=1

- os: linux
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-4.0', 'libstdc++-6-dev']
env: COMPILER='clang++-4.0' CPP14=1
packages: ['clang-8']
env: COMPILER='clang++-8' CPP14=1

- os: linux
dist: xenial
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-5.0', 'libstdc++-6-dev']
env: COMPILER='clang++-5.0' CPP14=1
packages: ['clang-8', 'libstdc++-8-dev']
env: COMPILER='clang++-8' CPP17=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1


# GCC builds
- os: linux
dist: xenial
compiler: clang
compiler: gcc
addons:
apt:
sources: *all_sources
packages: ['clang-6.0', 'libstdc++-6-dev']
env: COMPILER='clang++-6.0' CPP14=1
apt:
sources: *all_sources
packages: ['g++-4.9']
env: COMPILER='g++-4.9' CPP14=1

- os: linux
compiler: gcc
addons:
apt:
sources: *all_sources
packages: ['g++-5']
env: COMPILER='g++-5' CPP14=1

# 4a/ Linux C++14 GCC builds
- os: linux
compiler: gcc
addons: *gcc6
addons:
apt:
sources: *all_sources
packages: ['g++-6']
env: COMPILER='g++-6' CPP14=1

- os: linux
compiler: gcc
addons: *gcc7
env: COMPILER='g++-7' CPP14=1
addons:
apt:
sources: *all_sources
packages: ['g++-7', 'lcov']
env: COMPILER='g++-7' CPP14=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1

- os: linux
compiler: gcc
addons: *gcc8
env: COMPILER='g++-8' CPP14=1
addons:
apt:
sources: *all_sources
packages: ['g++-8']
env: COMPILER='g++-8' CPP17=1

# 5/ OSX Clang Builds
# OSX Clang Builds
- os: osx
osx_image: xcode9.4
compiler: clang
Expand All @@ -203,87 +165,20 @@ matrix:
env: COMPILER='clang++' CPP14=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1


# 6/ Special builds -- examples, coverage, valgrind, etc.
- os: linux
compiler: gcc
addons:
apt:
sources: *all_sources
packages: ['lcov', 'g++-7']
env: COMPILER='g++-7' CPP14=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1

- os: linux
compiler: clang
addons:
apt:
packages: ['clang-3.8', 'lcov']
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty
env: COMPILER='clang++-3.8' EXAMPLES=1 COVERAGE=1 EXTRAS=1

- os: linux
compiler: gcc
addons:
apt:
sources: *all_sources
packages: ['valgrind', 'lcov', 'g++-7']
env: COMPILER='g++-7' CPP14=1 VALGRIND=1

# 7/ C++17 builds
- os: linux
compiler: gcc
addons: *gcc7
env: COMPILER='g++-7' CPP17=1

- os: linux
compiler: gcc
addons: *gcc7
env: COMPILER='g++-7' EXAMPLES=1 COVERAGE=1 EXTRAS=1 CPP17=1

- os: linux
dist: xenial
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-6.0', 'libstdc++-8-dev']
env: COMPILER='clang++-6.0' CPP17=1

- os: linux
dist: xenial
compiler: clang
addons:
apt:
sources: *all_sources
packages: ['clang-6.0', 'libstdc++-8-dev']
env: COMPILER='clang++-6.0' CPP17=1 EXAMPLES=1 COVERAGE=1 EXTRAS=1

# 8/ Conan
# Special builds, e.g. conan
- language: python
python:
- "3.7"
dist: xenial
install:
- pip install conan-package-tools
env:
- CONAN_GCC_VERSIONS=8
- CONAN_DOCKER_IMAGE=conanio/gcc8
- CPP14=1
script:
- python .conan/build.py

install:
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
- |
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
CMAKE_URL="http://cmake.org/files/v3.8/cmake-3.8.2-Linux-x86_64.tar.gz"
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
which cmake || brew install cmake;
fi
before_script:
- export CXX=${COMPILER}
- cd ${TRAVIS_BUILD_DIR}
Expand All @@ -296,7 +191,7 @@ before_script:
elif [[ ${CPP14} -eq 1 ]]; then
export CPP_STANDARD=14
else
export CPP_STANDARD=11
travis_terminate 4;
fi
# Use Debug builds for running Valgrind and building examples
Expand Down
11 changes: 9 additions & 2 deletions examples/231-Cfg-OutputStreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>


class out_buff : public std::stringbuf {
std::FILE* m_stream;
public:
out_buff(std::FILE* stream) :m_stream(stream) {}
~out_buff() { pubsync(); }
out_buff(std::FILE* stream):m_stream(stream) {}
~out_buff();
int sync() {
int ret = 0;
for (unsigned char c : str()) {
Expand All @@ -29,6 +30,12 @@ class out_buff : public std::stringbuf {
}
};

out_buff::~out_buff() { pubsync(); }

#if defined(__clang__)
#pragma clang diagnostic ignored "-Wexit-time-destructors" // static variables in cout/cerr/clog
#endif

namespace Catch {
std::ostream& cout() {
static std::ostream ret(new out_buff(stdout));
Expand Down
8 changes: 5 additions & 3 deletions examples/301-Gen-MapTypeConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ class LineGenerator : public Catch::Generators::IGenerator<std::string> {
}
}

std::string const& get() const override {
return m_line;
}
std::string const& get() const override;

bool next() override {
return !!std::getline(m_stream, m_line);
}
};

std::string const& LineGenerator::get() const {
return m_line;
}

// This helper function provides a nicer UX when instantiating the generator
// Notice that it returns an instance of GeneratorWrapper<std::string>, which
// is a value-wrapper around std::unique_ptr<IGenerator<std::string>>.
Expand Down
Loading

0 comments on commit 2c6ace0

Please sign in to comment.