Skip to content

Commit

Permalink
Use Docker on travis for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
spk committed Jan 25, 2016
1 parent 215e06a commit 3ef34bd
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
15 changes: 3 additions & 12 deletions .travis.yml
@@ -1,17 +1,8 @@
--- ---
sudo: required sudo: required
dist: precise
language: python
python: 2.7.11


env: services:
- SITE=test.yml - docker

install:
- pip install ansible ansible-lint --upgrade
- ansible --version
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"


script: script:
- "ansible-playbook -i tests/inventory tests/$SITE --syntax-check" - docker build .
- "ansible-lint tests/$SITE"
26 changes: 26 additions & 0 deletions Dockerfile
@@ -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.