language: php
sudo: required
dist: trusty

matrix:
  include:
  - php: 7.0
  - php: 7.1
  - php: 7.2
  - php: 5.5.38
  - php: 5.6.25
  - php: hhvm
    group: edge
  fast_finish: true

before_script:
  - pecl install grpc || echo 'Failed to install grpc'
  - if [[ $TRAVIS_PHP_VERSION =~ ^7 ]]; then pecl install stackdriver_debugger-alpha || echo 'Failed to install stackdriver_debugger'; fi
  - composer install
  - if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then composer --no-interaction --dev remove google/protobuf google/gax google/proto-client; fi
  - ./dev/sh/system-test-credentials

env:
  global:
    - GOOGLE_CLOUD_PHP_TESTS_KEY_PATH=$TRAVIS_BUILD_DIR/keys/GOOGLE_CLOUD_PHP_TESTS.json
    - GOOGLE_CLOUD_PHP_TESTS_WHITELIST_KEY_PATH=$TRAVIS_BUILD_DIR/keys/GOOGLE_CLOUD_PHP_TESTS_WHITELIST.json

script:
  - ./dev/sh/tests
  - vendor/bin/phpcs --standard=./phpcs-ruleset.xml
  - ./dev/sh/build-docs

after_success:
  - if [[ $TRAVIS_PHP_VERSION =~ ^hhvm ]]; then bash <(curl -s https://codecov.io/bash); fi
  - ./dev/sh/push-docs
  - ./dev/sh/trigger-split
  - cat ./build/snippets-uncovered.json

after_failure:
  - echo "SNIPPET COVERAGE REPORT" && cat ./build/snippets-uncovered.json
