language: php
php:
  - 7.2
  - 7.3
  - 7.4
  - 8.0

services:
  - mysql
  - postgresql

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

before_install:
  - mysql -e 'CREATE DATABASE postfixadmin;'
  - psql -c 'create database postfixadmin;' -U postgres


before_script:
  - travis_retry composer install --no-interaction --prefer-source --dev
  - mkdir -p build/logs

script:
  - composer build
  - DATABASE=sqlite vendor/bin/phpunit tests/
  - DATABASE=mysql vendor/bin/phpunit --coverage-clover=build/logs/clover.xml tests/
  - DATABASE=postgresql vendor/bin/phpunit tests/

after_success: 
  - travis_retry php vendor/bin/php-coveralls 
