-
Notifications
You must be signed in to change notification settings - Fork 5
/
.travis.yml
39 lines (32 loc) · 1.26 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
---
# Provide docker for testing other distros
sudo: required
services:
- docker
env:
- distribution: ubuntu
version: 14.04
init: /sbin/init
run_opts: ""
before_install:
- docker pull ${distribution}:${version}
- docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests
install:
- container_id=$(mktemp) # track container
- docker run -d --volume="${PWD}":/etc/ansible/roles/icecast:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"
- docker ps -a
script:
# Basic role syntax check
- docker exec --tty "$(< $container_id)" env TERM=xterm ansible-playbook /etc/ansible/roles/icecast/tests/test.yml --syntax-check
# Test role
- docker exec --tty "$(< $container_id)" env TERM=xterm ansible-playbook /etc/ansible/roles/icecast/tests/test.yml
# Check idempotence of role
- >
docker exec --tty "$(< $container_id)" env TERM=xterm ansible-playbook /etc/ansible/roles/icecast/tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
after_script:
- docker stop "$(< $container_id)"
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/