ansible-role-nfs/.travis.yml

44 lines
1.5 KiB
YAML
Raw Normal View History

---
services: docker
env:
2016-09-14 05:15:09 +02:00
- distro: centos7
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
2016-09-14 05:25:20 +02:00
# - distro: ubuntu1604
# init: /lib/systemd/systemd
# run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
2016-09-14 05:15:09 +02:00
- distro: ubuntu1404
init: /sbin/init
run_opts: ""
- distro: ubuntu1204
init: /sbin/init
run_opts: ""
before_install:
2016-09-14 05:15:09 +02:00
# Pull container.
- 'docker pull geerlingguy/docker-${distro}-ansible:latest'
script:
2016-09-14 05:15:09 +02:00
- container_id=$(mktemp)
# Run container in detached state.
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'
2016-09-14 05:15:09 +02:00
# Ansible syntax check.
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'
2016-09-14 05:15:09 +02:00
# Test role.
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml'
2016-09-14 05:15:09 +02:00
# Test role idempotence.
- idempotence=$(mktemp)
- docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml | tee -a ${idempotence}
- >
2016-09-14 05:15:09 +02:00
tail ${idempotence}
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
2016-02-02 18:18:37 +01:00
notifications:
2016-09-14 05:15:09 +02:00
webhooks: https://galaxy.ansible.com/api/v1/notifications/