Skip to content
Permalink
Browse files

travis: Use Docker to run the tests

LLVM/Clang upstream has closed down their APT repo, and there is no easy
way to get a more recent version of the LLVM stack on Trusty.
Since we actually want to build on Xenial anyway, we now run the
AppStream tests in a Xenial Docker container.
  • Loading branch information...
ximion committed Jun 2, 2016
1 parent 94da019 commit 65f44e537542d1b62ab7602a567fc6ab8cf03642
Showing with 80 additions and 30 deletions.
  1. +8 −30 .travis.yml
  2. +47 −0 tests/ci/Dockerfile
  3. +25 −0 tests/ci/build_and_test.sh
@@ -2,41 +2,19 @@

language: c
sudo: required
dist: trusty # we would actually rather want xenial :-/
dist: trusty

services:
- docker

compiler:
- gcc
- clang

before_script:
# set up a more recent toolchain
- sudo add-apt-repository -y "ppa:ubuntu-toolchain-r/test"
- wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key|sudo apt-key add -
- sudo apt-add-repository -y "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.8 main"
- sudo apt-get update -qq
- sudo apt-get install --yes -q gcc-5 g++-5 clang-3.8
- if [ "$CC" = "gcc" ]; then export CXX="g++-5" CC="gcc-5"; fi
- if [ "$CC" = "clang" ]; then export CXX="clang++-3.8" CC="clang-3.8"; fi
# set up build prerequisites
- sudo add-apt-repository -y "ppa:ximion/packagekit"
- sudo add-apt-repository -y "ppa:swooshycueb/qt5-stuff"
- sudo apt-get update -qq
- sudo apt-get install --yes -q cmake intltool libglib2.0-dev libxml2-dev gtk-doc-tools libgirepository1.0-dev qt5-default
libxapian-dev libyaml-dev xmlto publican gobject-introspection libprotobuf-dev protobuf-compiler valac
# dirty hack to ensure Xapian doesn't complain about compiler ABI mismatch
- mkdir tmp && cd tmp && sudo apt purge --yes aptitude libxapian22
- sudo apt-get build-dep --yes -q xapian-core
- apt-get source xapian-core && cd xapian-core-1.2.16
- ./configure --prefix=/usr --sysconfdir=/etc && make -j2 && sudo make install
- cd ../.. && sudo rm -r tmp/
- docker build -t appstream -f tests/ci/Dockerfile .
- if [ "$CC" = "gcc" ]; then export CXX="g++-6" CC="gcc-6"; fi

script:
- mkdir build && cd build
- cmake -DMAINTAINER=ON -DDOCUMENTATION=ON -DQT=ON -DAPT_SUPPORT=ON -DVAPI=ON ..
- make all documentation
- make test ARGS=-V
- make install DESTDIR=./install_root/
# now run tests with sanitizers enabled as well
- make clean && cmake -DMAINTAINER=ON -DDOCUMENTATION=ON -DQT=ON -DAPT_SUPPORT=ON -DVAPI=ON -DSANITIZERS=ON ..
# compilation with ASAN doesn't work on Clang at time, so disable it temporarily
- if [ "$CC" != "clang-3.8" ]; then make && make test ARGS=-V; fi
- docker run -t -e CC=$CC -e CXX=$CXX -v `pwd`:/build appstream
./tests/ci/build_and_test.sh
@@ -0,0 +1,47 @@
#
# Docker file for AppStream CI tests
#
FROM ubuntu:xenial

# prepare
RUN apt-get update -qq
RUN apt-get -yq install software-properties-common

# add repo for GCC 6
RUN add-apt-repository -y "ppa:ubuntu-toolchain-r/test"
RUN apt-get update

# install build essentials
RUN apt-get install -yq gcc-6 clang

# install build dependencies
RUN apt-get install -yq --no-install-recommends \
cmake \
intltool \
libglib2.0-dev \
libxml2-dev \
gtk-doc-tools \
libgirepository1.0-dev \
qt5-default \
libxapian-dev \
libyaml-dev \
xmlto \
publican \
gobject-introspection \
libprotobuf-dev \
protobuf-compiler \
valac

# rebuild Xapian, so it doesn't complain about compiler ABI mismatch
RUN mkdir /build-tmp
RUN apt-get build-dep -yq --no-install-recommends xapian-core
RUN cd /build-tmp && \
apt-get source xapian-core && mv xapian-core-1.2.22 xapian-src
RUN cd /build-tmp/xapian-src && \
./configure --prefix=/usr --sysconfdir=/etc
RUN cd /build-tmp/xapian-src && \
CC="gcc-6" CXX="g++-6" make -j2 && make install

# finish
RUN mkdir /build
WORKDIR /build
@@ -0,0 +1,25 @@
#!/bin/sh
set -e

echo "C compiler: $CC"
echo "C++ compiler: $CXX"
set -x

#
# This script is supposed to run inside the AppStream Docker container
# on the CI system.
#

# configure AppStream build with all flags enabled
mkdir build && cd build
cmake -DMAINTAINER=ON -DDOCUMENTATION=ON -DQT=ON -DAPT_SUPPORT=ON -DVAPI=ON ..

# Build, Test & Install
make all documentation
make test ARGS=-V
make install DESTDIR=./install_root/

# Rebuild everything with Sanitizers enabled
# FIXME: Doesn't work properly with Clang at time, so we only run this test with GCC.
make clean && cmake -DMAINTAINER=ON -DDOCUMENTATION=ON -DQT=ON -DAPT_SUPPORT=ON -DVAPI=ON -DSANITIZERS=ON ..
if [ "$CC" != "clang" ]; then make && make test ARGS=-V; fi

0 comments on commit 65f44e5

Please sign in to comment.
You can’t perform that action at this time.