2014-04-23 18:29:49 +02:00
|
|
|
---
|
2016-09-25 22:50:37 +02:00
|
|
|
services: docker
|
2014-04-23 19:42:10 +02:00
|
|
|
|
2014-04-23 18:29:49 +02:00
|
|
|
env:
|
2016-02-16 17:25:40 +01:00
|
|
|
# Test package install on all supported OSes.
|
2016-09-14 22:46:27 +02:00
|
|
|
- distro: centos7
|
2016-02-16 17:25:40 +01:00
|
|
|
init: /usr/lib/systemd/systemd
|
|
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
2016-09-14 23:22:10 +02:00
|
|
|
playbook: test.yml
|
2016-09-14 22:46:27 +02:00
|
|
|
php_version: 7.0
|
2016-09-18 01:45:10 +02:00
|
|
|
- distro: fedora24
|
|
|
|
init: /usr/lib/systemd/systemd
|
|
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
2016-09-18 02:06:40 +02:00
|
|
|
playbook: test.yml
|
2016-09-18 01:45:10 +02:00
|
|
|
php_version: 5.6
|
2016-09-14 22:46:27 +02:00
|
|
|
- distro: ubuntu1604
|
|
|
|
init: /lib/systemd/systemd
|
|
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
playbook: test.yml
|
|
|
|
php_version: 7.0
|
|
|
|
- distro: ubuntu1404
|
2016-02-16 17:25:40 +01:00
|
|
|
init: /sbin/init
|
|
|
|
run_opts: ""
|
2016-09-14 22:46:27 +02:00
|
|
|
playbook: test.yml
|
|
|
|
php_version: 7.0
|
|
|
|
- distro: ubuntu1204
|
2016-02-16 17:25:40 +01:00
|
|
|
init: /sbin/init
|
|
|
|
run_opts: ""
|
2016-09-14 22:46:27 +02:00
|
|
|
playbook: test.yml
|
|
|
|
php_version: 5.6
|
2014-04-23 19:42:10 +02:00
|
|
|
|
2016-09-14 23:22:10 +02:00
|
|
|
# Only test source install on latest supported OSes.
|
|
|
|
- distro: centos7
|
|
|
|
init: /usr/lib/systemd/systemd
|
|
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
playbook: test-source.yml
|
|
|
|
php_version: 7.0.5
|
|
|
|
- distro: ubuntu1604
|
|
|
|
init: /lib/systemd/systemd
|
|
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
playbook: test-source.yml
|
|
|
|
php_version: 7.0.5
|
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
before_install:
|
2016-09-14 22:46:27 +02:00
|
|
|
# Pull container.
|
2016-09-25 22:50:37 +02:00
|
|
|
- 'docker pull geerlingguy/docker-${distro}-ansible:latest'
|
2014-04-23 19:42:10 +02:00
|
|
|
|
2014-04-23 18:29:49 +02:00
|
|
|
script:
|
2016-02-16 17:25:40 +01:00
|
|
|
- container_id=$(mktemp)
|
2016-09-14 22:46:27 +02:00
|
|
|
# Run container in detached state.
|
2016-09-25 22:50:37 +02:00
|
|
|
- 'docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'
|
2014-04-23 18:29:49 +02:00
|
|
|
|
2016-02-16 22:59:49 +01:00
|
|
|
# Install dependencies.
|
2016-09-25 22:50:37 +02:00
|
|
|
- 'docker exec "$(cat ${container_id})" ansible-galaxy install -r /etc/ansible/roles/role_under_test/tests/requirements.yml'
|
2016-02-16 22:59:49 +01:00
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
# Ansible syntax check.
|
2016-09-25 22:50:37 +02:00
|
|
|
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} --syntax-check'
|
2014-04-23 18:29:49 +02:00
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
# Test role.
|
2016-09-25 22:50:37 +02:00
|
|
|
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook}'
|
2016-02-16 17:25:40 +01:00
|
|
|
|
|
|
|
# Test role idempotence.
|
2016-09-14 22:46:27 +02:00
|
|
|
- idempotence=$(mktemp)
|
2016-09-25 22:50:37 +02:00
|
|
|
- docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} | tee -a ${idempotence}
|
2014-04-23 18:29:49 +02:00
|
|
|
- >
|
2016-09-14 22:46:27 +02:00
|
|
|
tail ${idempotence}
|
2014-04-23 18:29:49 +02:00
|
|
|
| grep -q 'changed=0.*failed=0'
|
|
|
|
&& (echo 'Idempotence test: pass' && exit 0)
|
|
|
|
|| (echo 'Idempotence test: fail' && exit 1)
|
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
# Ensure PHP is installed and at the right version.
|
2016-09-25 22:50:37 +02:00
|
|
|
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm which php'
|
|
|
|
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm test -x /usr/bin/php'
|
2015-05-26 17:32:11 +02:00
|
|
|
|
2016-09-25 22:50:37 +02:00
|
|
|
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm php --version'
|
|
|
|
- 'docker exec --tty "$(cat ${container_id})" env TERM=xterm /usr/bin/php --version | grep -qF "PHP ${php_version}"'
|
2015-06-01 04:05:08 +02:00
|
|
|
|
2016-03-04 03:24:47 +01:00
|
|
|
# Ensure PHP configurations have taken effect.
|
2016-09-25 22:50:37 +02:00
|
|
|
- docker exec --tty "$(cat ${container_id})" env TERM=xterm php -i | grep 'memory_limit.*192'
|
2016-02-08 21:09:43 +01:00
|
|
|
|
|
|
|
notifications:
|
|
|
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|