language: php
dist: trusty
sudo: false

php:
  - 7.0
  - 7.1
  - 7.2
  - 7.3

env:
  global:
    - COMPOSER_MEMORY_LIMIT=-1
  matrix:
    - RELEASE=^8 COMPOSER_CHANNEL=stable
    - RELEASE=^9 COMPOSER_CHANNEL=stable
    - RELEASE=^8 COMPOSER_CHANNEL=snapshot
    - RELEASE=^9 COMPOSER_CHANNEL=snapshot

matrix:
  exclude:
    - php: 7.0
      env: RELEASE=^9 COMPOSER_CHANNEL=stable
    - php: 7.1
      env: RELEASE=^9 COMPOSER_CHANNEL=stable
    - php: 7.2
      env: RELEASE=^9 COMPOSER_CHANNEL=stable
    - php: 7.0
      env: RELEASE=^9 COMPOSER_CHANNEL=snapshot
    - php: 7.1
      env: RELEASE=^9 COMPOSER_CHANNEL=snapshot
    - php: 7.2
      env: RELEASE=^9 COMPOSER_CHANNEL=snapshot

before_install:
  - composer --verbose self-update --$COMPOSER_CHANNEL
  - composer --version

install:
  - composer --verbose validate

script:
  # Run automated tests.
  - if [[ ${TRAVIS_PHP_VERSION:0:3} != "5.6" ]]; then composer install && ./vendor/bin/phpunit; fi
  - cd .. && composer create-project drupal/recommended-project:$RELEASE drupal-project --no-interaction
  - ls -lah . && cd drupal-project
  # Check the performance.
  - composer update nothing --profile
  - composer config repositories.local path "../composer-drupal-optimizations" && composer require zaporylie/composer-drupal-optimizations:@dev
  - composer update nothing --profile
