sudo: false
language: php
php:
  - 7.0
  - 7.1
  - 7.2
env:
  global:
    - ES_VERSION=6.5.4 ES_DOWNLOAD_URL=https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ES_VERSION}.tar.gz
install:
  - wget ${ES_DOWNLOAD_URL}
  - tar -xzf elasticsearch-${ES_VERSION}.tar.gz
  - ./elasticsearch-${ES_VERSION}/bin/elasticsearch -d
before_script:
  - composer config -g github-oauth.github.com $GITHUB_COMPOSER_AUTH
  - composer install --no-interaction --prefer-dist
script:
  - wget -q --waitretry=1 --retry-connrefused -T 10 -O - http://127.0.0.1:9200
  - vendor/bin/phpunit --coverage-clover=coverage.clover
  - vendor/bin/phpcs -p --standard=PSR2 --ignore=vendor/ ./
after_script:
  - travis_retry php vendor/bin/coveralls