Enable testing in Travis CI using Docker container

This commit is contained in:
Alexander Todorov 2017-12-14 12:24:57 +02:00 committed by Brian C. Lane
parent 176b12dd8c
commit c90ea64e59
4 changed files with 54 additions and 0 deletions

22
.travis.yml Normal file
View File

@ -0,0 +1,22 @@
sudo: required
language: python
services:
- docker
script:
- make test-in-docker
after_success:
- |
sudo docker create --name results-cont welder/lorax-composer
sudo docker cp results-cont:/lorax/.coverage .coverage
sudo docker rm results-cont
pip install coveralls
coveralls
notifications:
email:
on_failure: change
on_success: never

21
Dockerfile.test Normal file
View File

@ -0,0 +1,21 @@
FROM centos:7
COPY epel.repo /etc/yum.repos.d/
RUN yum -y install --nogpgcheck epel-release && \
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-* && \
yum -y install make libgit2-glib tito python-pylint \
python-nose python-mako python-flask \
python-coverage libselinux-python \
pykickstart python2-pytoml \
python2-mock python-semantic_version && \
yum clean all && \
rm -rf /var/cache/yum
RUN mkdir /lorax
COPY Makefile /lorax
COPY src/ /lorax/src
COPY tests/ /lorax/tests
WORKDIR /lorax
RUN make test

View File

@ -58,6 +58,9 @@ local:
@rm -rf /var/tmp/$(PKGNAME)-$(VERSION)
@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
test-in-docker:
sudo docker build -t welder/lorax-composer:latest -f Dockerfile.test .
ci: check test
.PHONY: all install check test clean tag docs archive local

8
epel.repo Normal file
View File

@ -0,0 +1,8 @@
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7