language: php

php:
  - 5.5
  - 5.6
  - 7.0
  - 7.1
  - 7.2
  - hhvm
  - nightly
env:
  - COMPOSER_OPTS=""
  - COMPOSER_OPTS="--prefer-lowest"

matrix:
  allow_failures:
    - php: hhvm
    - php: nightly
  fast_finish: true

sudo: false

install:
  - export AWS_ACCESS_KEY_ID=foo
  - export AWS_SECRET_ACCESS_KEY=bar
  - 'if [ $(phpenv version-name) == "5.5" ]; then rm ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini; fi'
  - 'if [ $(phpenv version-name) != "hhvm" ] && [ $(phpenv version-name) != "nightly" ]; then echo "xdebug.overload_var_dump = 0" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi'
  - 'if [ $(phpenv version-name) == "7.2" ] && [ -v COMPOSER_OPTS ]; then composer require --dev phpunit/phpunit "^5.7.11"; fi'
  - composer --version
  - travis_retry composer update $COMPOSER_OPTS --no-interaction --prefer-source

script:
  - make test
  - if [ -z "$COMPOSER_OPTS" ]; then make package; fi

after_success:
  - 'if [ $(phpenv version-name) == "7.1" ]; then bash <(curl -s https://codecov.io/bash); fi'
