From c7d1026a31f9fe2ff42597df739137ff059a5eda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20L=C3=BChne?= Date: Fri, 23 Mar 2018 17:27:20 +0100 Subject: [PATCH] Switch Travis to Docker As Travis only provides outdated packages (compilers in particular), this changes the Travis configuration to use Docker images to build and test the code. This also has the benefit that multiple distributions can be tested and not just Ubuntu. For the time being, Arch Linux and Ubuntu 18.04 are added as supported platforms. --- .ci/Dockerfile-arch-latest | 6 +++++ .ci/Dockerfile-ubuntu-18.04 | 6 +++++ .ci/ci.sh | 7 +++++ .travis.yml | 52 +++++++++---------------------------- 4 files changed, 31 insertions(+), 40 deletions(-) create mode 100644 .ci/Dockerfile-arch-latest create mode 100644 .ci/Dockerfile-ubuntu-18.04 create mode 100755 .ci/ci.sh diff --git a/.ci/Dockerfile-arch-latest b/.ci/Dockerfile-arch-latest new file mode 100644 index 0000000..faa2ab2 --- /dev/null +++ b/.ci/Dockerfile-arch-latest @@ -0,0 +1,6 @@ +FROM archimg/base-devel:latest + +RUN pacman -Sy +RUN pacman -S --noconfirm boost cmake git ninja re2c + +VOLUME /app diff --git a/.ci/Dockerfile-ubuntu-18.04 b/.ci/Dockerfile-ubuntu-18.04 new file mode 100644 index 0000000..a99a280 --- /dev/null +++ b/.ci/Dockerfile-ubuntu-18.04 @@ -0,0 +1,6 @@ +FROM ubuntu:18.04 + +RUN apt-get update +RUN apt-get install -y libboost-all-dev cmake git ninja-build re2c + +VOLUME /app diff --git a/.ci/ci.sh b/.ci/ci.sh new file mode 100755 index 0000000..c283921 --- /dev/null +++ b/.ci/ci.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +git submodule update --init --recursive +mkdir -p build/debug +cd build/debug +cmake ../.. -GNinja -DANTHEM_BUILD_TESTS=ON +ninja anthem-app && ninja run-tests diff --git a/.travis.yml b/.travis.yml index 5c48372..9d22982 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,47 +1,19 @@ -# Use container-based distribution -sudo: false -language: c++ -addons: - apt: - sources: &default_sources - - ubuntu-toolchain-r-test - - boost-latest - packages: &default_packages - - libboost-program-options1.55-dev - - libboost-iostreams1.55-dev - - libboost-system1.55-dev - - libboost-filesystem1.55-dev - - re2c +sudo: required + +services: + - docker + matrix: include: - - env: COMPILER_NAME=g++ _CXX=g++-5 _CC=gcc-5 + - env: distribution=arch-latest os: linux language: cpp - addons: - apt: - sources: - - *default_sources - packages: - - *default_packages - - g++-5 - - env: COMPILER_NAME=g++ _CXX=g++-6 _CC=gcc-6 + - env: distribution=ubuntu-18.04 os: linux language: cpp - addons: - apt: - sources: - - *default_sources - packages: - - *default_packages - - g++-6 + +before_install: + - docker build -t ${distribution} - < .ci/Dockerfile-${distribution} + script: - - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then - CMAKE_URL="http://www.cmake.org/files/v3.7/cmake-3.7.0-Linux-x86_64.tar.gz"; - mkdir cmake-bin && wget --quiet --no-check-certificate -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake-bin; - export PATH=${PWD}/cmake-bin/bin:${PATH}; - fi - - git submodule update --init --recursive - - mkdir -p build/debug - - cd build/debug - - cmake ../.. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_COMPILER=$_CXX -DCMAKE_C_COMPILER=$_CC -DANTHEM_BUILD_TESTS=ON - - make -j3 anthem-app && make -j3 run-tests + - docker run --mount source=$(pwd),target=/app,type=bind -w /app ${distribution} /bin/bash -c ".ci/ci.sh"