tests: Implement Travis-based Multi-OS CI service

This commit implements (after the example of taskwarrior) a Travis-based
multi-OS continuous integration service, that tests on a variety of
Linux-based hosts and Mac OS X.
This commit is contained in:
Tomas Babej 2019-01-02 18:34:32 -05:00 committed by lauft
parent 37a3aa0ccf
commit bdb98553fb
13 changed files with 415 additions and 0 deletions

49
.travis.yml Normal file
View file

@ -0,0 +1,49 @@
sudo: required
language: generic
matrix:
include:
- name: "Gentoo (latest)"
os: linux
env: CONTAINER=gentoo
services: docker
- name: "Fedora 28"
os: linux
env: CONTAINER=fedora28
services: docker
- name: "Fedora 29"
os: linux
env: CONTAINER=fedora28
services: docker
- name: "Debian Stable"
os: linux
env: CONTAINER=debianstable
services: docker
- name: "Debian Testing"
os: linux
env: CONTAINER=debiantesting
services: docker
- name: "Ubuntu 16.04"
os: linux
env: CONTAINER=ubuntu1604
services: docker
- name: "Ubuntu 18.04"
os: linux
env: CONTAINER=ubuntu1804
services: docker
- name: "OpenSUSE 15.0"
os: linux
env: CONTAINER=opensuse1500
services: docker
- name: "Archlinux 2018.01.01"
os: linux
env: CONTAINER=arch180101
services: docker
- name: "Mac OS X 10.13"
os: osx
env: CONTAINER=osx
install:
# Build the docker container
- pushd $TRAVIS_BUILD_DIR
- if [[ $CONTAINER != "osx" ]]; then docker-compose build test-$CONTAINER ; fi
script:
- if [[ $CONTAINER != "osx" ]]; then docker-compose run test-$CONTAINER; else bash test/scripts/test_osx.sh ; fi

74
docker-compose.yml Normal file
View file

@ -0,0 +1,74 @@
version: '3'
services:
test-fedora28:
build:
context: .
dockerfile: test/docker/fedora28
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-fedora29:
build:
context: .
dockerfile: test/docker/fedora29
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-ubuntu1604:
build:
context: .
dockerfile: test/docker/ubuntu1604
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-ubuntu1804:
build:
context: .
dockerfile: test/docker/ubuntu1804
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-debianstable:
build:
context: .
dockerfile: test/docker/debianstable
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-debiantesting:
build:
context: .
dockerfile: test/docker/debiantesting
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-gentoo:
build:
context: .
dockerfile: test/docker/gentoo
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-opensuse1500:
build:
context: .
dockerfile: test/docker/opensuse1500
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true
test-arch180101:
build:
context: .
dockerfile: test/docker/arch180101
network_mode: "host"
security_opt:
- label=type:container_runtime_t
tty: true

27
test/docker/arch180101 Normal file
View file

@ -0,0 +1,27 @@
FROM base/archlinux:2018.01.01
RUN pacman -Sy --noconfirm archlinux-keyring
RUN pacman -Syyu --noconfirm
RUN pacman -S --noconfirm gnutls util-linux bash-completion cmake python git libfaketime
RUN pacman -S --noconfirm make gcc
# Setup language environment
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Setup timewarrior
ADD . /root/code/
WORKDIR /root/code/
RUN git clean -dfx
RUN git submodule init
RUN git submodule update
RUN cmake -DCMAKE_BUILD_TYPE=debug .
RUN make -j2
RUN make install
RUN task --version
# Setup tests
WORKDIR /root/code/test/
RUN make
CMD ["bash", "-c", "./run_all -v ; cat all.log | grep 'not ok' ; ./problems"]

30
test/docker/centos7 Normal file
View file

@ -0,0 +1,30 @@
FROM centos:7
RUN yum update -y
RUN yum install python git gcc gcc-c++ make gnutls-devel libuuid-devel libfaketime -y
RUN yum install epel-release centos-release-scl -y
RUN yum install which cmake3 devtoolset-7-gcc* -y
RUN source scl_source enable devtoolset-7; gcc --version; cmake3 --version
RUN ln -s /usr/bin/cmake3 /usr/bin/cmake
# Setup language environment
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Setup timewarrior
ADD . /root/code/
WORKDIR /root/code/
RUN git clean -dfx
RUN git submodule init
RUN git submodule update
RUN source scl_source enable devtoolset-7; cmake -DCMAKE_BUILD_TYPE=debug .
RUN source scl_source enable devtoolset-7; make -j2
RUN source scl_source enable devtoolset-7; make install
RUN task --version
# Setup tests
WORKDIR /root/code/test/
RUN source scl_source enable devtoolset-7; make
CMD ["bash", "-c", "./run_all -v ; cat all.log | grep 'not ok' ; ./problems"]

27
test/docker/debianstable Normal file
View file

@ -0,0 +1,27 @@
FROM debian:stable
RUN apt-get update
RUN apt-get install -y build-essential cmake git uuid-dev libgnutls28-dev libfaketime
RUN apt-get install -y python
# Setup language environment
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Setup timewarrior
ADD . /root/code/
WORKDIR /root/code/
RUN git clean -dfx
RUN git submodule init
RUN git submodule update
RUN cmake -DCMAKE_BUILD_TYPE=debug .
RUN make -j2
RUN make install
RUN task --version
# Setup tests
WORKDIR /root/code/test/
RUN make
CMD ["bash", "-c", "./run_all -v ; cat all.log | grep 'not ok' ; ./problems"]

27
test/docker/debiantesting Normal file
View file

