diff options
Diffstat (limited to '.travis.yml')
-rw-r--r-- | .travis.yml | 75 |
1 files changed, 58 insertions, 17 deletions
diff --git a/.travis.yml b/.travis.yml index 36bbf62..a003124 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -3,27 +3,68 @@ language: python | |||
3 | python: "2.7" | 3 | python: "2.7" |
4 | 4 | ||
5 | # Use the new container infrastructure | 5 | # Use the new container infrastructure |
6 | sudo: false | 6 | sudo: required |
7 | 7 | ||
8 | # Install ansible | 8 | services: |
9 | addons: | 9 | - docker |
10 | apt: | ||
11 | packages: | ||
12 | - python-pip | ||
13 | 10 | ||
14 | install: | 11 | env: |
15 | # Install ansible | 12 | - distribution: centos |
16 | - pip install ansible | 13 | init: /usr/lib/systemd/systemd |
14 | version: 7 | ||
15 | - distribution: fedora | ||
16 | init: /usr/lib/systemd/systemd | ||
17 | version: 29 | ||
18 | - distribution: fedora | ||
19 | init: /usr/lib/systemd/systemd | ||
20 | version: 28 | ||
21 | - distribution: fedora | ||
22 | init: /usr/lib/systemd/systemd | ||
23 | version: 27 | ||
24 | - distribution: fedora | ||
25 | init: /usr/lib/systemd/systemd | ||
26 | version: 26 | ||
27 | - distribution: fedora | ||
28 | init: /usr/lib/systemd/systemd | ||
29 | version: 25 | ||
30 | - distribution: fedora | ||
31 | init: /usr/lib/systemd/systemd | ||
32 | version: 24 | ||
33 | - distribution: ubuntu | ||
34 | init: /lib/systemd/systemd | ||
35 | version: bionic | ||
36 | - distribution: ubuntu | ||
37 | init: /lib/systemd/systemd | ||
38 | version: xenial | ||
39 | # - distribution: ubuntu | ||
40 | # init: /sbin/init | ||
41 | # version: trusty | ||
42 | - distribution: debian | ||
43 | init: /lib/systemd/systemd | ||
44 | version: stretch | ||
45 | # - distribution: debian | ||
46 | # init: /lib/systemd/systemd | ||
47 | # version: jessie | ||
17 | 48 | ||
18 | # Check ansible version | 49 | before_install: |
19 | - ansible --version | 50 | - "sudo pip install yamllint" |
20 | 51 | - yamllint -c .yamllint.yml . | |
21 | # Create ansible.cfg with correct roles_path | 52 | - "sudo docker pull ${distribution}:${version}" |
22 | - printf '[defaults]\nroles_path=../' >ansible.cfg | 53 | - "sudo docker build --no-cache --rm --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests" |
23 | 54 | ||
24 | script: | 55 | script: |
25 | # Basic role syntax check | 56 | - container_id=$(mktemp) |
26 | - ansible-playbook tests/test.yml -i tests/inventory --syntax-check | 57 | - role_name="ansible-rabbitmq" |
58 | - 'sudo docker run --detach --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/etc/ansible/roles/${role_name}:ro ${distribution}-${version}:ansible ${init} > "${container_id}"' | ||
59 | - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-lint -c /.ansible-lint /etc/ansible/roles/${role_name}/tests/test.yml' | ||
60 | - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml --syntax-check' | ||
61 | - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml' | ||
62 | - > | ||
63 | sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml | ||
64 | | grep -q 'changed=0.*failed=0' | ||
65 | && (echo 'Idempotence test: pass' && exit 0) | ||
66 | || (echo 'Idempotence test: fail' && exit 1) | ||
67 | - 'sudo docker rm -f "$(cat ${container_id})"' | ||
27 | 68 | ||
28 | notifications: | 69 | notifications: |
29 | webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file | 70 | webhooks: https://galaxy.ansible.com/api/v1/notifications/ |