Saibamen/HotelManager

View on GitHub
.travis.yml

Summary

Maintainability
Test Coverage
language: php

dist: trusty # TODO: Migrate to xenial: https://docs.travis-ci.com/user/trusty-to-xenial-migration-guide

cache:
  directories:
    - vendor

os:
  - linux
  # PHP tags are not supported on OS X: https://github.com/travis-ci/travis-ci/issues/2313
  #- osx

php:
  - 7.1
  - 7.2
  - 7.3
  - 7.4
  #- 8.0
  #- nightly # Enable after migrating to Laravel 6.x

jobs:
  allow_failures:
    - php: nightly

services:
  - mysql
  - postgresql

env:
  - DB=sqlite DB_CONNECTION=sqlite
  - DB=mysql DB_CONNECTION=testing
  - DB=mariadb DB_CONNECTION=testing
  - DB=postgres DB_CONNECTION=pgsql

matrix:
  include:
    # Minimum PHP version for Laravel 5.6 is 7.1.3
    - php: 7.1.3
      dist: precise
      env: DB=sqlite DB_CONNECTION=sqlite

    - php: 7.1.3
      dist: precise
      env: DB=postgres DB_CONNECTION=pgsql

addons:
  code_climate:
    repo_token: $CODE_CLIMATE_TOKEN
  mariadb: '10.0'

before_install:
  #- sudo mount -o remount,size=50% /var/ramfs # https://docs.travis-ci.com/user/trusty-to-xenial-migration-guide
  - sh -c "if [ '$DB' = 'sqlite' ]; then echo 'Creating database'; touch database/database.sqlite; fi"
  - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'DROP DATABASE IF EXISTS homestead_test;' -U postgres; fi"
  - sh -c "if [ '$DB' = 'postgres' ]; then psql -c 'CREATE DATABASE homestead_test;' -U postgres; fi"
  - sh -c "if [ '$DB' = 'mysql' ] || [ '$DB' = 'mariadb' ]; then echo 'Creating database'; mysql -e 'CREATE DATABASE homestead_test;'; fi"

install:
  - chmod -R 777 bootstrap/cache
  - chmod -R 777 storage
  - cp .env.travis .env
  - travis_retry composer self-update --2
  - travis_retry composer update --no-interaction --no-suggest

before_script:
  - 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
  - php artisan key:generate
  - php artisan migrate --env=testing --no-interaction -vvv --database=$DB_CONNECTION
  - php artisan db:seed --env=testing --no-interaction -vvv --database=$DB_CONNECTION

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

after_script:
  - php artisan migrate:rollback --env=testing --no-interaction -vvv --database=$DB_CONNECTION
  - php vendor/bin/codacycoverage clover
  - vendor/bin/test-reporter
  - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT

after_success:
  - bash <(curl -s https://codecov.io/bash)