language: php

matrix:
  include:
    - php: 5.5
    - php: 5.6
    - php: 7.0
    - php: 7.1
      env:
        - ENABLE_XDEBUG=true
    - php: 7.1
      env:
        - ENABLE_DEVTOOLS=true
    - php: nightly
    - php: hhvm-3.12
      sudo: required
      dist: trusty
      group: edge
    - php: hhvm
      sudo: required
      dist: trusty
      group: edge
  allow_failures:
    - php: nightly
    - php: hhvm-3.12
    - php: hhvm
  fast_finish: true

os:
  - linux

notifications:
  irc: "chat.freenode.net#hoaproject"

sudo: false

env:
  global:
    - secure: "AAAAB3NzaC1yc2EAAAADAQABAAACAQDIf0Rf76Hhkflz5b9UzWjOjk4UlMU5ySk0VY3B4WdHDLWMMK7fBp1Aj9qXWEDwkuX/NbQP1gB8jQNo7i5uZEOfu7Mn2svPkBBtnmKmaJhk90xypM4lcpcdPi4e8kXUgkriNQLQ2bRe1qZIeF115FkuIvActq7iWKY1TVSZbO54cDKMifDZfH09cf4vpwrZJqwZG6PUnUcCYijgDy99HtfRvzf9xalO4yWm55ZEbJ/VNTHlq1EhK73QLdHC7MO+OQFcd5wEyMbNxBj/bDn/udgb0HsrDijComTg/oTdQJMspYDQYV3ZYvpGozTTCVQrVTYYTP9RCNstgJLHDv9fZZW6yRlw4yNsT7jIQRLs/7awTxOAvRlxqaxk0//ECVNhDgawVtlbEIKrqnM1N7QTm0gjE0HkWEzxE0QbgoZqlLFD6qCp6WVvIT3uGY/i4TkVy78wf3/fzCKbrf72kYSbxIOCxVtptOmrgAblNEpiA/uZ9IofR2p2iwiVY1xF/mzxV2M4zCw6WASrlDhkaL0IncEdRtBuV2WTpixmtjmNkE9h/90kzb5cKExU786gZmvyflYvqlNlcMo3dNsDnROjQCAUXGBw5+risdqTT295BGmlEdZUtcf0c6/zEGhR8B7CktWYLSgOL5mpGMVNEBzyzEwnIiWCvI3pGgoV3Z9UzSJWKQ=="

cache:
  directories:
    - vendor/

before_script:
  - export PATH="$PATH:$HOME/.composer/vendor/bin"
  - if [[ ! $ENABLE_XDEBUG ]]; then
      phpenv config-rm xdebug.ini || echo "ext-xdebug is not available, cannot remove it.";
    fi

script:
  - composer install
  - vendor/bin/hoa test:run
  - if [[ $ENABLE_DEVTOOLS ]]; then
      composer global require friendsofphp/php-cs-fixer;
      vendor/bin/hoa devtools:cs --diff --dry-run .;
    fi
