From 24cbdb31d337e283d2577bd9501807100e6d2fd7 Mon Sep 17 00:00:00 2001 From: Marek Bartos Date: Fri, 9 Nov 2018 12:54:39 +0100 Subject: [PATCH] Update build --- .editorconfig | 6 +- .gitattributes | 5 +- .gitignore | 5 +- .travis.yml | 103 +++++++++++++++++++++++------ readme.md => README.md | 6 +- composer.json | 17 +++-- phpstan.neon | 3 +- src/DI/ParsedownExtraExtension.php | 2 +- tests/.gitignore | 10 +++ 9 files changed, 112 insertions(+), 45 deletions(-) rename readme.md => README.md (93%) create mode 100644 tests/.gitignore diff --git a/.editorconfig b/.editorconfig index 1314c8b..575834a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -11,10 +11,6 @@ indent_style = tab indent_size = tab tab_width = 4 -[*.md] -indent_style = space -indent_size = 4 - -[{composer.json,package.json,.travis.yml}] +[{*.json,*.yml,*.md}] indent_style = space indent_size = 2 diff --git a/.gitattributes b/.gitattributes index 0335bd2..c52e7b9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,7 +5,6 @@ tests export-ignore .gitattributes export-ignore .gitignore export-ignore .travis.yml export-ignore -LICENSE export-ignore -README.md export-ignore phpstan.neon export-ignore -ruleset.xml +README.md export-ignore +ruleset.xml export-ignore diff --git a/.gitignore b/.gitignore index a9041d2..b1b6f4d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,5 @@ /composer.lock # Tests -/temp/ -/tests/*.log -/tests/tmp -/tests/coverage.html +/temp /coverage.xml diff --git a/.travis.yml b/.travis.yml index 5a35690..48b030a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,11 @@ language: php - php: - 7.1 - 7.2 + - 7.3 before_install: - # turn off XDebug + # Turn off XDebug - phpenv config-rm xdebug.ini || return 0 install: @@ -13,8 +13,12 @@ install: - travis_retry composer install --no-progress --prefer-dist script: - # Nette/Tester - - composer run-script tester + # Tests + - composer run-script tests + +after_failure: + # Print *.actual content + - for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done jobs: include: @@ -23,41 +27,102 @@ jobs: install: - travis_retry composer update --no-progress --prefer-dist --prefer-lowest script: - - composer run-script tester - - - env: title="Lowest Dependencies 7.2" - php: 7.2 - install: - - travis_retry composer update --no-progress --prefer-dist --prefer-lowest - script: - - composer run-script tester + - composer run-script tests - stage: Quality Assurance - php: 7.2 + php: 7.1 script: - composer run-script qa + - stage: Phpstan + php: 7.1 + script: + - composer run-script phpstan-install + - composer run-script phpstan + - stage: Test Coverage - php: 7.2 + if: branch = master AND type = push + php: 7.1 script: - composer run-script coverage after_script: - - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.0.0/php-coveralls.phar + - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar - php php-coveralls.phar --verbose --config tests/.coveralls.yml - - stage: Phpstan - php: 7.2 + - stage: Outdated Dependencies + if: branch = master AND type = cron + php: 7.1 script: - - composer run-script phpstan-install - - composer run-script phpstan + - composer outdated --direct --strict allow_failures: - stage: Test Coverage +sudo: false + +cache: + directories: + - $HOME/.composer/cache +language: php +php: + - 7.1 + - 7.2 + - 7.3 + +before_install: + # Turn off XDebug + - phpenv config-rm xdebug.ini || return 0 + +install: + # Composer + - travis_retry composer install --no-progress --prefer-dist + +script: + # Tests + - composer run-script tests + after_failure: # Print *.actual content - for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done +jobs: + include: + - env: title="Lowest Dependencies 7.1" + php: 7.1 + install: + - travis_retry composer update --no-progress --prefer-dist --prefer-lowest + script: + - composer run-script tests + + - stage: Quality Assurance + php: 7.1 + script: + - composer run-script qa + + - stage: Phpstan + php: 7.1 + script: + - composer run-script phpstan-install + - composer run-script phpstan + + - stage: Test Coverage + if: branch = master AND type = push + php: 7.1 + script: + - composer run-script coverage + after_script: + - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar + - php php-coveralls.phar --verbose --config tests/.coveralls.yml + + - stage: Outdated Dependencies + if: branch = master AND type = cron + php: 7.1 + script: + - composer outdated --direct --strict + + allow_failures: + - stage: Test Coverage + sudo: false cache: diff --git a/readme.md b/README.md similarity index 93% rename from readme.md rename to README.md index 90ee729..99aee29 100644 --- a/readme.md +++ b/README.md @@ -7,10 +7,10 @@ [![Build Status](https://img.shields.io/travis/contributte/latte-parsedown-extra.svg?style=flat-square)](https://travis-ci.org/contributte/latte-parsedown-extra) [![Code coverage](https://img.shields.io/coveralls/contributte/latte-parsedown-extra.svg?style=flat-square)](https://coveralls.io/r/contributte/latte-parsedown-extra) [![Licence](https://img.shields.io/packagist/l/contributte/latte-parsedown-extra.svg?style=flat-square)](https://packagist.org/packages/contributte/latte-parsedown-extra) - [![Downloads this Month](https://img.shields.io/packagist/dm/contributte/latte-parsedown-extra.svg?style=flat-square)](https://packagist.org/packages/contributte/latte-parsedown-extra) [![Downloads total](https://img.shields.io/packagist/dt/contributte/latte-parsedown-extra.svg?style=flat-square)](https://packagist.org/packages/contributte/latte-parsedown-extra) [![Latest stable](https://img.shields.io/packagist/v/contributte/latte-parsedown-extra.svg?style=flat-square)](https://packagist.org/packages/contributte/latte-parsedown-extra) +[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) ## Discussion / Help @@ -50,13 +50,13 @@ composer require contributte/latte-parsedown-extra - +
Marek Bartoš - + --- diff --git a/composer.json b/composer.json index ec3cb34..fe15963 100644 --- a/composer.json +++ b/composer.json @@ -2,13 +2,11 @@ "name": "contributte/latte-parsedown-extra", "description": "ParsedownExtra parser for Latte", "type": "library", - "license": [ - "MIT" - ], + "license": "MIT", "homepage": "https://github.com/contributte/latte-parsedown-extra", "authors": [ { - "name": "Milan Felix Sulc", + "name": "Milan Felix Šulc", "homepage": "https://f3l1x.io" } ], @@ -37,17 +35,18 @@ "linter src tests", "codesniffer src tests" ], - "tester": [ + "tests": [ "tester -s -p php --colors 1 -C tests/cases" ], "coverage": [ - "tester -s -p php --colors 1 -C -d extension=xdebug.so --coverage ./coverage.xml --coverage-src ./src tests/cases" + "tester -s -p phpdbg --colors 1 -C --coverage ./coverage.xml --coverage-src ./src tests/cases" ], "phpstan-install": [ "mkdir -p temp/phpstan", - "composer require -d temp/phpstan phpstan/phpstan:0.9.2", - "composer require -d temp/phpstan phpstan/phpstan-nette:0.9", - "composer require -d temp/phpstan phpstan/phpstan-strict-rules:0.9" + "composer require -d temp/phpstan phpstan/phpstan:^0.10", + "composer require -d temp/phpstan phpstan/phpstan-deprecation-rules:^0.10", + "composer require -d temp/phpstan phpstan/phpstan-nette:^0.10", + "composer require -d temp/phpstan phpstan/phpstan-strict-rules:^0.10" ], "phpstan": [ "temp/phpstan/vendor/bin/phpstan analyse -l max -c phpstan.neon src" diff --git a/phpstan.neon b/phpstan.neon index 96a9f2c..4148de4 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,5 @@ includes: - - temp/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon + - temp/phpstan/vendor/phpstan/phpstan-deprecation-rules/rules.neon - temp/phpstan/vendor/phpstan/phpstan-nette/extension.neon - temp/phpstan/vendor/phpstan/phpstan-nette/rules.neon + - temp/phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon diff --git a/src/DI/ParsedownExtraExtension.php b/src/DI/ParsedownExtraExtension.php index fb3d493..4df8cf3 100644 --- a/src/DI/ParsedownExtraExtension.php +++ b/src/DI/ParsedownExtraExtension.php @@ -29,7 +29,7 @@ public function loadConfiguration(): void $builder = $this->getContainerBuilder(); $builder->addDefinition($this->prefix('parsedown')) - ->setClass(ParsedownExtraAdapter::class); + ->setFactory(ParsedownExtraAdapter::class); } /** diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..f0d3402 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,10 @@ +# Folders - recursive +*.expected +*.actual + +# Folders +/tmp + +# Files +/*.log +/*.html