Skip to content

Commit eeaf1a2

Browse files
committed
PHP 8.4 + QA updates
1 parent 08f1e06 commit eeaf1a2

File tree

8 files changed

+1222
-1622
lines changed

8 files changed

+1222
-1622
lines changed

Makefile

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@ SHELL=bash
33

44
.PHONY: *
55

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}")
710
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)
1216

1317
ifneq ("$(wildcard /.you-are-in-a-wyrihaximus.net-php-docker-image)","")
1418
IN_DOCKER=TRUE
@@ -23,6 +27,7 @@ else
2327
-v "`pwd`:`pwd`" \
2428
-v "${COMPOSER_CACHE_DIR}:${COMPOSER_CONTAINER_CACHE_DIR}" \
2529
-w "`pwd`" \
30+
-e OTEL_PHP_FIBERS_ENABLED="true" \
2631
"${CONTAINER_NAME}"
2732
endif
2833

@@ -33,44 +38,48 @@ else
3338
endif
3439

3540
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)
3742

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)
3845

39-
syntax-php: ## Lint PHP syntax ##*LH*##
46+
syntax-php: ## Lint PHP syntax ##*ILH*##
4047
$(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor .
4148

42-
cs-fix: ## Fix any automatically fixable code style issues ###
43-
$(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
4458

4559
cs: ## Check the code for code style issues ##*LCH*##
46-
$(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
4761

4862
stan: ## Run static analysis (PHPStan) ##*LCH*##
49-
$(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
5064

5165
unit-testing: ## Run tests ##*A*##
5266
$(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-
$(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
5467

55-
unit-testing-raw: ## Run tests ##*D*##
68+
unit-testing-raw: ## Run tests ##*D*## ####
5669
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-
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
5870

5971
mutation-testing: ## Run mutation testing ##*LCH*##
60-
$(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)
6173

6274
mutation-testing-raw: ## Run mutation testing ####
63-
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)
6476

6577
composer-require-checker: ## Ensure we require every package used in this package directly ##*C*##
6678
$(DOCKER_RUN) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=./etc/qa/composer-require-checker.json
6779

6880
composer-unused: ## Ensure we don't require any package we don't use in this package directly ##*C*##
6981
$(DOCKER_RUN) vendor/bin/composer-unused --ansi --configuration=./etc/qa/composer-unused.php
7082

71-
libyear: ### Calculate how many libyear this package is behind with dependencies
72-
$(DOCKER_RUN) vendor/bin/libyear
73-
7483
backward-compatibility-check: ## Check code for backwards incompatible changes ##*C*##
7584
$(MAKE) backward-compatibility-check-raw || true
7685

@@ -89,6 +98,7 @@ outdated: ### Show outdated dependencies ####
8998
shell: ## Provides Shell access in the expected environment ####
9099
$(DOCKER_RUN) bash
91100

101+
92102
help: ## Show this help ####
93103
@printf "\033[33mUsage:\033[0m\n make [target]\n\n\033[33mTargets:\033[0m\n"
94104
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-32s\033[0m %s\n", $$1, $$2}' | tr -d '#'

composer.json

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,60 @@
11
{
2-
"name": "wyrihaximus/react-phpunit-run-tests-in-fiber",
3-
"description": "Trait to run all tests in a fiber",
4-
"license": "MIT",
5-
"authors": [
6-
{
7-
"name": "Cees-Jan Kiewiet",
8-
"email": "[email protected]"
9-
}
10-
],
11-
"require": {
12-
"php": "^8.3",
13-
"phpunit/phpunit": "^12.1.0",
14-
"react/async": "^4.2.0",
15-
"react/event-loop": "^1.5.0",
16-
"react/promise": "^3.1"
17-
},
18-
"require-dev": {
19-
"react/promise-timer": "^1.10.0",
20-
"wyrihaximus/makefiles": "^0.3.0",
21-
"wyrihaximus/test-utilities": "^7.0.0"
22-
},
23-
"conflict": {
24-
"phpunit/phpunit": "<10"
25-
},
26-
"autoload": {
27-
"psr-4": {
28-
"WyriHaximus\\React\\PHPUnit\\": "src/"
29-
}
30-
},
31-
"autoload-dev": {
32-
"psr-4": {
33-
"WyriHaximus\\Tests\\React\\PHPUnit\\": "tests/"
34-
}
2+
"name": "wyrihaximus/react-phpunit-run-tests-in-fiber",
3+
"description": "Trait to run all tests in a fiber",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Cees-Jan Kiewiet",
8+
"email": "[email protected]"
9+
}
10+
],
11+
"require": {
12+
"php": "^8.4",
13+
"phpunit/phpunit": "^12.1.3",
14+
"react/async": "^4.3.0",
15+
"react/event-loop": "^1.5.0",
16+
"react/promise": "^3.3"
17+
},
18+
"require-dev": {
19+
"react/promise-timer": "^1.11.0",
20+
"wyrihaximus/makefiles": "^0.6.0",
21+
"wyrihaximus/test-utilities": "^8.1.0"
22+
},
23+
"conflict": {
24+
"phpunit/phpunit": "<10"
25+
},
26+
"autoload": {
27+
"psr-4": {
28+
"WyriHaximus\\React\\PHPUnit\\": "src/"
29+
}
30+
},
31+
"autoload-dev": {
32+
"psr-4": {
33+
"WyriHaximus\\Tests\\React\\PHPUnit\\": "tests/"
34+
}
35+
},
36+
"config": {
37+
"allow-plugins": {
38+
"dealerdirect/phpcodesniffer-composer-installer": true,
39+
"ergebnis/composer-normalize": true,
40+
"icanhazstring/composer-unused": true,
41+
"infection/extension-installer": true,
42+
"php-http/discovery": true,
43+
"phpstan/extension-installer": true,
44+
"wyrihaximus/makefiles": true,
45+
"wyrihaximus/test-utilities": true
3546
},
36-
"config": {
37-
"allow-plugins": {
38-
"dealerdirect/phpcodesniffer-composer-installer": true,
39-
"ergebnis/composer-normalize": true,
40-
"icanhazstring/composer-unused": true,
41-
"infection/extension-installer": true,
42-
"php-http/discovery": true,
43-
"phpstan/extension-installer": true,
44-
"wyrihaximus/makefiles": true
45-
},
46-
"platform": {
47-
"php": "8.3.13"
48-
},
49-
"sort-packages": true
47+
"platform": {
48+
"php": "8.4.13"
5049
},
51-
"scripts": {
52-
"post-install-cmd": [
53-
"composer normalize"
54-
],
55-
"post-update-cmd": [
56-
"composer normalize"
57-
]
58-
}
50+
"sort-packages": true
51+
},
52+
"scripts": {
53+
"post-install-cmd": [
54+
"make on-install-or-update || true"
55+
],
56+
"post-update-cmd": [
57+
"make on-install-or-update || true"
58+
]
59+
}
5960
}

0 commit comments

Comments
 (0)