Browse Source

travis: switch to building inside containers

Travis host images are quite outdated, so the builds will now use containers
instead. By default there's a build for Arch Linux (using base/archlinux:latest
image) and Fedora (using official fedora:latest).

Builds are done using extra/travis-build script.
bboozzoo/dbus-support-interfaces
Maciek Borzecki 8 years ago
parent
commit
eb114687b5
2 changed files with 126 additions and 20 deletions
  1. +8
    -20
      .travis.yml
  2. +118
    -0
      extra/travis-build

+ 8
- 20
.travis.yml View File

@ -1,22 +1,10 @@
# default 12.04 is ancient, use trusty instead
dist: trusty
# pretend we're building C
language: c
compiler:
- gcc
services:
- docker
env: env:
- VALAC=valac-0.32
before_install:
- sudo add-apt-repository -y ppa:vala-team/ppa
- sudo apt-get update -qq
- sudo apt-get install -qq ${VALAC} valac
- sudo apt-get install -qq libgirepository1.0-dev
- sudo apt-get install -qq gir1.2-gee-0.8 libgee-0.8-dev
- sudo apt-get install -qq gir1.2-json-1.0 libjson-glib-dev
- sudo apt-get install -qq gir1.2-notify-0.7 libnotify-dev
- sudo apt-get install -qq gir1.2-atspi-2.0 libatspi2.0-dev
- sudo apt-get install -qq gir1.2-gtk-3.0 libgtk-3-dev
before_script:
- autoreconf -if
matrix:
- DISTRO=fedora
- DISTRO=archlinux
script: script:
- ./configure && make V=1
- ./extra/travis-build "${DISTRO}"

+ 118
- 0
extra/travis-build View File

@ -0,0 +1,118 @@
#!/bin/bash -xe
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# AUTHORS
# Maciek Borzecki <maciek.borzecki (at] gmail.com>
# Travis build script. The script reexecs itself inside the container (setting
# IN_CONTAINER=1). The proceeds to install build dependencies and runs through
# the whole build process. Source tree is bind-mounted at /mnt and the container
# has its workdir set to /mnt
#
# NOTE: it is assumed that the script is run while at the top of source tree
# (i.e. $PWD is your checked out tree, this crucial for properly mounting the
# source code into the container).
deps_fedora() {
dnf install --best -y --refresh \
automake \
autoconf \
libtool \
pkgconfig \
gcc \
vala \
gobject-introspection-devel \
json-glib-devel \
libgee-devel \
openssl-devel \
libnotify-devel \
at-spi2-core-devel \
gtk3-devel
}
deps_archlinux() {
pacman -Syu --noconfirm \
base-devel \
autoconf \
automake \
libtool \
pkg-config \
gcc \
vala \
glib2 \
gobject-introspection \
json-glib \
libgee \
openssl \
libnotify \
at-spi2-core \
gtk3
}
install_deps() {
case "$1" in
fedora)
deps_fedora
;;
archlinux)
deps_archlinux
;;
*)
echo "unsupported distro $1"
exit 1
esac
}
build() {
autoreconf -if
# TODO: out of source builds
./configure
make
make install
}
build_in_container() {
install_deps $1
build
}
spin_container() {
case "$1" in
fedora)
DOCKER_IMG=fedora
;;
archlinux)
DOCKER_IMG=base/archlinux
;;
*)
echo "unsupported distro $1"
exit 1
esac
# run a container, mount sources at /mnt, st
docker run --rm \
-v $PWD:/mnt \
-w /mnt \
-e IN_CONTAINER=1 \
$DOCKER_IMG \
/mnt/extra/travis-build "$@"
}
if [ "$IN_CONTAINER" = "1" ]; then
build_in_container "$@"
else
spin_container "$@"
fi

Loading…
Cancel
Save