Skip to content

Commit

Permalink
CI: improvement Travis, added phpstan, updated tester
Browse files Browse the repository at this point in the history
  • Loading branch information
josefbenjac committed Oct 13, 2017
1 parent 8b20956 commit cf6fd56
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 54 deletions.
84 changes: 46 additions & 38 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,59 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- hhvm

matrix:
fast_finish: true
- 5.6
- 7.0
- 7.1
- 7.2

allow_failures:
- php: hhvm
before_install:
# turn off XDebug
- phpenv config-rm xdebug.ini || return 0

include:
- php: 5.6
env: COMPOSER_FLAG=--prefer-lowest
- php: 5.6
env: COMPOSER_FLAG=--prefer-stable
- php: 7.0
env: COMPOSER_FLAG=--prefer-lowest
- php: 7.0
env: COMPOSER_FLAG=--prefer-stable
- php: 7.1
env: COMPOSER_FLAG=--prefer-lowest
- php: 7.1
env: COMPOSER_FLAG=--prefer-stable

before_script:
install:
# Composer
- travis_retry composer install --no-interaction
# Coverage
- if [[ "$TRAVIS_PHP_VERSION" == "7.1" && "$COMPOSER_FLAG" == "" ]]; then COVERAGE=1; fi
- travis_retry composer install --no-progress --prefer-dist

script:
# Quality Assurance
- travis_retry composer qa

# Nette\Tester
# Nette/Tester
- composer run-script tester

# Nette\Tester + CodeCoverage
- if [ "$COVERAGE" != "" ]; then composer tester-coverage; fi
jobs:
include:
- env: title="Lowest Dependencies 5.6"
php: 5.6
install:
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest
script:
- composer run-script tester

after_script:
# Coverage (Coveralls)
- if [ "$COVERAGE" != "" ]; then wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; fi
- if [ "$COVERAGE" != "" ]; then php coveralls.phar --verbose --config tests/.coveralls.yml; fi
- env: title="Lowest Dependencies 7.1"
php: 7.1
install:
- travis_retry composer update --no-progress --prefer-dist --prefer-lowest
script:
- composer run-script tester

- stage: Quality Assurance
php: 7.1
script:
- composer run-script qa

- stage: Test Coverage
php: 7.1
script:
- composer run-script coverage
after_script:
- wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar
- php coveralls.phar --verbose --config tests/.coveralls.yml

- stage: Phpstan
php: 7.1
script:
- composer run-script phpstan-install
- composer run-script phpstan

allow_failures:
- stage: Test Coverage

after_failure:
# Print *.actual content
Expand Down
16 changes: 12 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"require-dev": {
"ninjify/qa": "~0.4.0",
"ninjify/nunjuck": "~0.1.4"
"ninjify/nunjuck": "~0.2.0"
},
"autoload": {
"psr-4": {
Expand All @@ -32,10 +32,18 @@
"codesniffer src tests"
],
"tester": [
"tester -s -p php --colors 1 -c tests/php-unix.ini tests/cases"
"tester -s -p php --colors 1 -C tests/cases"
],
"tester-coverage": [
"tester -s -p php --colors 1 -c tests/php-unix.ini -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src tests/cases"
"coverage": [
"tester -s -p php --colors 1 -C -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src tests/cases"
],
"phpstan-install": [
"mkdir -p temp/phpstan",
"composer require -d temp/phpstan phpstan/phpstan:0.8.5",
"composer require -d temp/phpstan phpstan/phpstan-nette:0.8.3"
],
"phpstan": [
"temp/phpstan/vendor/bin/phpstan analyse -l 7 -c phpstan.neon src"
]
}
}
5 changes: 5 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
includes:
- temp/phpstan/vendor/phpstan/phpstan-nette/extension.neon
- temp/phpstan/vendor/phpstan/phpstan-nette/rules.neon

parameters:
2 changes: 1 addition & 1 deletion src/DI/MigrationsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
final class MigrationsExtension extends CompilerExtension
{

/** @var string[] */
/** @var mixed[] */
private $defaults = [
'table' => 'doctrine_migrations',
'column' => 'version',
Expand Down
7 changes: 4 additions & 3 deletions src/Helper/ConfigurationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class ConfigurationHelper extends BaseConfigurationHelper
{

/** @var Configuration */
/** @var Configuration|NULL */
private $configuration;

/**
Expand All @@ -31,8 +31,9 @@ public function __construct(Connection $connection = NULL, Configuration $config
*/
public function getMigrationConfig(InputInterface $input, OutputWriter $outputWriter)
{
$this->configuration->setOutputWriter($outputWriter);

if ($this->configuration !== NULL) {
$this->configuration->setOutputWriter($outputWriter);
}
return $this->configuration;
}

Expand Down
8 changes: 0 additions & 8 deletions tests/php-unix.ini

This file was deleted.

0 comments on commit cf6fd56

Please sign in to comment.