2014-04-23 18:29:49 +02:00
|
|
|
---
|
2016-02-16 17:25:40 +01:00
|
|
|
sudo: required
|
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
|
|
|
# Only test source install on latest supported OSes.
|
|
|
|
- distribution: centos
|
|
|
|
version: 7
|
|
|
|
init: /usr/lib/systemd/systemd
|
|
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
SITE: source
|
2016-05-12 05:45:27 +02:00
|
|
|
PHP_VERSION: 7.0.5
|
2016-02-16 17:25:40 +01:00
|
|
|
- distribution: ubuntu
|
|
|
|
version: 14.04
|
|
|
|
init: /sbin/init
|
|
|
|
run_opts: ""
|
|
|
|
SITE: source
|
2016-05-12 05:45:27 +02:00
|
|
|
PHP_VERSION: 7.0.5
|
2014-04-23 19:42:10 +02:00
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
# Test package install on all supported OSes.
|
|
|
|
- distribution: centos
|
|
|
|
version: 7
|
|
|
|
init: /usr/lib/systemd/systemd
|
|
|
|
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
|
|
|
SITE: package
|
2016-05-12 05:45:27 +02:00
|
|
|
PHP_VERSION: 7.0
|
2016-02-16 17:25:40 +01:00
|
|
|
- distribution: ubuntu
|
|
|
|
version: 14.04
|
|
|
|
init: /sbin/init
|
|
|
|
run_opts: ""
|
|
|
|
SITE: package
|
2016-05-12 05:45:27 +02:00
|
|
|
PHP_VERSION: 7.0
|
2016-02-16 17:25:40 +01:00
|
|
|
- distribution: ubuntu
|
|
|
|
version: 12.04
|
|
|
|
init: /sbin/init
|
|
|
|
run_opts: ""
|
|
|
|
SITE: package
|
2016-05-13 17:04:38 +02:00
|
|
|
PHP_VERSION: 5.6
|
2014-04-23 19:42:10 +02:00
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
services:
|
|
|
|
- docker
|
2014-04-23 19:42:10 +02:00
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
before_install:
|
|
|
|
# - sudo apt-get update
|
|
|
|
# Pull container
|
|
|
|
- 'sudo docker pull ${distribution}:${version}'
|
|
|
|
# Customize container
|
|
|
|
- 'sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests'
|
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)
|
|
|
|
# Run container in detached state
|
|
|
|
- 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"'
|
2014-04-23 18:29:49 +02:00
|
|
|
|
2016-02-16 22:59:49 +01:00
|
|
|
# Install dependencies.
|
|
|
|
- 'sudo docker exec "$(cat ${container_id})" ansible-galaxy install -r /etc/ansible/roles/role_under_test/tests/requirements.yml'
|
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
# Ansible syntax check.
|
|
|
|
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test-${SITE}.yml --syntax-check'
|
2014-04-23 18:29:49 +02:00
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
# Test role.
|
2016-04-08 22:34:09 +02:00
|
|
|
- 'travis_wait 30 sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test-${SITE}.yml'
|
2016-02-16 17:25:40 +01:00
|
|
|
|
|
|
|
# Test role idempotence.
|
2014-04-23 18:29:49 +02:00
|
|
|
- >
|
2016-02-16 17:25:40 +01:00
|
|
|
sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test-${SITE}.yml
|
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.
|
|
|
|
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm which php'
|
|
|
|
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm test -x /usr/bin/php'
|
2015-05-26 17:32:11 +02:00
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm php --version'
|
|
|
|
- 'sudo 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.
|
|
|
|
- sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm php -i | grep 'memory_limit.*192'
|
|
|
|
|
2016-02-16 17:25:40 +01:00
|
|
|
# Clean up
|
|
|
|
- 'sudo docker stop "$(cat ${container_id})"'
|
2016-02-08 21:09:43 +01:00
|
|
|
|
|
|
|
notifications:
|
|
|
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|