aboutsummaryrefslogtreecommitdiffhomepage
path: root/.travis.yml
blob: ef52f884a55ea2a35295e5e6b697d9fc11e13add (plain) (blame)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
language: python
python: "2.7"

# Use the new container infrastructure
sudo: required

services:
  - docker

env:
  - distribution: centos
    init: /usr/lib/systemd/systemd
    version: 7
  - distribution: fedora
    init: /usr/lib/systemd/systemd
    version: 29
  - distribution: fedora
    init: /usr/lib/systemd/systemd
    version: 28
  - distribution: fedora
    init: /usr/lib/systemd/systemd
    version: 27
  - distribution: fedora
    init: /usr/lib/systemd/systemd
    version: 26
  - distribution: fedora
    init: /usr/lib/systemd/systemd
    version: 25
  - distribution: fedora
    init: /usr/lib/systemd/systemd
    version: 24
  - distribution: ubuntu
    init: /lib/systemd/systemd
    version: bionic
  - distribution: ubuntu
    init: /lib/systemd/systemd
    version: xenial
  - distribution: ubuntu
    init: /sbin/init
    version: trusty
  - distribution: debian
    init: /lib/systemd/systemd
    version: stretch
  - distribution: debian
    init: /lib/systemd/systemd
    version: jessie

before_install:
  - "sudo pip install yamllint"
  - yamllint -c .yamllint.yml .
  - "sudo docker pull ${distribution}:${version}"
  - "sudo docker build --no-cache --rm --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests"

script:
  - container_id=$(mktemp)
  - role_name="ansible-rabbitmq"
  - '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}"'
  - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-lint -c /.ansible-lint /etc/ansible/roles/${role_name}/tests/test.yml'
  - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml --syntax-check'
  - 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml'
  - >
    sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml
    | grep -q 'changed=0.*failed=0'
    && (echo 'Idempotence test: pass' && exit 0)
    || (echo 'Idempotence test: fail' && exit 1)
  - 'sudo docker rm -f "$(cat ${container_id})"'

notifications:
  webhooks: https://galaxy.ansible.com/api/v1/notifications/