From 95fad5b86fda20eac8343b6b3cadfe59c4e6f6b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Thu, 2 Jul 2020 18:46:05 +0200 Subject: [PATCH 1/6] Remove unnecessary files from repository artifacts --- .gitattributes | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.gitattributes b/.gitattributes index c153ad6f..d645bd2f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,11 +1,8 @@ -/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 +/README.md export-ignore From 30a0f562cbe6e941833f217db8c2fd7797480afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Thu, 2 Jul 2020 18:46:51 +0200 Subject: [PATCH 2/6] Use standard infection log file --- .gitignore | 2 +- infection.json.dist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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" } } From 1db6ae857a5181134e62b7491e0251bb1355dd1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Thu, 2 Jul 2020 18:56:25 +0200 Subject: [PATCH 3/6] Use newest distro available --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index efc25fb7..923d3db4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ -dist: trusty -sudo: false +os: linux +dist: bionic language: php php: From 5ca8aebb605f3afb0f5aeda126044fd3b3aaf802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Thu, 2 Jul 2020 19:06:05 +0200 Subject: [PATCH 4/6] Remove unnecessary `composer self-update` --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 923d3db4..3602c0f0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ 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 From bff03fe3cf7cef103d80eda14e584e31d4cb72d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Thu, 2 Jul 2020 19:08:17 +0200 Subject: [PATCH 5/6] Use GNU Make Making things easier to run on CI and locally. --- .gitattributes | 1 + .travis.yml | 12 ++++++------ Makefile | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 Makefile diff --git a/.gitattributes b/.gitattributes index d645bd2f..bd38bfca 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,4 +5,5 @@ /.gitignore export-ignore /.*.yml export-ignore /*.dist export-ignore +/Makefile export-ignore /README.md export-ignore diff --git a/.travis.yml b/.travis.yml index 3602c0f0..ba568e3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,10 +13,10 @@ cache: before_install: - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" -install: travis_retry composer install +install: travis_retry make vendor script: - - ./vendor/bin/phpunit + - make unit-test jobs: allow_failures: @@ -29,7 +29,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 @@ -37,12 +37,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 @@ -50,4 +50,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) From fa39dd00f249cb5792eacaa0b2f890596e332041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Thu, 2 Jul 2020 19:19:53 +0200 Subject: [PATCH 6/6] Make tests run on PHP 8.0 --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ba568e3c..ae8b85b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,13 @@ cache: before_install: - mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available" -install: travis_retry make vendor +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: - make unit-test