sudo: false
dist: trusty

language: php

php:
  #- 5.6
  #- 7.0
  - 7.1
  #- 7.2
  #- hhvm

env:
  - WOO_VERSION="3.6.1" WP_VERSION=latest

notifications:
  email:
    on_success: never
    on_failure: change

cache:
  directories:
    - $HOME/.composer/cache

matrix:
  fast_finish: true
  allow_failures:
    - php: hhvm
    - php: 7.2

install:
  - cd /tmp
  - git clone https://github.com/woocommerce/woocommerce
  - cd woocommerce/
  - git checkout tags/$WOO_VERSION
  - bash tests/bin/install.sh woocommerce_test root '' localhost $WP_VERSION
  - cd ..
  - cd $TRAVIS_BUILD_DIR

before_script:
  - export PATH="$HOME/.composer/vendor/bin:$PATH"
  - |
    if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
      phpenv config-rm xdebug.ini
    else
      echo "xdebug.ini does not exist"
    fi
script:
  - |
    phpunit
    WP_MULTISITE=1 phpunit
deploy:
  provider: script
  script: curl -u "travis:${app_token}" -d "release=${TRAVIS_TAG:1}" "http://magento7.aait.nu/scripts/deploy.php"
  on:
    tags: true
    all_branches: true
