language: php

php:
  - 5.5
  - 5.6
  - 7.0
  - hhvm

sudo: false

cache:
  directories:
    - vendor
    - $HOME/.composer/cache

env:
  global:
    - DEFAULT=1

matrix:
  include:
    - php: 5.6
      env: COVERALLS=1 DEFAULT=0

    - php: 7.0
      env: PHPCS=1 DEFAULT=0

  allow_failures:
    - php: hhvm

  fast_finish: true

before_install:
  - travis_retry composer self-update

install:
  - sh -c "if [ '$COVERALLS' = '1' ]; then composer require --dev satooshi/php-coveralls:dev-master; fi"
  - sh -c "if [ '$COVERALLS' = '1' ]; then mkdir -p build/logs; fi"

  - travis_retry composer install --no-interaction --prefer-dist

script:
  - sh -c "if [ '$DEFAULT' = '1' ]; then phpunit; fi"

  - sh -c "if [ '$PHPCS' = '1' ]; then vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi"

  - sh -c "if [ '$COVERALLS' = '1' ]; then phpunit --coverage-clover build/logs/clover.xml; fi"
  - sh -c "if [ '$COVERALLS' = '1' ]; then vendor/bin/coveralls -c .coveralls.yml -v; fi"

notifications:
  email: false

language: php

php:
  - 5.5
  - 5.6
  - 7.0
  - 7.1
  - hhvm

sudo: false

cache:
  directories:
    - vendor
    - $HOME/.composer/cache

env:
  global:
    - DEFAULT=1

matrix:
  include:
    - php: 7.0
      env: PHPCS=1 DEFAULT=0

  allow_failures:
    - php: hhvm

  fast_finish: true

before_install:
  - if [ $HHVM != 1 && $TRAVIS_PHP_VERSION != 7.* ]; then phpenv config-rm xdebug.ini; fi

  - travis_retry composer self-update

install:
  - travis_retry composer install --no-interaction --prefer-dist

script:
  - if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then export CODECOVERAGE=1; vendor/bin/phpunit --coverage-clover=clover.xml; fi
  - if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION != 7.0 ]]; then vendor/bin/phpunit; fi

  - if [[ $PHPCS = 1 ]]; then vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi

after_success:
  - if [[ $DEFAULT = 1 && $TRAVIS_PHP_VERSION = 7.0 ]]; then bash <(curl -s https://codecov.io/bash); fi

notifications:
  email: false

Use codecov instead of coveralls.
Use codecov instead of coveralls.
