Skip to content

Commit

Permalink
Update travis config
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed May 25, 2020
1 parent fabdaa5 commit 87f6cf9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
44 changes: 25 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@ language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.4

dist: trusty

sudo: false
services:
- postgresql
- mysql

env:
global:
- DEFAULT=1
- CODECOVERAGE=0
matrix:
- DB=mysql DB_DSN='mysql://root@127.0.0.1/cakephp_test?init[]=SET sql_mode = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"'
- DB=pgsql DB_DSN='postgres://postgres@127.0.0.1/cakephp_test'
- DB=sqlite DB_DSN='sqlite:///:memory:'

matrix:
fast_finish: true

include:
- php: 7.2
env: CODECOVERAGE=1 DEFAULT=0

- php: 7.0
- php: 7.4
env: PHPCS=1 DEFAULT=0

- php: 7.1
Expand All @@ -31,22 +29,30 @@ matrix:
- php: 5.6
env: PREFER_LOWEST=1

before_script:
- if [[ $TRAVIS_PHP_VERSION != 7.0 ]]; then phpenv config-rm xdebug.ini; fi
before_install:
- if [[ $DB == 'mysql' ]]; then mysql -u root -e 'CREATE DATABASE cakephp_test;'; fi
- if [[ $DB == 'pgsql' ]]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi

install:
- if [[ $TRAVIS_PHP_VERSION != 7.4 ]]; then phpenv config-rm xdebug.ini; fi

- if [[ $PHPSTAN = 1 ]]; then composer require --dev phpstan/phpstan:^0.11; fi
- if [[ $PHPSTAN != 1 ]]; then composer install --no-interaction; fi
- |
if [[ $PHPSTAN == 1 ]]; then
composer require phpstan/phpstan:^0.12
composer install --no-dev
fi
script:
- if [[ $CODECOVERAGE = 1 ]]; then ./vendor/bin/phpunit --coverage-clover=clover.xml; fi
- if [[ $DEFAULT = 1 ]]; then ./vendor/bin/phpunit; fi
- if [[ $TRAVIS_PHP_VERSION == 7.4 ]]; then ./vendor/bin/phpunit --coverage-clover=clover.xml; fi
- if [[ $DEFAULT == 1 ]]; then ./vendor/bin/phpunit; fi

- if [[ $PHPCS = 1 ]]; then ./vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi
- if [[ $PHPCS == 1 ]]; then ./vendor/bin/phpcs -p --extensions=php --standard=vendor/cakephp/cakephp-codesniffer/CakePHP ./src ./tests; fi

- if [[ $PHPSTAN = 1 ]]; then vendor/bin/phpstan analyse src; fi
- if [[ $PHPSTAN == 1 ]]; then vendor/bin/phpstan analyse src; fi

after_success:
- if [[ $CODECOVERAGE = 1 ]]; then bash <(curl -s https://codecov.io/bash); fi
- if [[ $TRAVIS_PHP_VERSION == 7.4 ]]; then bash <(curl -s https://codecov.io/bash); fi

notifications:
email: false
12 changes: 5 additions & 7 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,12 @@
],
]);

$config = [
'url' => 'sqlite:/' . TMP . 'webservice_test.sqlite',
'timezone' => 'UTC',
];
if (!getenv('DB_DSN')) {
putenv('DB_DSN=sqlite:///:memory:');
}

// Use the test connection for 'debug_kit' as well.
ConnectionManager::setConfig('test', $config);
ConnectionManager::setConfig('test_webservice', $config);
ConnectionManager::setConfig('test', ['url' => getenv('DB_DSN')]);
ConnectionManager::setConfig('test_webservice', ['url' => getenv('DB_DSN')]);

Log::setConfig([
'debug' => [
Expand Down

0 comments on commit 87f6cf9

Please sign in to comment.