@@ -3,10 +3,13 @@ SHELL=bash
3
3
4
4
.PHONY : *
5
5
6
- COMPOSER_SHOW_EXTENSION_LIST =$(shell composer show -t | grep -o "\-\-\(ext-\) .\+" | sort | uniq | cut -d- -f4- | tr -d '\n' | grep . | sed '/^$$/d' | xargs | sed -e 's/ /, /g' | tr -cd '[:alnum:],' | sed 's/.$$//')
6
+ COMPOSER_SHOW_EXTENSION_LIST_PROD =$(shell composer show -t | grep -o "\-\-\(ext-\) .\+" | sort | uniq | cut -d- -f4- | tr -d '\n' | grep . | sed '/^$$/d' | xargs | sed -e 's/ /, /g' | tr -cd '[:alnum:],' | sed 's/.$$//')
7
+ COMPOSER_SHOW_EXTENSION_LIST_DEV =$(shell composer show -s | grep -o "\(ext-\) .\+" | sort | uniq | cut -d- -f2- | cut -d" " -f1 | xargs | sed -e 's/ /, /g' | tr -cd '[:alnum:],')
8
+ COMPOSER_SHOW_EXTENSION_LIST =$(shell echo "${COMPOSER_SHOW_EXTENSION_LIST_PROD},${COMPOSER_SHOW_EXTENSION_LIST_DEV}")
7
9
SLIM_DOCKER_IMAGE =$(shell php -r 'echo count(array_intersect(["gd", "vips"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}") )) > 0 ? "" : "-slim";')
10
+ NTS_OR_ZTS_DOCKER_IMAGE =$(shell php -r 'echo count(array_intersect(["parallel"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}") )) > 0 ? "zts" : "nts";')
8
11
PHP_VERSION: =$(shell docker run --rm -v "`pwd`:`pwd`" jess/jq jq -r -c '.config.platform.php' "`pwd`/composer.json" | php -r "echo str_replace('|', '.', explode('.', implode('|', explode('.', stream_get_contents(STDIN) , 2)), 2)[0]);")
9
- CONTAINER_NAME =$(shell echo "ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-nts -alpine${SLIM_DOCKER_IMAGE}-dev")
12
+ CONTAINER_NAME =$(shell echo "ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-${NTS_OR_ZTS_DOCKER_IMAGE} -alpine${SLIM_DOCKER_IMAGE}-dev")
10
13
COMPOSER_CACHE_DIR =$(shell composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
11
14
COMPOSER_CONTAINER_CACHE_DIR =$(shell docker run --rm -it ${CONTAINER_NAME} composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
12
15
@@ -35,32 +38,34 @@ endif
35
38
all : # # Runs everything ####
36
39
@grep -E ' ^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | grep -v " ####" | awk ' BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs --open-tty $(MAKE )
37
40
38
-
39
41
syntax-php : # # Lint PHP syntax ##*LH*##
40
42
$(DOCKER_RUN ) vendor/bin/parallel-lint --exclude vendor .
41
43
44
+ rector-upgrade : # # Upgrade any automatically upgradable old code ###
45
+ $(DOCKER_RUN ) vendor/bin/rector -c ./etc/qa/rector.php
46
+
42
47
cs-fix : # # Fix any automatically fixable code style issues ###
43
48
$(DOCKER_RUN ) vendor/bin/phpcbf --parallel=$(THREADS ) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml || $(DOCKER_RUN ) vendor/bin/phpcbf --parallel=$(THREADS ) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml || $(DOCKER_RUN ) vendor/bin/phpcbf --parallel=$(THREADS ) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml -vvvv
44
49
45
50
cs : # # Check the code for code style issues ##*LCH*##
46
51
$(DOCKER_RUN ) vendor/bin/phpcs --parallel=$(THREADS ) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml
47
52
48
53
stan : # # Run static analysis (PHPStan) ##*LCH*##
49
- $(DOCKER_RUN ) vendor/bin/phpstan analyse src tests --level max --ansi -c ./etc/qa/phpstan.neon
54
+ $(DOCKER_RUN ) vendor/bin/phpstan analyse etc src tests --level max --ansi -c ./etc/qa/phpstan.neon
50
55
51
56
unit-testing : # # Run tests ##*A*##
52
57
$(DOCKER_RUN ) vendor/bin/phpunit --colors=always -c ./etc/qa/phpunit.xml --coverage-text --coverage-html ./var/tests-unit-coverage-html --coverage-clover ./var/tests-unit-clover-coverage.xml
53
58
$(DOCKER_RUN ) test -n " $( COVERALLS_REPO_TOKEN) " && test -n " $( COVERALLS_RUN_LOCALLY) " && test -f ./var/tests-unit-clover-coverage.xml && vendor/bin/php-coveralls -v --coverage_clover ./build/logs/clover.xml --json_path ./var/tests-unit-clover-coverage-upload.json || true
54
59
55
- unit-testing-raw : # # Run tests ##*D*##
60
+ unit-testing-raw : # # Run tests ##*D*## ####
56
61
php vendor/phpunit/phpunit/phpunit --colors=always -c ./etc/qa/phpunit.xml --coverage-text --coverage-html ./var/tests-unit-coverage-html --coverage-clover ./var/tests-unit-clover-coverage.xml
57
62
test -n " $( COVERALLS_REPO_TOKEN) " && test -n " $( COVERALLS_RUN_LOCALLY) " && test -f ./var/tests-unit-clover-coverage.xml && ./vendor/bin/php-coveralls -v --coverage_clover ./build/logs/clover.xml --json_path ./var/tests-unit-clover-coverage-upload.json || true
58
63
59
64
mutation-testing : # # Run mutation testing ##*LCH*##
60
- $(DOCKER_RUN ) vendor/bin/infection --ansi --log-verbosity=all --threads=$(THREADS ) || (cat ./var/infection.log && false)
65
+ $(DOCKER_RUN ) vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations -- threads=$(THREADS ) || (cat ./var/infection.log && false)
61
66
62
67
mutation-testing-raw : # # Run mutation testing ####
63
- vendor/bin/infection --ansi --log-verbosity=all --threads=$(THREADS ) || (cat ./var/infection.log && false)
68
+ vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations -- threads=$(THREADS ) || (cat ./var/infection.log && false)
64
69
65
70
composer-require-checker : # # Ensure we require every package used in this package directly ##*C*##
66
71
$(DOCKER_RUN ) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=./etc/qa/composer-require-checker.json
@@ -89,6 +94,7 @@ outdated: ### Show outdated dependencies ####
89
94
shell : # # Provides Shell access in the expected environment ####
90
95
$(DOCKER_RUN ) bash
91
96
97
+
92
98
help : # # Show this help ####
93
99
@printf " \033[33mUsage:\033[0m\n make [target]\n\n\033[33mTargets:\033[0m\n"
94
100
@grep -E ' ^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf " \033[32m%-32s\033[0m %s\n", $$1, $$2}' | tr -d ' #'
0 commit comments