diff --git a/.travis.yml b/.travis.yml index 0c89077a..19f59eb0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,19 +2,33 @@ language: php php: - 7.1 +env: +matrix: + include: + - php: 7.1 + env: coverage=on + - php: 7.1 + env: codingStandard=on + + allow_failures: + - php: 7.1 + env: coverage=on + script: - - vendor/bin/tester tests -s -p php -c tests/php-unix.ini $COVERAGE - - php temp/code-checker/src/code-checker.php --short-arrays + - vendor/bin/tester tests -s -p php -c tests/php-unix.ini $coverageArgs + - > + if [ "$codingStandard" ]; then + php temp/code-checker/src/code-checker.php --short-arrays --strict-types + && php temp/coding-standard/ecs check src tests --config temp/coding-standard/coding-standard-php71.neon; + fi after_failure: # Print *.actual content - for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done before_script: - # Install Nette Tester & Code Checker - - travis_retry composer install --no-interaction - - travis_retry composer create-project nette/code-checker temp/code-checker ~2.5 --no-interaction - - if [ $TRAVIS_PHP_VERSION == "7.1" ]; then COVERAGE="-p phpdbg --coverage ./coverage.xml --coverage-src ./src"; fi + # Install Nette Tester + - travis_retry composer install --no-interaction --prefer-dist # Create databases.ini - cp ./tests/databases.travis.ini ./tests/databases.ini @@ -22,13 +36,21 @@ before_script: # Create Postgre database - psql -c 'CREATE DATABASE dibi_test' -U postgres + # Install Code Checkers + - > + if [ "$codingStandard" ]; then + travis_retry composer create-project nette/code-checker temp/code-checker ~2 --no-interaction; + travis_retry composer create-project nette/coding-standard temp/coding-standard --no-interaction; + fi + - if [ "$coverage" ]; then coverageArgs="-p phpdbg --coverage ./coverage.xml --coverage-src ./src"; fi + after_script: # Report Code Coverage - > - if [ "$COVERAGE" != "" ]; then + if [ "$coverage" ]; then wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar - && php coveralls.phar --verbose --config tests/.coveralls.yml - || true; fi + && php coveralls.phar --verbose --config tests/.coveralls.yml; + fi sudo: false