@@ -3,15 +3,16 @@ SHELL=bash
3
3
4
4
.PHONY : *
5
5
6
+ CONTAINER_REGISTRY_REPO ="ghcr.io/wyrihaximusnet/php"
6
7
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
8
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
9
COMPOSER_SHOW_EXTENSION_LIST =$(shell echo "${COMPOSER_SHOW_EXTENSION_LIST_PROD},${COMPOSER_SHOW_EXTENSION_LIST_DEV}")
9
10
SLIM_DOCKER_IMAGE =$(shell php -r 'echo count(array_intersect(["gd", "vips"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}") )) > 0 ? "" : "-slim";')
10
11
NTS_OR_ZTS_DOCKER_IMAGE =$(shell php -r 'echo count(array_intersect(["parallel"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}") )) > 0 ? "zts" : "nts";')
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]);")
12
- CONTAINER_NAME =$(shell echo "ghcr.io/wyrihaximusnet/php :${PHP_VERSION}-${NTS_OR_ZTS_DOCKER_IMAGE}-alpine${SLIM_DOCKER_IMAGE}-dev")
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")
13
14
COMPOSER_CACHE_DIR =$(shell composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
14
- COMPOSER_CONTAINER_CACHE_DIR =$(shell docker run --rm -it ${CONTAINER_NAME} 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)
15
16
16
17
ifneq ("$(wildcard /.you-are-in-a-wyrihaximus.net-php-docker-image) ","")
17
18
IN_DOCKER =TRUE
26
27
-v "`pwd`:`pwd`" \
27
28
-v "${COMPOSER_CACHE_DIR}:${COMPOSER_CONTAINER_CACHE_DIR}" \
28
29
-w "`pwd`" \
30
+ -e OTEL_PHP_FIBERS_ENABLED="true" \
29
31
"${CONTAINER_NAME}"
30
32
endif
31
33
36
38
endif
37
39
38
40
all : # # Runs everything ####
39
- @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 )
40
42
41
- syntax-php : # # Lint PHP syntax ##*LH*##
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 )
45
+
46
+ syntax-php : # # Lint PHP syntax ##*ILH*##
42
47
$(DOCKER_RUN ) vendor/bin/parallel-lint --exclude vendor .
43
48
44
- rector-upgrade : # # Upgrade any automatically upgradable old code ###
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*##
45
54
$(DOCKER_RUN ) vendor/bin/rector -c ./etc/qa/rector.php
46
55
47
- cs-fix : # # Fix any automatically fixable code style issues ###
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
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
49
58
50
59
cs : # # Check the code for code style issues ##*LCH*##
51
- $(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
52
61
53
62
stan : # # Run static analysis (PHPStan) ##*LCH*##
54
63
$(DOCKER_RUN ) vendor/bin/phpstan analyse etc src tests --level max --ansi -c ./etc/qa/phpstan.neon
55
64
56
65
unit-testing : # # Run tests ##*A*##
57
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
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
59
67
60
68
unit-testing-raw : # # Run tests ##*D*## ####
61
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
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
63
70
64
71
mutation-testing : # # Run mutation testing ##*LCH*##
65
72
$(DOCKER_RUN ) vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations --threads=$(THREADS ) || (cat ./var/infection.log && false)
@@ -73,9 +80,6 @@ composer-require-checker: ## Ensure we require every package used in this packag
73
80
composer-unused : # # Ensure we don't require any package we don't use in this package directly ##*C*##
74
81
$(DOCKER_RUN ) vendor/bin/composer-unused --ansi --configuration=./etc/qa/composer-unused.php
75
82
76
- libyear : # ## Calculate how many libyear this package is behind with dependencies
77
- $(DOCKER_RUN ) vendor/bin/libyear
78
-
79
83
backward-compatibility-check : # # Check code for backwards incompatible changes ##*C*##
80
84
$(MAKE ) backward-compatibility-check-raw || true
81
85
0 commit comments