mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Configure travis to use docker for CI
Currently, there is an ubuntu 14.04 and archlinux build and they both use cmake with ninja, cmake with make, and autotools to build. It should be straightforward to add another configuration. Travis checks out the correct branch of the source code for us, and we expose that source code to the docker container using a docker run "volume".
This commit is contained in:
parent
a1bc2d0202
commit
121dd8cf90
36
.travis.yml
36
.travis.yml
@ -1,26 +1,20 @@
|
||||
# Test
|
||||
sudo: required
|
||||
dist: trusty
|
||||
branches:
|
||||
except:
|
||||
- trunk
|
||||
language: c++
|
||||
compiler:
|
||||
- gcc
|
||||
# - clang
|
||||
compiler: gcc
|
||||
env:
|
||||
- BUILDTYPE=cmake-make
|
||||
- BUILDTYPE=cmake-ninja
|
||||
- BUILDTYPE=autotools
|
||||
before_install:
|
||||
# - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
- sudo apt-get update -qq
|
||||
- BUILDENV=arch BUILDTYPE=cmake-make
|
||||
- BUILDENV=arch BUILDTYPE=cmake-ninja
|
||||
- BUILDENV=arch BUILDTYPE=autotools
|
||||
- BUILDENV=ubuntu-14.04 BUILDTYPE=cmake-make
|
||||
- BUILDENV=ubuntu-14.04 BUILDTYPE=cmake-ninja
|
||||
- BUILDENV=ubuntu-14.04 BUILDTYPE=autotools
|
||||
services:
|
||||
- docker
|
||||
install:
|
||||
# - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.9; export CXX="g++-4.9" CC="gcc-4.9"; fi
|
||||
- sudo apt-get build-dep -qq gnucash
|
||||
- sudo apt-get install -qq swig xsltproc libdbd-sqlite3 cmake3 texinfo ninja-build
|
||||
- sudo apt-get install -qq libboost-all-dev libgtk-3-dev libwebkit2gtk-3.0-dev
|
||||
- sudo apt-get --reinstall install -qq language-pack-en language-pack-fr
|
||||
- git clone https://github.com/google/googletest -b release-1.8.0 ~/gtest
|
||||
script: ./util/travis-script.sh
|
||||
after_failure: ./util/travis-after-failure.sh
|
||||
- docker --version
|
||||
- echo BUILDENV="$BUILDENV"
|
||||
- docker build -f util/ci/${BUILDENV}-docker -t ${BUILDENV}-gnucashbuild util/ci
|
||||
script:
|
||||
- echo BUILDTYPE="$BUILDTYPE"
|
||||
- docker run -v "$(pwd)":/gnucash:rw --env="BUILDTYPE=$BUILDTYPE" --rm ${BUILDENV}-gnucashbuild
|
||||
|
23
util/ci/afterfailure
Executable file
23
util/ci/afterfailure
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ "$BUILDTYPE" == "cmake-make" ]] || [[ "$BUILDTYPE" == "cmake-ninja" ]]; then
|
||||
echo "########################";
|
||||
echo "##### LastTest.log #####";
|
||||
echo "########################";
|
||||
cat /build/Testing/Temporary/LastTest.log;
|
||||
elif [[ "$BUILDTYPE" == "autotools" ]]; then
|
||||
find . -name 'test*.log' -print0 |
|
||||
while IFS= read -r -d '' logfile; do
|
||||
SIZE=$((${#logfile} + 12));
|
||||
HRULE=$(head -c "$SIZE" < /dev/zero | tr '\0' '#');
|
||||
echo $HRULE;
|
||||
echo "##### ${logfile} #####";
|
||||
echo $HRULE;
|
||||
cat -- "$logfile";
|
||||
echo $'\n'$'\n';
|
||||
done;
|
||||
else
|
||||
echo "Unknown BUILDTYPE: \"$BUILDTYPE\", cannot create failure information.";
|
||||
fi
|
||||
# This script should fail so that the entire script will fail.
|
||||
exit 1;
|
11
util/ci/arch-docker
Normal file
11
util/ci/arch-docker
Normal file
@ -0,0 +1,11 @@
|
||||
from base/archlinux
|
||||
#run pacman -Syu --quiet --noconfirm > /dev/null
|
||||
#run pacman -S --noconfirm archlinux-keyring
|
||||
run pacman -Syu --quiet --noconfirm gcc cmake make autoconf automake boost python2 pkg-config guile2.0 guile git ninja gtest gmock sqlite3 webkit2gtk swig gwenhywfar aqbanking intltool libxslt postgresql-libs libmariadbclient libdbi libdbi-drivers > /dev/null
|
||||
run echo en_US.UTF-8 UTF-8 >> /etc/locale.gen
|
||||
run echo en_GB.UTF-8 UTF-8 >> /etc/locale.gen
|
||||
run echo fr_FR.UTF-8 UTF-8 >> /etc/locale.gen
|
||||
run locale-gen
|
||||
copy arch-testscript afterfailure commonbuild /
|
||||
run chmod +x /arch-testscript /afterfailure /commonbuild
|
||||
entrypoint /arch-testscript
|
18
util/ci/arch-testscript
Normal file
18
util/ci/arch-testscript
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash -le
|
||||
|
||||
#-l above (login shell) so that /etc/profile runs so that perl is
|
||||
# on the path.
|
||||
|
||||
#-e so that if any command has an exit code != 0, this script will
|
||||
# exit immediately.
|
||||
|
||||
# Python is python 3, but gnucash doesn't work with python 3. There
|
||||
# doesn't seem to be a way to tell automake to use /usr/bin/python2,
|
||||
# so we'll mock this up
|
||||
mkdir autotools_bin;
|
||||
ln -s /usr/bin/python2 autotools_bin/python;
|
||||
export PATH=/autotools_bin:"$PATH";
|
||||
echo path is "$PATH";
|
||||
echo python version is "$(python --version)";
|
||||
|
||||
../commonbuild
|
25
util/ci/commonbuild
Normal file
25
util/ci/commonbuild
Normal file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
mkdir build;
|
||||
cd build;
|
||||
export TZ="America/Los_Angeles";
|
||||
|
||||
mkdir -p /root/.local/share;
|
||||
|
||||
if [[ "$BUILDTYPE" == "cmake-make" ]]; then
|
||||
cmake ../gnucash
|
||||
make -j 4;
|
||||
make check || ../afterfailure;
|
||||
elif [[ "$BUILDTYPE" == "cmake-ninja" ]]; then
|
||||
cmake ../gnucash -DCMAKE_BUILD_TYPE=debug -DENABLE_DEBUG=on -G Ninja
|
||||
ninja
|
||||
ninja check || ../afterfailure;
|
||||
elif [[ "$BUILDTYPE" == "autotools" ]]; then
|
||||
../gnucash/autogen.sh;
|
||||
../gnucash/configure --enable-python;
|
||||
make;
|
||||
make check || ../afterfailure;
|
||||
else
|
||||
echo "Unknown buildtype: \"$BUILDTYPE\". Not building.";
|
||||
fi
|
||||
|
11
util/ci/ubuntu-14.04-docker
Normal file
11
util/ci/ubuntu-14.04-docker
Normal file
@ -0,0 +1,11 @@
|
||||
from ubuntu:14.04
|
||||
#sudo apt-get install -qq software-properties-common
|
||||
#sudo add-apt-repository -qq ppa:george-edison55/cmake-3.x
|
||||
run apt-get update -qq
|
||||
run apt-get build-dep -qq gnucash > /dev/null
|
||||
run apt-get install -qq git bash-completion cmake3 make swig xsltproc libdbd-sqlite3 texinfo ninja-build libboost-all-dev libgtk-3-dev libwebkit2gtk-3.0-dev > /dev/null
|
||||
run apt-get --reinstall install -qq language-pack-en language-pack-fr
|
||||
run git clone https://github.com/google/googletest -b release-1.8.0 gtest
|
||||
copy ubuntu-14.04-testscript afterfailure commonbuild /
|
||||
run chmod +x /ubuntu-14.04-testscript /afterfailure /commonbuild
|
||||
entrypoint /ubuntu-14.04-testscript
|
8
util/ci/ubuntu-14.04-testscript
Normal file
8
util/ci/ubuntu-14.04-testscript
Normal file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# -e above so that if any command has an exit code != 0, this script will
|
||||
# exit immediately.
|
||||
|
||||
export GTEST_ROOT=/gtest/googletest GMOCK_ROOT=/gtest/googlemock;
|
||||
|
||||
../commonbuild
|
@ -1,19 +0,0 @@
|
||||
#! /bin/bash
|
||||
|
||||
# Build logs are located in different places depending on the build environment used
|
||||
if [[ "$BUILDTYPE" == "cmake-make" ]] || [[ "$BUILDTYPE" == "cmake-ninja" ]]; then
|
||||
echo "##### LastTest.log #####"
|
||||
echo "#########################"
|
||||
cat /tmp/gnucash-build-${BUILDTYPE}/Testing/Temporary/LastTest.log
|
||||
elif [[ "$BUILDTYPE" == "autotools" ]]; then
|
||||
for logfile in $( find . -name 'test*.log' ); do
|
||||
SIZE=$((${#logfile} + 12))
|
||||
HRULE=$(head -c $SIZE < /dev/zero | tr '\0' '#')
|
||||
echo $HRULE
|
||||
echo "##### ${logfile} #####"
|
||||
echo $HRULE
|
||||
cat -- "$logfile"
|
||||
echo -e "\n\n"
|
||||
done
|
||||
fi
|
||||
|
@ -1,30 +0,0 @@
|
||||
#! /bin/bash -ev
|
||||
# The -e above says that if any line below fails, the whole script fails
|
||||
|
||||
# Run tests in different build configurations depending on the
|
||||
# value of the BUILDTYPE environment variable
|
||||
# 1. cmake build using the default Makefile generator
|
||||
if [[ "$BUILDTYPE" == "cmake-make" ]]; then
|
||||
mkdir /tmp/gnucash-build-cmake-make
|
||||
cd /tmp/gnucash-build-cmake-make
|
||||
GTEST_ROOT=~/gtest/googletest GMOCK_ROOT=~/gtest/googlemock cmake $TRAVIS_BUILD_DIR
|
||||
make -j 4
|
||||
TZ="America/Los_Angeles" make check
|
||||
|
||||
# 2. cmake build using the Ninja generator
|
||||
elif [[ "$BUILDTYPE" == "cmake-ninja" ]]; then
|
||||
mkdir /tmp/gnucash-build-cmake-ninja
|
||||
cd /tmp/gnucash-build-cmake-ninja
|
||||
GTEST_ROOT=~/gtest/googletest GMOCK_ROOT=~/gtest/googlemock cmake -G Ninja $TRAVIS_BUILD_DIR
|
||||
ninja
|
||||
TZ="America/Los_Angeles" ninja check
|
||||
|
||||
# 3. autotools build
|
||||
elif [[ "$BUILDTYPE" == "autotools" ]]; then
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
./autogen.sh
|
||||
./configure --enable-python GTEST_ROOT=~/gtest/googletest GMOCK_ROOT=~/gtest/googlemock
|
||||
make
|
||||
TZ="America/Los_Angeles" make check
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user