@@ -3,43 +3,64 @@ SHELL=bash
33
44.PHONY : *
55
6+ DOCKER_CGROUP: =$(shell cat /proc/1/cgroup | grep docker | wc -l)
7+
68ifneq ("$(wildcard /.dockerenv) ","")
7- DOCKER_RUN =
9+ IN_DOCKER =TRUE
10+ else ifneq ("$(DOCKER_CGROUP)","0")
11+ IN_DOCKER=TRUE
12+ else
13+ IN_DOCKER =FALSe
14+ endif
15+
16+ ifeq ("$(IN_DOCKER ) ","TRUE")
17+ DOCKER_RUN=
818else
919 DOCKER_RUN=docker run --rm -it \
10- -v `pwd`:`pwd` \
11- -w `pwd` \
12- "wyrihaximusnet/php:7.4-zts-alpine3.11 -dev"
20+ -v " `pwd`:`pwd`" \
21+ -w " `pwd`" \
22+ "wyrihaximusnet/php:7.4-zts-alpine3.12 -dev"
1323endif
1424
15- all : lint cs-fix cs stan psalm unit infection composer-require-checker composer-unused
25+ all : syntax-php cs-fix cs stan psalm unit infection composer-require-checker composer-unused backward-compatibility-check
1626
17- lint :
27+ syntax-php : # # Lint PHP syntax
1828 $(DOCKER_RUN ) vendor/bin/parallel-lint --exclude vendor .
1929
20- cs :
21- $(DOCKER_RUN ) vendor/bin/phpcs --parallel=$(nproc )
30+ cs : # # Check the code for code style issues
31+ $(DOCKER_RUN ) vendor/bin/phpcs --parallel=$(shell nproc)
2232
23- cs-fix :
24- $(DOCKER_RUN ) vendor/bin/phpcbf --parallel=$(nproc )
33+ cs-fix : # # Fix any automatically fixable code style issues
34+ $(DOCKER_RUN ) vendor/bin/phpcbf --parallel=$(shell nproc)
2535
26- stan :
36+ stan : # # Run static analysis (PHPStan)
2737 $(DOCKER_RUN ) vendor/bin/phpstan analyse src tests --level max --ansi -c phpstan.neon
2838
29- psalm :
30- $(DOCKER_RUN ) vendor/bin/psalm --threads=$(nproc ) --shepherd --stats
39+ psalm : # # Run static analysis (Psalm)
40+ $(DOCKER_RUN ) vendor/bin/psalm --threads=$(shell nproc) --shepherd --stats
3141
32- unit :
42+ unit : # # Run tests
3343 $(DOCKER_RUN ) vendor/bin/phpunit --colors=always -c phpunit.xml.dist --coverage-text --coverage-html covHtml --coverage-clover ./build/logs/clover.xml
3444
3545unit-ci : unit
3646 if [ -f ./build/logs/clover.xml ]; then wget https://scrutinizer-ci.com/ocular.phar && sleep 3 && php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi
3747
38- infection :
39- $(DOCKER_RUN ) vendor/bin/infection --ansi --min-msi=100 --min-covered-msi=100 --threads=$(nproc )
48+ infection : # # Run mutation testing
49+ $(DOCKER_RUN ) vendor/bin/infection --ansi --min-msi=100 --min-covered-msi=100 --threads=$(shell nproc)
4050
41- composer-require-checker :
51+ composer-require-checker : # # Ensure we require every package used in this package directly
4252 $(DOCKER_RUN ) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=composer-require-checker.json
4353
44- composer-unused :
54+ composer-unused : # # Ensure we don't require any package we don't use in this package directly
4555 $(DOCKER_RUN ) composer unused --ansi
56+
57+ backward-compatibility-check : # # Check code for backwards incompatible changes
58+ $(DOCKER_RUN ) vendor/bin/roave-backward-compatibility-check || true
59+
60+ task-list-ci :
61+ @grep -E ' ^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c ' split("\n")| .[0:-1]'
62+
63+ help :
64+ @printf " \033[33mUsage:\033[0m\n make [target]\n\n\033[33mTargets:\033[0m\n"
65+ @printf " \033[32m%-32s\033[0m %s\n" " all" " Runs everything"
66+ @grep -E ' ^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf " \033[32m%-32s\033[0m %s\n", $$1, $$2}'
0 commit comments