language: php

php:
  - 5.4
  - 5.5
  - 5.6
  - 7.0
  - 7.1
  - 7.2
  - hhvm
  - nightly

env:
  global:
    - TEST_COMMAND="composer test"

before_script:
  - curl --version
  - pear config-set php_ini ~/.phpenv/versions/`php -r 'echo phpversion();'`/etc/php.ini || echo 'Error modifying PEAR'
  - pecl install uri_template || echo 'Error installing uri_template'
  # To be removed when this issue will be resolved: https://github.com/composer/composer/issues/5355
  - if [[ "$COMPOSER_FLAGS" == *"--prefer-lowest"* ]]; then travis_retry composer update --prefer-dist --no-interaction --prefer-stable --quiet; fi
  - travis_retry composer update ${COMPOSER_FLAGS} --prefer-dist --no-interaction
  - ~/.nvm/nvm.sh install v0.6.14
  - ~/.nvm/nvm.sh run v0.6.14

script: $TEST_COMMAND

matrix:
  allow_failures:
    - php: hhvm
    - php: nightly
  fast_finish: true
  include:
    - php: 5.4
      env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest" COVERAGE=true TEST_COMMAND="composer test-ci"

before_deploy:
  - make package

deploy:
  provider: releases
  api_key:
    secure: UpypqlYgsU68QT/x40YzhHXvzWjFwCNo9d+G8KAdm7U9+blFfcWhV1aMdzugvPMl6woXgvJj7qHq5tAL4v6oswCORhpSBfLgOQVFaica5LiHsvWlAedOhxGmnJqMTwuepjBCxXhs3+I8Kof1n4oUL9gKytXjOVCX/f7XU1HiinU=
  file:
    - build/artifacts/guzzle.phar
    - build/artifacts/guzzle.zip
  on:
    repo: guzzle/guzzle
    tags: true
    all_branches: true
    php: 5.4
