language: php
php:
#- '7.0'
- '7.1'
- '7.2'
#- nightly

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

services:
- mysql

before_script:
  - cp .travis/env.travis.php env.php
  - composer install --dev --no-interaction --verbose

script:
- php artisan database:create --reset
- php artisan migrate:refresh --seed
- cp .travis/phpunit.travis.xml phpunit.xml
- vendor/bin/phpunit --debug --verbose

after_failure:
- cat storage/logs/*.log

jobs:
  include:
    - stage: package
      script: skip
      before_deploy:
        - curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
      deploy:
        - provider: script
          skip_cleanup: true
          script: ./.travis/deploy_script.sh
          on:
            all_branches: true
            php: '7.1'
    - stage: release
      script: skip
      before_deploy:
        - curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
        - ./.travis/deploy_script.sh
      deploy:
        provider: releases
        skip_cleanup: true
        api_key:
          secure: kAOYEThsSF8wM7vx+e+xWKhlvsNzhgKn1bk0zLBb7RLUM5pHIGKV/j0KrCNspwIUEPF0O594H6hCyswlpIZfxW2mTnmPqfbKxG/H2rLEAoOV0/MqzeC/gffxm7Eop6Sn4T/UC9kLSgqRynllbYtJDK6aWESdnvK3Fka0Cnpn7l/2phEf2J/nOF6QT/utpws1E0MUGqrKvX1/UYIu8np5e5aYLPOXnqahK8qzJFL4CyNBv+fhXuXfmOF4UbNbSPnrg/kY0QpUtFpz9ebvg5BjfMXJT0P4Q1BjgKBN76A7vz+ZfPmW6SqKv3o1yisXAgBWzylXh8B6pK+cUk4uXbagcGcIdkGOI6pQ5sLq+JOkBhVjSfogERePkt44KPif4EMsLRw/Jp4pTMy/vmgrON/jkbA+jXsOARTG5vAwIq4lyZzZXWUfirYwXeCfasgf+xTdo9C0cOE0jlqojO7SdF2CinDk9BduYpBTectea8Xx+YP5R1JCZNORDYynlLHKMW/8PJyAG+AsbcfKNTobQAfxw1nHa7GoKP1j4MSx1UtbulZdhmeRX/nUTFIvfgEDrl4cdBlt0/o5SuyN92DiCnvJZaYHcgXwYMvoqdXxBCnBKsM/1BZcykWi7Zt/q8krWYCOfCzBN4TDdmrKsEOUkCSOL9mI6gERHGmcGZN05PxU950=
        file_glob: true
        file: build/*
        on:
          tags: true
          repo: nabeelio/phpvms
          php: '7.1'
