ansible-role-nginx/.travis.yml
Alessandro Fael Garcia 1d3b03ea2b
Improve tests (#90)
* Update .travis.yml

* Create Travis build matrix

* Add nginx-modules.yml test playbook to Travis build matrix

* Improve template test playbook

* Change HTML template variables from Ansible to NGINX variables
2019-01-21 12:19:30 +01:00

212 lines
5.4 KiB
YAML

---
sudo: required
services:
- docker
matrix:
include:
- env:
distribution: centos
version: 6
playbook: basic
- env:
distribution: centos
version: 6
playbook: modules
- env:
distribution: centos
version: 6
playbook: push
- env:
distribution: centos
version: 6
playbook: stable
- env:
distribution: centos
version: 6
playbook: template
- env:
distribution: centos
version: 6
playbook: unit
- env:
distribution: centos
version: 7
playbook: basic
- env:
distribution: centos
version: 7
playbook: modules
- env:
distribution: centos
version: 7
playbook: push
- env:
distribution: centos
version: 7
playbook: template
- env:
distribution: centos
version: 7
playbook: stable
- env:
distribution: centos
version: 7
playbook: unit
- env:
distribution: debian
version: jessie
playbook: basic
- env:
distribution: debian
version: jessie
playbook: modules
- env:
distribution: debian
version: jessie
playbook: push
- env:
distribution: debian
version: jessie
playbook: template
- env:
distribution: debian
version: jessie
playbook: stable
- env:
distribution: debian
version: jessie
playbook: unit
- env:
distribution: debian
version: stretch
playbook: basic
- env:
distribution: debian
version: stretch
playbook: modules
- env:
distribution: debian
version: stretch
playbook: push
- env:
distribution: debian
version: stretch
playbook: template
- env:
distribution: debian
version: stretch
playbook: stable
- env:
distribution: debian
version: stretch
playbook: unit
- env:
distribution: ubuntu
version: trusty
playbook: basic
- env:
distribution: ubuntu
version: trusty
playbook: modules
- env:
distribution: ubuntu
version: trusty
playbook: push
- env:
distribution: ubuntu
version: trusty
playbook: template
- env:
distribution: ubuntu
version: trusty
playbook: stable
- env:
distribution: ubuntu
version: xenial
playbook: basic
- env:
distribution: ubuntu
version: xenial
playbook: modules
- env:
distribution: ubuntu
version: xenial
playbook: push
- env:
distribution: ubuntu
version: xenial
playbook: template
- env:
distribution: ubuntu
version: xenial
playbook: stable
- env:
distribution: ubuntu
version: xenial
playbook: unit
- env:
distribution: ubuntu
version: artful
playbook: basic
- env:
distribution: ubuntu
version: artful
playbook: modules
- env:
distribution: ubuntu
version: artful
playbook: push
- env:
distribution: ubuntu
version: artful
playbook: stable
- env:
distribution: ubuntu
version: artful
playbook: template
- env:
distribution: ubuntu
version: artful
playbook: unit
- env:
distribution: ubuntu
version: bionic
playbook: basic
- env:
distribution: ubuntu
version: bionic
playbook: modules
- env:
distribution: ubuntu
version: bionic
playbook: push
- env:
distribution: ubuntu
version: bionic
playbook: stable
- env:
distribution: ubuntu
version: bionic
playbook: template
- env:
distribution: ubuntu
version: bionic
playbook: unit
before_install:
- 'sudo docker pull ${distribution}:${version}'
- 'sudo docker build --no-cache --rm --file=tests/dockerfiles/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests'
script:
- container_id=$(mktemp)
- 'sudo docker run --detach --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/etc/ansible/roles/ansible-role-nginx:ro ${distribution}-${version}:ansible > "${container_id}"'
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-role-nginx/tests/playbooks/nginx-${playbook}.yml --syntax-check'
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-role-nginx/tests/playbooks/nginx-${playbook}.yml'
- >
sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/ansible-role-nginx/tests/playbooks/nginx-${playbook}.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
- 'if [${playbook} != "unit"]; then sudo docker exec "$(cat ${container_id})" curl http://localhost/; fi'
- 'sudo docker rm -f "$(cat ${container_id})"'
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/