ansible-role-php/.travis.yml

83 lines
2.9 KiB
YAML
Raw Normal View History

2014-04-23 18:29:49 +02:00
---
services: docker
2014-04-23 18:29:49 +02:00
env:
2016-02-16 17:25:40 +01:00
# Test package install on all supported OSes.
- 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
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"
playbook: test.yml
2016-09-18 01:45:10 +02:00
php_version: 5.6
- 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: ""
playbook: test.yml
php_version: 7.0
- distro: ubuntu1204
2016-02-16 17:25:40 +01:00
init: /sbin/init
run_opts: ""
playbook: test.yml
php_version: 5.6
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:
# Pull container.
- 'docker pull geerlingguy/docker-${distro}-ansible:latest'
2014-04-23 18:29:49 +02:00
script:
2016-02-16 17:25:40 +01:00
- container_id=$(mktemp)
# Run container in detached state.
- '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.
- '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.
- '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.
- '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.
- idempotence=$(mktemp)
- 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
- >
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.
- '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
- '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
# Ensure PHP configurations have taken effect.
- 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/