language: php

sudo: false

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

notifications:
    email: deploy@peter-gribanov.ru

matrix:
    fast_finish: true
    include:
        - php: 5.6
          env: COVERAGE=1
    allow_failures:
        - php: hhvm

before_install:
    - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ] && [ "$COVERAGE" != "1" ]; then phpenv config-rm xdebug.ini; fi;
    - if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "memory_limit=2G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
    - if [ -n "$GH_TOKEN" ]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;
    - composer self-update
    - mkdir build

before_script:
    - composer install --prefer-dist --no-interaction --no-scripts --no-progress

script:
    - if [ "$COVERAGE" != "1" ]; then vendor/bin/phpunit; fi;
    - if [ "$COVERAGE" == "1" ]; then vendor/bin/phpunit --coverage-clover build/coverage-clover.xml; fi;

after_script:
    - if [ "$COVERAGE" == "1" ]; then vendor/bin/ocular code-coverage:upload --format=php-clover build/coverage-clover.xml; fi;
    - if [ "$COVERAGE" == "1" ]; then vendor/bin/coveralls -v -c .coveralls.yml; fi;
