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: "AAAAB3NzaC1yc2EAAAADAQABAAAAgQDzZax7/VFMmTnePlw4PQmD7pVaJQDbLaMXfIIuV/h51m0g8dYfWiGytsblv+/tW37b3TKaGVLMP3vL9jGU73V4P64Ytafj0UV3UKSzHR4atrAPjsCjsFMzlIvKLCZf2FmADRspv/pAg1loQWRzXAiZ9pqCSTxx32x20uLAJmLucQ=="

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
