language: php

php:
  - 5.5
  - 5.6
  - 7.0
#  - hhvm
  - nightly

dist: trusty

matrix:
  allow_failures:
    - php: nightly

before_install:
  - sudo apt-get update > /dev/null

install:
  # install Oracle JDK8
  - sh -c ./build/server/jdk8-install.sh
  # install gremlin-server
  - sh -c ./build/server/install.sh
  - if [ -n "$GH_TOKEN" ]; then composer config --global github-oauth.github.com ${GH_TOKEN}; else echo "no token"; fi
  - composer global require "fxp/composer-asset-plugin:~1.4"
  - if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.6" ]] || [[ ${TRAVIS_PHP_VERSION:0:3} == "5.5" ]]; then composer update -v; else composer install; fi

script: if [[ ${GRAPHSON_VERSION} == "3.0" ]]; then vendor/bin/phpunit --configuration build/phpunit.xml --testsuit graphson3; else vendor/bin/phpunit --configuration build/phpunit.xml --testsuit graphson1; fi

after_success:
  - sh -c ./build/deploy.sh

env:
  matrix:
    - GREMLINSERVER_VERSION="3.2.8" GRAPHSON_VERSION="1.0"
    - GREMLINSERVER_VERSION="3.3.2" GRAPHSON_VERSION="1.0"
    - GREMLINSERVER_VERSION="3.3.2" GRAPHSON_VERSION="3.0"
    - GREMLINSERVER_VERSION="3.4.0" GRAPHSON_VERSION="1.0"
    - GREMLINSERVER_VERSION="3.4.0" GRAPHSON_VERSION="3.0"

deploy:
  provider: pages
  repo: PommeVerte/PommeVerte.github.io
  skip-cleanup: true
  github-token: $GH_TOKEN  # Set in travis-ci.org dashboard, marked secure
  keep-history: true
  local-dir: ./build/logs/PommeVerte.github.io
  target-branch: master
  verbose: true
  project-name: PommeVerte/gremlin-php
  on:
    branch: master
    condition: $TRAVIS_PHP_VERSION = "5.6" && $GRAPHSON_VERSION = "3.0"