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.
This commit is contained in:
Patrick Lühne 2018-03-23 17:27:20 +01:00 committed by Patrick Lühne
parent 6b1cf6735e
commit c7d1026a31
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
4 changed files with 31 additions and 40 deletions

View File

@ -0,0 +1,6 @@
FROM archimg/base-devel:latest
RUN pacman -Sy
RUN pacman -S --noconfirm boost cmake git ninja re2c
VOLUME /app

View File

@ -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

7
.ci/ci.sh Executable file
View File

@ -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

View File

@ -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"