Permalink
Browse files

Use Docker on travis for CI

  • Loading branch information...
spk committed Jan 25, 2016
1 parent 215e06a commit 3ef34bdb4793c1e9362e13d30131687b89781b58
Showing with 29 additions and 12 deletions.
  1. +3 −12 .travis.yml
  2. +26 −0 Dockerfile
@@ -1,17 +1,8 @@
---
sudo: required
dist: precise
language: python
python: 2.7.11
env:
- SITE=test.yml
install:
- pip install ansible ansible-lint --upgrade
- ansible --version
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"
services:
- docker
script:
- "ansible-playbook -i tests/inventory tests/$SITE --syntax-check"
- "ansible-lint tests/$SITE"
- docker build .
@@ -0,0 +1,26 @@
FROM debian:stretch
MAINTAINER Laurent Arnoud <laurent@spkdev.net>
ENV ROLE_NAME ansible-syncthing-debian
ENV WORKDIR /build/${ROLE_NAME}
ENV PYTHONUNBUFFERED 1
WORKDIR ${WORKDIR}
RUN apt-get update -qq \
&& apt-get -y --no-install-recommends install ansible python-pip \
&& apt-get purge -y \
&& apt-get autoremove -y \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN pip install ansible-lint
ADD . ${WORKDIR}
ADD . /etc/ansible/roles/${ROLE_NAME}
ADD ./tests/inventory /etc/ansible/hosts
RUN ansible-playbook -i $WORKDIR/tests/inventory $WORKDIR/tests/test.yml --syntax-check
RUN ansible-lint $WORKDIR/tests/test.yml
RUN ansible-playbook -i $WORKDIR/tests/inventory $WORKDIR/tests/test.yml --connection=local
RUN ansible-playbook -i $WORKDIR/tests/inventory $WORKDIR/tests/test.yml --connection=local \
| grep -q 'changed=0.*failed=0' \
&& (echo 'Idempotence test: pass' && exit 0) \
|| (echo 'Idempotence test: fail' && exit 1)
RUN syncthing -version

0 comments on commit 3ef34bd

Please sign in to comment.