language: php

dist: xenial

cache:
    directories:
        - vendor
        - extra/*/vendor
        - $HOME/.composer/cache/files

env:
    global:
        - SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1

before_install:
    - phpenv config-rm xdebug.ini || return 0
    - echo memory_limit = -1 >> ~/.phpenv/versions/$TRAVIS_PHP_VERSION/etc/conf.d/travis.ini

install:
    - travis_retry composer install
    - export PHPUNIT=$(readlink -f ./vendor/bin/simple-phpunit)
    - $PHPUNIT install
    - (cd extra/cssinliner-extra && travis_retry composer install)
    - (cd extra/html-extra && travis_retry composer install)
    - (cd extra/inky-extra && travis_retry composer install)
    - (cd extra/intl-extra && travis_retry composer install)
    - ([[ $TRAVIS_PHP_VERSION = nightly ]] && (cd extra/markdown-extra && composer config platform.php 7.4.99) || true)
    - (cd extra/markdown-extra && travis_retry composer install)
    - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || (cd extra/string-extra && travis_retry composer install))

script:
    - $PHPUNIT
    - (cd extra/cssinliner-extra && $PHPUNIT)
    - (cd extra/html-extra && $PHPUNIT)
    - (cd extra/inky-extra && $PHPUNIT)
    - (cd extra/intl-extra && $PHPUNIT)
    - (cd extra/markdown-extra && $PHPUNIT)
    - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || (cd extra/string-extra && $PHPUNIT))

jobs:
    fast_finish: true
    include:
        - php: 7.1
        - php: 7.2
        - php: 7.3
        - php: 7.4
        - php: nightly
        - stage: integration tests
          php: 7.3
          script: ./drupal_test.sh
