diff --git a/.gitattributes b/.gitattributes index c153ad6f..bd38bfca 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,11 +1,9 @@ -/templates export-ignore -/tests export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore -/.scrutinizer.yml export-ignore -/.travis.yml export-ignore -/infection.json.dist export-ignore -/phpcs.xml.dist export-ignore -/phpstan.neon.dist export-ignore -/phpunit.xml.dist export-ignore -/README.md export-ignore +/.github export-ignore +/templates export-ignore +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.*.yml export-ignore +/*.dist export-ignore +/Makefile export-ignore +/README.md export-ignore diff --git a/.gitignore b/.gitignore index 44038013..1ddc143e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /vendor/ /composer.lock /.phpcs.cache -/infection-log.txt +/infection.log /.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml index efc25fb7..ae8b85b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ -dist: trusty -sudo: false +os: linux +dist: bionic language: php php: @@ -12,12 +12,17 @@ cache: before_install: - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" - - composer self-update -install: travis_retry composer install +install: + - | + if [ $TRAVIS_PHP_VERSION = 'nightly' ]; then + travis_retry travis_retry make vendor EXTRA_FLAGS="--ignore-platform-reqs"; + else + travis_retry travis_retry make vendor; + fi script: - - ./vendor/bin/phpunit + - make unit-test jobs: allow_failures: @@ -30,7 +35,7 @@ jobs: - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,} - if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi script: - - ./vendor/bin/phpunit --coverage-clover ./clover.xml + - make unit-test EXTRA_FLAGS="--coverage-clover ./clover.xml" after_script: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover ./clover.xml @@ -38,12 +43,12 @@ jobs: - stage: Code Quality env: CODE_STANDARD=1 script: - - ./vendor/bin/phpcs + - make coding-standard - stage: Code Quality env: STATIC_ANALYSIS=1 script: - - ./vendor/bin/phpstan analyse + - make static-analysis - stage: Code Quality env: MUTATION_TESTS=1 @@ -51,4 +56,4 @@ jobs: - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,} - if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for mutation tests"; exit 1; fi script: - - ./vendor/bin/infection --threads=$(nproc) --min-msi=100 --min-covered-msi=100 + - make mutation-test diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..38dac6fe --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +MIN_MSI=100 +MIN_COVERED_MSI=100 + +ifeq ("${CI}", "true") + PARALLELISM=4 +else + PARALLELISM=$(shell nproc) +endif + +.PHONY: valid test coding-standard-fix coding-standard static-analysis unit-test mutation-test + +valid: coding-standard-fix coding-standard static-analysis test + +test: unit-test mutation-test + +vendor: composer.json + composer install $(EXTRA_FLAGS) + @touch -c vendor + +coding-standard: vendor + vendor/bin/phpcs --parallel=$(PARALLELISM) + +coding-standard-fix: vendor + vendor/bin/phpcbf --parallel=$(PARALLELISM) || true + +static-analysis: vendor + vendor/bin/phpstan analyse $(EXTRA_FLAGS) + +unit-test: vendor + vendor/bin/phpunit --testsuite unit --stop-on-error --stop-on-failure $(EXTRA_FLAGS) + +mutation-test: vendor + vendor/bin/infection --no-progress -j=$(PARALLELISM) -s --min-msi=$(MIN_MSI) --min-covered-msi=$(MIN_COVERED_MSI) $(EXTRA_FLAGS) diff --git a/infection.json.dist b/infection.json.dist index 398b4ae4..e11488e8 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -4,6 +4,6 @@ "directories": ["src"] }, "logs": { - "text": "infection-log.txt" + "text": "infection.log" } }