language: php

sudo: false

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

php:
  - 7.2
  - 7.3
  - 7.4

services:
  - mongodb

matrix:
    fast_finish: true
    include:
     - php: 7.2
       env:
         - COMPOSER_FLAGS="--prefer-lowest"
         - SYMFONY_DEPRECATIONS_HELPER=weak
     - php: 7.3
       env:
         - SYMFONY_VERSION=^4.4
         - SYMFONY_DEPRECATIONS_HELPER=weak
     - php: 7.4
       env:
         - SYMFONY_VERSION=^4.4
         - SYMFONY_DEPRECATIONS_HELPER=weak
     - php: 7.4
       env:
         - DEPENDENCIES=dev
     - php: nightly
       env:
         - COMPOSER_FLAGS="--ignore-platform-reqs"
    allow_failures:
     - php: nightly
     - env: DEPENDENCIES=dev

before_install:
  - if [ "$DEPENDENCIES" != "" ]; then composer config minimum-stability ${DEPENDENCIES}; fi;
  - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;

before_script:
  - set -eo pipefail
  - pecl install -f mongodb-stable
  - composer update --no-interaction --no-progress $COMPOSER_FLAGS

script:
  - ./vendor/bin/phpunit -v --coverage-text --coverage-clover=coverage.clover

after_script:
  - wget https://scrutinizer-ci.com/ocular.phar
  - php ocular.phar code-coverage:upload --format=php-clover coverage.clover

#deploy:
#    provider: script
#    script: docs/deploy.sh
#    on:
#        branch: master
