.travis.yml 2.1 KB

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