sudo: false

language: php

matrix:
  fast_finish: true
  include:
    - php: 7.0
      env: DB=mysql
      services: mysql
    - php: 7.0
      env: DB=postgres
      services: postgresql
    - php: 7.1
      env: DB=mysql
      services: mysql
    - php: 7.1
      env: DB=postgres
      services: postgresql
    - php: 7.2
      env: DB=mysql
      services: mysql
    - php: 7.2
      env: DB=postgres
      services: postgresql

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

before_install:
  - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database plus;' -U postgres; echo "$DB"; fi"
  - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS plus;'; echo "$DB"; fi"
  - sh -c "php ./.travis.php "$DB""
  - php -r "file_exists('.env') || copy('.env.travis', '.env');"

install:
  - composer install
  - php artisan key:generate
  - php artisan jwt:secret --force
  - php artisan migrate -vvv
  - php artisan db:seed -vvv
  - php artisan vendor:publish --all -vvv

script:
  - php vendor/bin/phpunit --coverage-clover=./storage/logs/coverage.xml

after_script:
  - php vendor/bin/codacycoverage clover ./storage/logs/coverage.xml

sudo: false

language: php

matrix:
  fast_finish: true
  include:
    - php: 7.0
      env: DB=mysql
      services: mysql
    - php: 7.0
      env: DB=postgres
      services: postgresql
    - php: 7.1
      env: DB=mysql
      services: mysql
    - php: 7.1
      env: DB=postgres
      services: postgresql
    - php: 7.2
      env: DB=mysql
      services: mysql
    - php: 7.2
      env: DB=postgres
      services: postgresql

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

before_install:
  - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'create database plus;' -U postgres; echo "$DB"; fi"
  - sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS plus;'; echo "$DB"; fi"
  - sh -c "php ./.travis.php "$DB""
  - php -r "file_exists('.env') || copy('.env.travis', '.env');"

install:
  - composer install
  - php artisan key:generate
  - php artisan jwt:secret --force
  - php artisan migrate -vvv
  - php artisan db:seed -vvv
  - php artisan vendor:publish --all -vvv

script:
  - php vendor/bin/phpunit --coverage-clover=coverage.xml

after_script:
  - php vendor/bin/codacycoverage clover coverage.xml
  - bash <(curl -s https://codecov.io/bash)

Add codecov to phpunit after.
chore: Add codecov to phpunit after.
