Skip to content

Commit

Permalink
Updated Travis CI file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frzk committed Mar 18, 2019
1 parent f5fa662 commit ecd1367
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 63 deletions.
62 changes: 17 additions & 45 deletions .travis.yml
@@ -1,56 +1,28 @@
---
sudo: required
language: bash
language: python
services:
- docker

# Build matrix
env:
- distribution: centos
version: 7
- distribution: debian
version: 9
- distribution: ubuntu
version: 16.04
- distribution: ubuntu
version: 18.04

before_install:
# Pull the image corresponding to the environment vars from Docker Hub:
- docker pull "kblr/${distribution}${version}-ansible:latest"
global:
- ROLENAME=chrony
matrix:
- DISTRIBUTION=centos7
- DISTRIBUTION=debian9
- DISTRIBUTION=ubuntu16.04
- DISTRIBUTION=ubuntu18.04

install:
- pip install molecule docker

before_script:
- cd ..
- mv ansible-role-$ROLENAME frzk.$ROLENAME
- cd frzk.$ROLENAME

script:
# 0/ Run the container:
- >
docker run
--name "${TRAVIS_COMMIT}.${distribution}-${version}"
--detach
--privileged
--mount type=bind,source=/sys/fs/cgroup,target=/sys/fs/cgroup,readonly
--mount type=bind,source="$(pwd)",target=/etc/ansible/roles/under_test,readonly
"kblr/${distribution}${version}-ansible:latest"
# 1/ Check role syntax:
- >
docker exec "${TRAVIS_COMMIT}.${distribution}-${version}"
ansible-playbook -v /etc/ansible/roles/under_test/tests/test.yml --syntax-check
# 2/ Check first run:
- >
docker exec "${TRAVIS_COMMIT}.${distribution}-${version}"
ansible-playbook -v /etc/ansible/roles/under_test/tests/test.yml
# 3/ Check idempotence:
- >
docker exec "${TRAVIS_COMMIT}.${distribution}-${version}"
ansible-playbook -v /etc/ansible/roles/under_test/tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
after_script:
# Remove container:
- docker rm -f "${TRAVIS_COMMIT}.${distribution}-${version}"
- molecule test

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
Expand Down
16 changes: 0 additions & 16 deletions molecule/default/INSTALL.rst

This file was deleted.

2 changes: 1 addition & 1 deletion molecule/default/molecule.yml
Expand Up @@ -9,7 +9,7 @@ lint:
config-file: molecule/default/yamllint.yml
platforms:
- name: instance
image: "frzk/${MOLECULE_DISTRO:-centos7}-ansible"
image: "frzk/docker-${DISTRIBUTION:-centos7}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
Expand Down
2 changes: 1 addition & 1 deletion molecule/default/playbook.yml
Expand Up @@ -2,4 +2,4 @@
- name: Converge
hosts: all
roles:
- role: ansible-role-chrony
- role: frzk.chrony

0 comments on commit ecd1367

Please sign in to comment.