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"
    - SITE_URL=https://zendframework.github.io/zend-mvc-i18n
    - GH_USER_NAME="Matthew Weier O'Phinney"
    - GH_USER_EMAIL=matthew@weierophinney.net
    - GH_REF=github.com/zendframework/zend-mvc-i18n.git
    - secure: "eZcLCwjTae1kWFL9dlQ4wts9SKW1bgvNYQn2zk7oeu0cWwLDDlMxoKg3ko0UcWDfLWi9kQetpoPvkAIrxsMhDwnzdHQ4e83GbvF4XqoB6pxr1T29yjqbfY7Kd6Y7CErE1Scfz25gaoewLjW09/fiXiqHTECnZTkwELwQy6LvOmE+eYbPRLHGyEE/9CVhyjcPCH9DQ1Kj/dZG2dLFjbV1kkJXkp/6m4zNIOLsDE6Y2tVhkgeVeIir3gpJzfkghT/O/P/93KLbCPcI+DVmbYi15VsUso2QGjlJFkhcvU0B/SxM4rsPUVWfgavOdhpW0vdEiLIWqWpxJ4AZL8VAx3Ib8b8xjWNHB95JSSgldoQDitvtM/S+PKlT1T1Mc4r/waAyXkZIcmrXlCjYjvMnIw7IXCr6geNNFwOyZeNPHgdBcKYQyZOH0dz2NGFcol195AxrTpQqQVuYFRDYO2p52q4qSdIBIPr08Rv4vWT2G5kXCQbzrihmQXEj7zRwEofHxJWVlfS3Fo6eqS9zOAwU+IboyQ8Nh3Uddqc7szFJB+IBr8YM1kOhVs8FdYo6SvEHPMtutwE6+rdQMQ+m5v4z1JuW+HuhpPxWwm8SE5tqer9HN+KuqbgcnycOM5sHo7FGntBea3L7x7EE8yfkUmChatMMhMghnZ3WgwULsKjbrD97bE8="

matrix:
  fast_finish: true
  include:
    - php: 5.6
      env:
        - DEPS=lowest
    - php: 5.6
      env:
        - DEPS=locked
        - DEPLOY_DOCS="$(if [[ $TRAVIS_BRANCH == 'master' && $TRAVIS_PULL_REQUEST == 'false' ]]; then echo -n 'true' ; else echo -n 'false' ; fi)"
        - PATH="$HOME/.local/bin:$PATH"
    - php: 5.6
      env:
        - DEPS=latest
        - TEST_COVERAGE=true
    - 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 wget -O theme-installer.sh "https://raw.githubusercontent.com/zendframework/zf-mkdoc-theme/master/theme-installer.sh" ; chmod 755 theme-installer.sh ; ./theme-installer.sh ; fi

after_success:
  - if [[ $DEPLOY_DOCS == "true" ]]; then echo "Preparing to build and deploy documentation" ; ./zf-mkdoc-theme/deploy.sh ; echo "Completed deploying documentation" ; fi

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