@@ -3,12 +3,16 @@ 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
+ CONTAINER_REGISTRY_REPO ="ghcr.io/wyrihaximusnet/php"
7
+ COMPOSER_SHOW_EXTENSION_LIST_PROD =$(shell ((command -v docker >/dev/null 2>&1) && docker run --rm -v "` pwd ` :` pwd ` " -w ` pwd ` ${CONTAINER_REGISTRY_REPO}:8.4-nts-alpine-slim-dev 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/.$$//')
8
+ COMPOSER_SHOW_EXTENSION_LIST_DEV =$(shell ((command -v docker >/dev/null 2>&1) && docker run --rm -v "` pwd ` :` pwd ` " -w ` pwd ` ${CONTAINER_REGISTRY_REPO}:8.4-nts-alpine-slim-dev composer show -s) | grep -o "\(ext-\).\+" | sort | uniq | cut -d- -f2- | cut -d" " -f1 | xargs | sed -e 's/ /, /g' | tr -cd '[:alnum:],')
9
+ COMPOSER_SHOW_EXTENSION_LIST =$(shell echo "${COMPOSER_SHOW_EXTENSION_LIST_PROD},${COMPOSER_SHOW_EXTENSION_LIST_DEV}")
7
10
SLIM_DOCKER_IMAGE =$(shell php -r 'echo count(array_intersect(["gd", "vips"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}") )) > 0 ? "" : "-slim";')
8
- 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")
10
- COMPOSER_CACHE_DIR =$(shell composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
11
- COMPOSER_CONTAINER_CACHE_DIR =$(shell docker run --rm -it ${CONTAINER_NAME} composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
11
+ NTS_OR_ZTS_DOCKER_IMAGE =$(shell php -r 'echo count(array_intersect(["parallel"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}") )) > 0 ? "zts" : "nts";')
12
+ PHP_VERSION: =$(shell (((command -v docker >/dev/null 2>&1) && docker run --rm -v "` pwd ` :` pwd ` " ${CONTAINER_REGISTRY_REPO}:8.4-nts-alpine-slim php -r "echo json_decode(file_get_contents('` pwd ` /composer.json'), true)['config']['platform']['php'];") || echo "8.3") | php -r "echo str_replace('|', '.', explode('.', implode('|', explode('.', stream_get_contents(STDIN), 2)), 2)[0]);")
13
+ CONTAINER_NAME =$(shell echo "${CONTAINER_REGISTRY_REPO}:${PHP_VERSION}-${NTS_OR_ZTS_DOCKER_IMAGE}-alpine${SLIM_DOCKER_IMAGE}-dev")
14
+ COMPOSER_CACHE_DIR =$(shell (command -v docker >/dev/null 2>&1) && docker run --rm -v "` pwd ` :` pwd ` " -w ` pwd ` ${CONTAINER_REGISTRY_REPO}:8.4-nts-alpine-slim-dev composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
15
+ COMPOSER_CONTAINER_CACHE_DIR =$(shell ((command -v docker >/dev/null 2>&1) && docker run --rm -it ${CONTAINER_NAME} composer config --global cache-dir -q) || echo ${HOME}/.composer-php/cache)
12
16
13
17
ifneq ("$(wildcard /.you-are-in-a-wyrihaximus.net-php-docker-image) ","")
14
18
IN_DOCKER =TRUE
23
27
-v "`pwd`:`pwd`" \
24
28
-v "${COMPOSER_CACHE_DIR}:${COMPOSER_CONTAINER_CACHE_DIR}" \
25
29
-w "`pwd`" \
30
+ -e OTEL_PHP_FIBERS_ENABLED="true" \
26
31
"${CONTAINER_NAME}"
27
32
endif
28
33
33
38
endif
34
39
35
40
all : # # Runs everything ####
36
- @grep -E ' ^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | grep -v " ####" | awk ' BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs --open-tty $(MAKE )
41
+ @grep -E ' ^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | grep -v " ####" | awk ' BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs -o $(MAKE )
37
42
38
- update-phpstan-extension : # # Update rules
39
- $( DOCKER_RUN ) php utils/update.php
43
+ on-install-or-update : # # Runs everything ####
44
+ @grep -E ' ^[a-zA-Z0-9_-]+:.*?## .*$$ ' $( MAKEFILE_LIST ) | grep -E " ##\*(I|ILH)\*## " | awk ' BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1} ' | xargs -o $( MAKE )
40
45
41
- syntax-php : # # Lint PHP syntax ##*LH *##
46
+ syntax-php : # # Lint PHP syntax ##*ILH *##
42
47
$(DOCKER_RUN ) vendor/bin/parallel-lint --exclude vendor .
43
48
44
- cs-fix : # # Fix any automatically fixable code style issues ###
45
- $(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
49
+ composer-normalize : # ## Normalize composer.json ##*I*##
50
+ $(DOCKER_RUN ) composer normalize
51
+ $(DOCKER_RUN ) composer update --lock --no-scripts
52
+
53
+ rector-upgrade : # # Upgrade any automatically upgradable old code ##*I*##
54
+ $(DOCKER_RUN ) vendor/bin/rector -c ./etc/qa/rector.php
55
+
56
+ cs-fix : # # Fix any automatically fixable code style issues ##*I*##
57
+ $(DOCKER_RUN ) vendor/bin/phpcbf --parallel=1 --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml || $(DOCKER_RUN ) vendor/bin/phpcbf --parallel=1 --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml || $(DOCKER_RUN ) vendor/bin/phpcbf --parallel=1 --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml -vvvv
46
58
47
59
cs : # # Check the code for code style issues ##*LCH*##
48
- $(DOCKER_RUN ) vendor/bin/phpcs --parallel=$( THREADS ) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml
60
+ $(DOCKER_RUN ) vendor/bin/phpcs --parallel=1 --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml
49
61
50
62
stan : # # Run static analysis (PHPStan) ##*LCH*##
51
- $(DOCKER_RUN ) vendor/bin/phpstan analyse src tests --level max --ansi -c ./etc/qa/phpstan.neon
63
+ $(DOCKER_RUN ) vendor/bin/phpstan analyse etc src tests --level max --ansi -c ./etc/qa/phpstan.neon
52
64
53
65
unit-testing : # # Run tests ##*A*##
54
66
$(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
55
- $(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
56
67
57
- unit-testing-raw : # # Run tests ##*D*##
68
+ unit-testing-raw : # # Run tests ##*D*## ####
58
69
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
59
- 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
60
70
61
71
mutation-testing : # # Run mutation testing ##*LCH*##
62
- $(DOCKER_RUN ) vendor/bin/infection --ansi --log-verbosity=all --threads=$(THREADS ) || (cat ./var/infection.log && false)
72
+ $(DOCKER_RUN ) vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations -- threads=$(THREADS ) || (cat ./var/infection.log && false)
63
73
64
74
mutation-testing-raw : # # Run mutation testing ####
65
- vendor/bin/infection --ansi --log-verbosity=all --threads=$(THREADS ) || (cat ./var/infection.log && false)
75
+ vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations -- threads=$(THREADS ) || (cat ./var/infection.log && false)
66
76
67
77
composer-require-checker : # # Ensure we require every package used in this package directly ##*C*##
68
78
$(DOCKER_RUN ) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=./etc/qa/composer-require-checker.json
69
79
70
80
composer-unused : # # Ensure we don't require any package we don't use in this package directly ##*C*##
71
81
$(DOCKER_RUN ) vendor/bin/composer-unused --ansi --configuration=./etc/qa/composer-unused.php
72
82
73
- libyear : # ## Calculate how many libyear this package is behind with dependencies
74
- $(DOCKER_RUN ) vendor/bin/libyear
75
-
76
83
backward-compatibility-check : # # Check code for backwards incompatible changes ##*C*##
77
84
$(MAKE ) backward-compatibility-check-raw || true
78
85
@@ -91,6 +98,9 @@ outdated: ### Show outdated dependencies ####
91
98
shell : # # Provides Shell access in the expected environment ####
92
99
$(DOCKER_RUN ) bash
93
100
101
+ update-phpstan-extension : # # Update rules
102
+ $(DOCKER_RUN ) php utils/update.php
103
+
94
104
help : # # Show this help ####
95
105
@printf " \033[33mUsage:\033[0m\n make [target]\n\n\033[33mTargets:\033[0m\n"
96
106
@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