sudo: false

language: php

branches:
  except:
    - /^release-.*$/
    - /^ghgfk-.*$/

cache:
  directories:
    - $HOME/.composer/cache
    - $HOME/.local
    - zf-mkdoc-theme

env:
  global:
    - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs"
    - secure: "onTs0dEukjobvBFGPub4RppiwDdlSQGJbdbSE942w17J0JxCTm3JejKLd3Y/FDBflNks6V9vN0StLPrdyQc+qB0fhf3OAbJ/vdjrp0RNveeo+GBfGiXDKIdgLgDE1wWolAgSfadT+rOxyn9px4JDrmRin8T7LGIR3OZAt/ptfkM1GGDY2Heac95htsqLpjcLG9Pyw3cHbB6uiCoj3bD2+/pKB+ktXOKUQgCJVWIAF5Qf8IKJoiVl9oNwKnGJrQICe2EaXRsnI3c1fu5BivduklxuSSjVCLYzFddLPJSBiTNRfxnD/kONt3J0IOcUGFjFVXijTcsbAxzMBAsEDPe9tCuKYYNGZF63ZdtmY6PyY6dNsyZ2pHsuda8hpV+H4j1jQBcoXbwulsp3IaiWwq9ChL5Ysdf1VnqwJAxE2GQj4BbtFEVvaEFc3dV05XnWJKD9oTGoS/D6pkC33Wnp04gWpvv0tOgpybyqdIRbYbx9Ke7XU1VY1C5p7rIe8CfGY6lGeI9Cop5RCD+6ukAEMxtO9MWGV4FVWLd329CW+oGO4qNte/vuVpwBgdhsN/eXjIrpGb8RFnXg8EWr8H4ES6sy8uLG0lNWfkYQp+rjKIi6f5eXXGvuTvdjGi5moSCNfQCVgT3PUFphiiQUVvtuZbdW3Rk3wQMw8QCI/+EnTTuBi6g="

matrix:
  fast_finish: true
  include:
    - php: 5.6
      env:
        - DEPS=lowest
    - php: 5.6
      env:
        - DEPS=locked
        - TEST_COVERAGE=true
        - DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
        - PATH="$HOME/.local/bin:$PATH"
        - SITE_URL=https://zendframework.github.io/zend-mvc-plugin-fileprg
        - GH_USER_NAME="Matthew Weier O'Phinney"
        - GH_USER_EMAIL=matthew@weierophinney.net
        - GH_REF=github.com/zendframework/zend-mvc-plugin-fileprg.git
    - php: 5.6
      env:
        - DEPS=latest
    - php: 7
      env:
        - DEPS=lowest
    - php: 7
      env:
        - DEPS=locked
        - CHECK_CS=true
    - php: 7
      env:
        - DEPS=latest
    - php: hhvm
      env:
        - DEPS=lowest
    - php: hhvm
      env:
        - DEPS=locked
    - php: hhvm
      env:
        - DEPS=latest
  allow_failures:
    - php: hhvm

notifications:
  irc: "irc.freenode.org#zftalk.dev"
  email: false

before_install:
  - travis_retry composer self-update
  - if [[ $TRAVIS_PHP_VERSION != "hhvm" && $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini ; fi

install:
  - if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
  - if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
  - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --no-update --dev $COMPOSER_ARGS satooshi/php-coveralls ; fi
  - travis_retry composer install $COMPOSER_ARGS
  - composer show --installed

script:
  - if [[ $TEST_COVERAGE == 'true' ]]; then composer test-coverage ; else composer test ; fi
  - if [[ $CHECK_CS == 'true' ]]; then composer cs-check ; fi
  - if [[ $DEPLOY_DOCS == "true" && "$TRAVIS_TEST_RESULT" == "0" ]]; then travis_retry curl -sSL https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh | bash ; fi

after_script:
  - if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer upload-coverage ; fi

after_success:
  - if [[ $DEPLOY_DOCS == "true" ]]; then ./zf-mkdoc-theme/deploy.sh ; fi
