---
services: docker

env:
  # Test source install on latest supported OSes.
  - distro: centos7
    playbook: test-source.yml
    GIT_VERSION: 2.9.3
  - distro: ubuntu1604
    playbook: test-source.yml
    GIT_VERSION: 2.9.3

  # Test package install on all supported OSes.
  - distro: centos7
    playbook: test.yml
    GIT_VERSION: 1.8.3.1
  - distro: centos6
    playbook: test.yml
    GIT_VERSION: 1.7.1
  - distro: fedora24
    playbook: test.yml
    GIT_VERSION: 2.7.4
  - distro: ubuntu1604
    playbook: test.yml
    GIT_VERSION: 2.7.4
  - distro: ubuntu1404
    playbook: test.yml
    GIT_VERSION: 1.9.1
  - distro: ubuntu1204
    playbook: test.yml
    GIT_VERSION: 1.7.9.5
  - distro: debian8
    playbook: test.yml
    GIT_VERSION: 2.1.4

script:
  # Configure test script so we can run extra tests after playbook is run.
  - export container_id=$(date +%s)
  - export cleanup=false

  # Download test shim.
  - wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
  - chmod +x ${PWD}/tests/test.sh

  # Run tests.
  - ${PWD}/tests/test.sh

  # Ensure Git is installed and at the right version.
  - 'docker exec --tty ${container_id} env TERM=xterm which git'
  - 'docker exec --tty ${container_id} env TERM=xterm test -x /usr/bin/git'

  - 'docker exec --tty ${container_id} env TERM=xterm git --version'
  - 'docker exec --tty ${container_id} env TERM=xterm /usr/bin/git --version | grep -qF "$GIT_VERSION"'

notifications:
  webhooks: https://galaxy.ansible.com/api/v1/notifications/