22
33# Use any most recent PHP version
44PHP =$(shell which php)
5- PHPDBG =php
65
76# Default parallelism
87JOBS =$(shell nproc)
98
10- # Default silencer if installed
11- SILENT =$(shell which chronic)
12-
139# PHP CS Fixer
1410PHP_CS_FIXER =vendor/bin/php-cs-fixer
15- PHP_CS_FIXER_ARGS=--cache-file =build/cache/.php_cs.cache --verbose
11+ PHP_CS_FIXER_ARGS =--diff --diff-format=udiff --verbose
1612export PHP_CS_FIXER_IGNORE_ENV =1
1713
1814# PHPUnit
@@ -35,37 +31,27 @@ COMPOSER=$(PHP) $(shell which composer)
3531INFECTION =vendor/bin/infection
3632MIN_MSI =52.212389380531
3733MIN_COVERED_MSI =95
38- INFECTION_ARGS=--min-msi =$(MIN_MSI ) --min-covered-msi=$(MIN_COVERED_MSI ) --threads=$(JOBS ) --log-verbosity=default --show-mutations
34+ INFECTION_ARGS=--min-msi =$(MIN_MSI ) --min-covered-msi=$(MIN_COVERED_MSI ) --threads=$(JOBS ) --log-verbosity=none --no-interaction --no-progress
3935
4036all : test
4137
42- # #############################################################
43- # Continuous Integration #
44- # #############################################################
38+ cs :
39+ $( PHP_CS_FIXER ) fix $( PHP_CS_FIXER_ARGS ) --dry-run
40+ LC_ALL=C sort -c -u .gitignore
4541
46- ci-test : SILENT=
47- ci-test : prerequisites
48- $(SILENT ) $(PHPDBG ) $(PHPUNIT ) $(PHPUNIT_COVERAGE_CLOVER )
49- # tests/e2e_tests
42+ phpstan :
43+ $(PHPSTAN ) $(PHPSTAN_ARGS ) --no-progress
5044
51- ci-analyze : SILENT=
52- ci-analyze : prerequisites ci-cs ci-infection ci-phpstan ci-psalm
45+ psalm :
46+ $( PSALM ) $( PSALM_ARGS ) --no-cache --shepherd
5347
54- ci-phpunit : ci-cs
55- $(SILENT ) $(PHPDBG ) $(PHPUNIT ) $(PHPUNIT_ARGS )
56- cp build/logs/junit.xml build/logs/phpunit.junit.xml
48+ static-analyze : phpstan psalm
5749
58- ci-infection :
59- $(SILENT ) $(PHP ) $( INFECTION ) $( INFECTION_ARGS )
50+ test-unit :
51+ $(PHPUNIT ) $(PHPUNIT_ARGS )
6052
61- ci-phpstan : ci-cs
62- $(SILENT ) $(PHP ) $(PHPSTAN ) $(PHPSTAN_ARGS ) --no-progress
63-
64- ci-psalm : ci-cs
65- $(SILENT ) $(PHP ) $(PSALM ) $(PSALM_ARGS ) --no-cache --shepherd
66-
67- ci-cs : prerequisites
68- $(SILENT ) $(PHP ) $(PHP_CS_FIXER ) $(PHP_CS_FIXER_ARGS ) --dry-run --stop-on-violation fix
53+ infection :
54+ $(INFECTION ) $(INFECTION_ARGS )
6955
7056# #############################################################
7157# Development Workflow #
@@ -75,21 +61,21 @@ test: phpunit analyze composer-validate
7561
7662.PHONY : composer-validate
7763composer-validate : test-prerequisites
78- $(SILENT ) $( COMPOSER ) validate --strict
64+ $(COMPOSER ) validate --strict
7965
8066test-prerequisites : prerequisites composer.lock
8167
82- phpunit : cs
83- $(SILENT ) $( PHP ) $( PHPUNIT ) $(PHPUNIT_ARGS ) --verbose
68+ phpunit : cs-fix
69+ $(PHPUNIT ) $(PHPUNIT_ARGS ) --verbose
8470 cp build/logs/junit.xml build/logs/phpunit.junit.xml
85- $(SILENT ) $( PHP ) $(INFECTION ) $(INFECTION_ARGS )
71+ $(PHP ) $(INFECTION ) $(INFECTION_ARGS )
8672
87- analyze : cs
88- $(SILENT ) $( PHP ) $( PHPSTAN ) $(PHPSTAN_ARGS )
89- $(SILENT ) $( PHP ) $( PSALM ) $(PSALM_ARGS )
73+ analyze : cs-fix
74+ $(PHPSTAN ) $(PHPSTAN_ARGS )
75+ $(PSALM ) $(PSALM_ARGS )
9076
91- cs : test-prerequisites
92- $(SILENT ) $( PHP ) $(PHP_CS_FIXER ) $( PHP_CS_FIXER_ARGS ) --diff fix
77+ cs-fix : test-prerequisites
78+ $(PHP_CS_FIXER ) fix $(PHP_CS_FIXER_ARGS )
9379 LC_ALL=C sort -u .gitignore -o .gitignore
9480
9581# #############################################################
@@ -98,21 +84,17 @@ cs: test-prerequisites
9884
9985# We need both vendor/autoload.php and composer.lock being up to date
10086.PHONY : prerequisites
101- prerequisites : report-php-version build/cache vendor/autoload.php composer.lock infection.json.dist .phpstan.neon
87+ prerequisites : build/cache vendor/autoload.php composer.lock infection.json.dist .phpstan.neon
10288
10389# Do install if there's no 'vendor'
10490vendor/autoload.php :
105- $(SILENT ) $( COMPOSER ) install --prefer-dist
106- test -d vendor/infection/infection/src/StreamWrapper/ && rm -fr vendor/infection/infection/src/StreamWrapper/ && $(SILENT ) $( COMPOSER ) dump-autoload || true
91+ $(COMPOSER ) install --prefer-dist
92+ test -d vendor/infection/infection/src/StreamWrapper/ && rm -fr vendor/infection/infection/src/StreamWrapper/ && $(COMPOSER ) dump-autoload || true
10793
10894# If composer.lock is older than `composer.json`, do update,
10995# and touch composer.lock because composer not always does that
11096composer.lock : composer.json
111- $(SILENT ) $( COMPOSER ) update && touch composer.lock
97+ $(COMPOSER ) update && touch composer.lock
11298
11399build/cache :
114100 mkdir -p build/cache
115-
116- .PHONY : report-php-version
117- report-php-version :
118- # Using $(PHP)
0 commit comments