.travis.yml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ---
  2. sudo: required
  3. env:
  4. - distribution: centos
  5. version: 6
  6. init: /sbin/init
  7. run_opts: ""
  8. - distribution: centos
  9. version: 7
  10. init: /usr/lib/systemd/systemd
  11. run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
  12. - distribution: ubuntu
  13. version: 14.04
  14. init: /sbin/init
  15. run_opts: ""
  16. - distribution: ubuntu
  17. version: 12.04
  18. init: /sbin/init
  19. run_opts: ""
  20. matrix:
  21. allow_failures:
  22. - env: distribution=centos
  23. services:
  24. - docker
  25. before_install:
  26. # - sudo apt-get update
  27. # Pull container
  28. - 'sudo docker pull ${distribution}:${version}'
  29. # Customize container
  30. - 'sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests'
  31. script:
  32. - container_id=$(mktemp)
  33. # Run container in detached state
  34. - 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"'
  35. # Install required Galaxy roles.
  36. - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-galaxy install geerlingguy.git'
  37. # Ansible syntax check.
  38. - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml --syntax-check'
  39. # Test role.
  40. - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml'
  41. # Test role idempotence.
  42. - >
  43. sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/test.yml
  44. | grep -q 'changed=0.*failed=0'
  45. && (echo 'Idempotence test: pass' && exit 0)
  46. || (echo 'Idempotence test: fail' && exit 1)
  47. # Check if we get an installation page.
  48. - 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm curl http://localhost:3000/install'
  49. # Clean up
  50. - 'sudo docker stop "$(cat ${container_id})"'
  51. notifications:
  52. webhooks: https://galaxy.ansible.com/api/v1/notifications/