---
# https://docs.travis-ci.com/user/multi-os/
matrix:
  include:
    - os: osx
      language: generic
      script:
        - ansible-playbook playbooks/buildenv.yml -i tests/inventory -l localhost -vvvv
        - bundle exec rake spec SPEC_TARGET=localhost
    - os: linux
      dist: trusty
      language: python
      python: 2.7
      services:
        - docker
      addons:
        apt:
          packages:
          - python-pip
      script:
        - >+
          ansible-playbook playbooks/buildenv.yml -i tests/inventory -l localhost
          --extra-vars="virtualbox_apt_repository='deb http://download.virtualbox.org/virtualbox/debian precise contrib'"
          -vvvv
        - bundle exec rake spec SPEC_TARGET=localhost
        - packer build platforms/docker.json
        - docker run -it -d --name container fgtatsuro/infra-bridgehead:debian-jessie /bin/bash
        - bundle exec rake spec SPEC_TARGET=container
      after_script:
        - docker rm -f container

sudo: required

install:
  - sudo pip install -r requirements.txt
  - ansible-galaxy install -r role_requirements.yml
  - bundle install

---
# https://docs.travis-ci.com/user/multi-os/
matrix:
  include:
    - os: osx
      language: generic
      script:
        - ansible-playbook playbooks/buildenv.yml -i tests/inventory -l localhost -vvvv
        - bundle exec rake spec SPEC_TARGET=localhost
    - os: linux
      dist: trusty
      language: python
      python: 2.7
      services:
        - docker
      addons:
        apt:
          packages:
          - python-pip
      script:
        - >+
          ansible-playbook playbooks/buildenv.yml -i tests/inventory -l localhost
          --extra-vars="virtualbox_apt_repository='deb http://download.virtualbox.org/virtualbox/debian precise contrib'"
          -vvvv
        - bundle exec rake spec SPEC_TARGET=localhost
        - packer build platforms/docker.json
        - docker run -it -d --name container fgtatsuro/infra-bridgehead:debian-jessie /bin/bash
        - bundle exec rake spec SPEC_TARGET=container
      after_script:
        - docker rm -f container
      after_success:
        - docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
        - docker push fgtatsuro/infra-bridgehead:debian-jessie

sudo: required

install:
  - sudo pip install -r requirements.txt
  - ansible-galaxy install -r role_requirements.yml
  - bundle install

Update image to Docker Hub after success build.
Update image to Docker Hub after success build.
