language: php

php:
  - '5.5'
  - '5.6'
  - '7.0'
  - '7.1'
  - '7.2'

env:
  - MYSQL_VERSION=5.7
  - MYSQL_VERSION=8.0

dist: trusty

sudo: required

services:
  - docker

before_install:
  - sudo /etc/init.d/mysql stop
  - make start_db V=$MYSQL_VERSION

install: composer install

before_script:
  - mkdir -p build/logs
  - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
  - chmod +x ./cc-test-reporter
  - ./cc-test-reporter before-build

script: vendor/bin/phpunit --coverage-clover build/logs/clover.xml

after_script:
  - php vendor/bin/coveralls -v
  - ./cc-test-reporter after-build --coverage-input-type clover --exit-code $TRAVIS_TEST_RESULT

