language: php

php:
  - 7.3
  - 7.4
  - 8.0
  - nightly

env:
  - DB=mysql
  - DB=pgsql
  - DB=sqlite

services:
  - mysql
  - postgresql

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

matrix:
  include:
    - php: 7.3
      env: DB=mysql COMPOSER_OPTIONS=--prefer-lowest --prefer-stable
    - php: 7.3
      env: DB=pgsql COMPOSER_OPTIONS=--prefer-lowest --prefer-stable
    - php: 7.3
      env: DB=sqlite COMPOSER_OPTIONS=--prefer-lowest --prefer-stable

before_script:
  - rm -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
  - composer update --prefer-dist --no-interaction ${COMPOSER_OPTIONS}
  - if [[ "$DB" == "mysql" ]]; then mysql -h127.0.0.1 -e "create database phpcr_tests;"; fi
  - if [[ "$DB" == "pgsql" ]]; then psql -h127.0.0.1 -c "create database phpcr_tests;" -U postgres; fi
  - php tests/generate_phpunit_config.php $DB

script: php vendor/bin/phpunit -c $DB.phpunit.xml

notifications:
  irc: "irc.freenode.org#jackalope"