@ -0,0 +1,27 @@
FROM debian:testing
RUN apt-get update
RUN apt-get install -y build-essential cmake git uuid-dev libgnutls28-dev libfaketime
RUN apt-get install -y python
# Setup language environment
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Setup timewarrior
ADD . /root/code/
WORKDIR /root/code/
RUN git clean -dfx
RUN git submodule init
RUN git submodule update
RUN cmake -DCMAKE_BUILD_TYPE=debug .
RUN make -j2
RUN make install
RUN task --version
# Setup tests
WORKDIR /root/code/test/
RUN make
CMD ["bash", "-c", "./run_all -v ; cat all.log | grep 'not ok' ; ./problems"]

26
test/docker/fedora28 Normal file
View file

@ -0,0 +1,26 @@
FROM fedora:28
RUN dnf update -y
RUN dnf install python git gcc gcc-c++ cmake make gnutls-devel libuuid-devel libfaketime -y
# Setup language environment
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Setup timewarrior
ADD . /root/code/
WORKDIR /root/code/
RUN git clean -dfx
RUN git submodule init
RUN git submodule update
RUN cmake -DCMAKE_BUILD_TYPE=debug .
RUN make -j2
RUN make install
RUN task --version
# Setup tests
WORKDIR /root/code/test/
RUN make
CMD ["bash", "-c", "./run_all -v ; cat all.log | grep 'not ok' ; ./problems"]

26
test/docker/fedora29 Normal file
View file

@ -0,0 +1,26 @@
FROM fedora:29
RUN dnf update -y
RUN dnf install python git gcc gcc-c++ cmake make gnutls-devel libuuid-devel libfaketime -y
# Setup language environment
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Setup timewarrior
ADD . /root/code/
WORKDIR /root/code/
RUN git clean -dfx
RUN git submodule init
RUN git submodule update
RUN cmake -DCMAKE_BUILD_TYPE=debug .
RUN make -j2
RUN make install
RUN task --version
# Setup tests
WORKDIR /root/code/test/
RUN make
CMD ["bash", "-c", "./run_all -v ; cat all.log | grep 'not ok' ; ./problems"]

32
test/docker/gentoo Normal file
View file

@ -0,0 +1,32 @@
# name the portage image
FROM gentoo/portage:latest as portage
# image is based on stage3-x86
FROM gentoo/stage3-x86:latest
# copy the entire portage volume in
COPY --from=portage /usr/portage /usr/portage
RUN emerge -qv sys-libs/readline:0 net-libs/gnutls:0= sys-apps/util-linux dev-util/cmake sys-devel/make dev-vcs/git sys-libs/libfaketime
# Setup language environment
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Setup timewarrior
ADD . /root/code/
WORKDIR /root/code/
RUN git clean -dfx
RUN git submodule init
RUN git submodule update
RUN cmake -DCMAKE_BUILD_TYPE=debug .
RUN make -j2
RUN make install
RUN task --version
# Setup tests
WORKDIR /root/code/test/
RUN make
CMD ["bash", "-c", "./run_all -v ; cat all.log | grep 'not ok' ; ./problems"]

25
test/docker/opensuse1500 Normal file
View file

@ -0,0 +1,25 @@
FROM opensuse/leap:15
RUN zypper install -y python awk coreutils git gcc gcc-c++ cmake make libgnutls-devel libuuid-devel libfaketime
# Setup language environment
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Setup timewarrior
ADD . /root/code/
WORKDIR /root/code/
RUN git clean -dfx
RUN git submodule init
RUN git submodule update
RUN cmake -DCMAKE_BUILD_TYPE=debug .
RUN make -j2
RUN make install
RUN task --version
# Setup tests
WORKDIR /root/code/test/
RUN make
CMD ["bash", "-c", "./run_all -v ; cat all.log | grep 'not ok' ; ./problems"]

27
test/docker/ubuntu1604 Normal file
View file

@ -0,0 +1,27 @@
FROM ubuntu:16.04
RUN apt-get update
RUN apt-get install -y build-essential cmake git uuid-dev libgnutls28-dev libfaketime
RUN apt-get install -y python
# Setup language environment
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Setup timewarrior
ADD . /root/code/
WORKDIR /root/code/
RUN git clean -dfx
RUN git submodule init
RUN git submodule update
RUN cmake -DCMAKE_BUILD_TYPE=debug .
RUN make -j2
RUN make install
RUN task --version
# Setup tests
WORKDIR /root/code/test/
RUN make
CMD ["bash", "-c", "./run_all -v ; cat all.log | grep 'not ok' ; ./problems"]

27
test/docker/ubuntu1804 Normal file
View file

@ -0,0 +1,27 @@
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install -y build-essential cmake git uuid-dev libgnutls28-dev libfaketime
RUN apt-get install -y python
# Setup language environment
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Setup timewarrior
ADD . /root/code/
WORKDIR /root/code/
RUN git clean -dfx
RUN git submodule init
RUN git submodule update
RUN cmake -DCMAKE_BUILD_TYPE=debug .
RUN make -j2
RUN make install
RUN task --version
# Setup tests
WORKDIR /root/code/test/
RUN make
CMD ["bash", "-c", "./run_all -v ; cat all.log | grep 'not ok' ; ./problems"]

18
test/scripts/test_osx.sh Normal file
View file

@ -0,0 +1,18 @@
set -x
brew install gnutls
brew install cmake
brew install libfaketime
git clean -dfx
git submodule init
git submodule update
cmake -DCMAKE_BUILD_TYPE=debug .
make -j2
make install
task --version
pushd test
make
./run_all -v
cat all.log | grep 'not ok'
./problems