| language: php
sudo: required
services:
  - docker
php:
  - 7.2
  - 7.3
env:
  - "DB=ALL COVERAGE=ALL"
before_install:
  - cd tests
  - docker-compose up -d
  - cd ..
  - bash ./tests/install-sqlsrv.sh
install:
  - composer install --no-interaction --prefer-source
script:
  - vendor/bin/phpunit --coverage-clover=coverage.xml
after_success:
  - bash <(curl -s https://codecov.io/bash) -f coverage.xml
jobs:
  include:
    # Testing various PostgresSQL version
    - stage: Test
      php: 7.2
      addons:
        postgresql: "9.2"
      env:
        - "DB=postgres POSTGRES=9.2"
      before_install:
        - psql -c 'create database spiral;' -U postgres
      script:
        - vendor/bin/phpunit tests/ORM/Driver/Postgres
    - stage: Test
      php: 7.2
      addons:
        postgresql: "9.3"
      env:
        - "DB=postgres POSTGRES=9.3"
      before_install:
        - psql -c 'create database spiral;' -U postgres
      script:
        - vendor/bin/phpunit tests/ORM/Driver/Postgres
    - stage: Test
      php: 7.2
      addons:
        postgresql: "9.4"
      env:
        - "DB=postgres POSTGRES=9.4"
      before_install:
        - psql -c 'create database spiral;' -U postgres
      script:
        - vendor/bin/phpunit tests/ORM/Driver/Postgres
    - stage: Test
      php: 7.2
      addons:
        postgresql: "9.5"
      env:
        - "DB=postgres POSTGRES=9.5"
      before_install:
        - psql -c 'create database spiral;' -U postgres
      script:
        - vendor/bin/phpunit tests/ORM/Driver/Postgres
    - stage: Test
      php: 7.2
      addons:
        postgresql: "9.6"
      env:
        - "DB=postgres POSTGRES=9.6"
      before_install:
        - psql -c 'create database spiral;' -U postgres
      script:
        - vendor/bin/phpunit tests/ORM/Driver/Postgres
    - stage: Test
      php: 7.2
      addons:
        postgresql: "10.0"
      env:
        - "DB=postgres POSTGRES=10.0"
      before_install:
        - bash ./tests/install-pgsql-10.sh
        - psql -c 'create database spiral;' -U postgres
      script:
        - vendor/bin/phpunit tests/ORM/Driver/Postgres
    # MariaDB
    - stage: Test
      php: 7.2
      addons:
        mariadb: "10.0"
      env:
        - "DB=mariadb MARIADB=10.0 PHP=7.1"
      before_install:
        - sudo bash ./tests/fix-binlog.sh
        - mysql -e 'CREATE DATABASE spiral;'
      script:
        - vendor/bin/phpunit tests/ORM/Driver/MySQL
    - stage: Test
      php: 7.2
      addons:
        mariadb: "10.0"
      env:
        - "DB=mariadb MARIADB=10.0"
      before_install:
        - sudo bash ./tests/fix-binlog.sh
        - mysql -e 'CREATE DATABASE spiral;'
      script:
        - vendor/bin/phpunit tests/ORM/Driver/MySQL
    - stage: Test
      php: 7.2
      addons:
        mariadb: "10.1"
      env:
        - "DB=mariadb MARIADB=10.1"
      before_install:
        - mysql -e 'CREATE DATABASE spiral;'
      script:
        - vendor/bin/phpunit tests/ORM/Driver/MySQL
    - stage: Test
      php: 7.2
      addons:
        mariadb: "10.2"
      env:
        - "DB=mariadb MARIADB=10.2"
      before_install:
        - mysql -e 'CREATE DATABASE spiral;'
      script:
        - vendor/bin/phpunit tests/ORM/Driver/MySQL
 |