forked from ansistrano/deploy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.travis.yml
87 lines (80 loc) · 3.43 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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
language: python
services:
- docker
env:
- ANSIBLE_VERSION: "1.9.5"
- ANSIBLE_VERSION: "2.1.2"
- ANSIBLE_VERSION: "2.2.1"
- distribution: Ubuntu
distribution_version: yakkety
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
ANSIBLE_VERSION: docker
- distribution: Ubuntu
distribution_version: xenial
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
ANSIBLE_VERSION: docker
- distribution: Ubuntu
distribution_version: trusty
init: /sbin/init
run_opts: ""
ANSIBLE_VERSION: docker
- distribution: Ubuntu
distribution_version: precise
init: /sbin/init
run_opts: ""
ANSIBLE_VERSION: docker
- distribution: EL
distribution_version: "7"
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
ANSIBLE_VERSION: docker
# Temporary commenting out broken tests
# - distribution: EL
# distribution_version: "6"
# init: /sbin/init
# run_opts: ""
# ANSIBLE_VERSION: docker
- distribution: Debian
distribution_version: jessie
init: /lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
ANSIBLE_VERSION: docker
- distribution: Debian
distribution_version: wheezy
init: /sbin/init
run_opts: ""
ANSIBLE_VERSION: docker
- distribution: Fedora
distribution_version: "24"
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
ANSIBLE_VERSION: docker
- distribution: Fedora
distribution_version: "23"
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
ANSIBLE_VERSION: docker
before_install:
# Standard Local Testing Commands
- if [ "${ANSIBLE_VERSION}" != "docker" ]; then sudo apt-get -y install software-properties-common ; fi
- if [ "${ANSIBLE_VERSION}" != "docker" ]; then sudo apt-get -y install python-pip ; fi
- if [ "${ANSIBLE_VERSION}" != "docker" ]; then sudo pip install ansible==$ANSIBLE_VERSION ; fi
- if [ "${ANSIBLE_VERSION}" != "docker" ]; then ansible --version ; fi
# Docker Testing pull container.
- if [ "${ANSIBLE_VERSION}" == "docker" ]; then docker pull ansiblecheck/ansiblecheck:${distribution,,}-${distribution_version} ; fi
script:
# Local Testing Commands
- if [ "${ANSIBLE_VERSION}" != "docker" ]; then echo localhost > inventory ; fi
- if [ "${ANSIBLE_VERSION}" != "docker" ]; then ansible-playbook -i inventory --connection=local --sudo -v test/main.yml ; fi
# Docker Testing Commands
- if [ "${ANSIBLE_VERSION}" == "docker" ]; then container_id=$(mktemp) ; fi
# Start The Built Container In The Background
- if [ "${ANSIBLE_VERSION}" == "docker" ]; then docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ansiblecheck/ansiblecheck:"${distribution,,}"-"${distribution_version}" "${init}" > "${container_id}" ; fi
# Ansible syntax check.
- if [ "${ANSIBLE_VERSION}" == "docker" ]; then docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/test/main.yml --syntax-check ; fi
# Test role.
- if [ "${ANSIBLE_VERSION}" == "docker" ]; then docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/test/main.yml -v ; fi
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/