language: php

php:
    - 7.0
    - 7.1
    - 7.2
    - nightly

env:
    # The default env behaviour: phpunit, no coverage, no style checks
  - PHPUNIT=true

matrix:
  fast_finish: true

  exclude:
      # Disable standard phpunit test on 7.0, reenable with FULL, and with COVERAGE
    - php: 7.2
      env: PHPUNIT=true
  include:
      # This reenables php7.0/phpunit test with COVERAGE
    - php: 7.2
      env: PHPUNIT=true COVERAGE_SHARDS=5 COVERAGE=true
      # This reenables php7.0/phpunit test with extended tests (wycheproof)
    - php: 7.2
      env: FULL=true
      # This runs phpcs on php7.0 - only code style and examples
    - php: 7.0
      env: CODESTYLE=true EXAMPLES=true

sudo: false

before_script:
    - travis_retry composer selfupdate
    - travis_retry composer install --prefer-source
    - if [ "${COVERAGE}" != "true" ] && [ "${TRAVIS_PHP_VERSION}" != "nightly" ]; then phpenv config-rm xdebug.ini && echo "xdebug disabled"; fi

script:
    - if [ "${PHPUNIT}" = "true" ]; then make phpunit-ci; fi
    - if [ "${FULL}" = "true" ]; then make phpunit-full-ci; fi
    - if [ "${CODESTYLE}" = "true" ]; then make phpcs && echo "PHPCS OK"; fi
    - if [ "${EXAMPLES}" = "true" ]; then make test-examples && echo "Examples OK"; fi

after_success:
    - if [ "${COVERAGE}" = "true" ]; then make scrutinizer; fi
