Skip to content

Commit fbed13b

Browse files
committed
Update to PHP 8.4+
1 parent fbb2a4e commit fbed13b

File tree

10 files changed

+1152
-1648
lines changed

10 files changed

+1152
-1648
lines changed

Makefile

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ SHELL=bash
33

44
.PHONY: *
55

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:],')
6+
DOCKER_AVAILABLE=$(shell ((command -v docker >/dev/null 2>&1) && echo 0 || echo 1))
7+
CONTAINER_REGISTRY_REPO="ghcr.io/wyrihaximusnet/php"
8+
COMPOSER_SHOW_EXTENSION_LIST_PROD=$(shell (((command -v composer >/dev/null 2>&1) && composer show -t --no-plugins) || docker run --rm -v "`pwd`:`pwd`" -w `pwd` ${CONTAINER_REGISTRY_REPO}:8.4-nts-alpine-slim-dev composer show -t --no-plugins) | grep -o "\-\-\(ext-\).\+" | sort | uniq | cut -d- -f4- | tr -d '\n' | grep . | sed '/^$$/d' | xargs | sed -e 's/ /, /g' | tr -cd '[:alnum:],' | sed 's/.$$//')
9+
COMPOSER_SHOW_EXTENSION_LIST_DEV=$(shell (((command -v composer >/dev/null 2>&1) && composer show -s --no-plugins) || docker run --rm -v "`pwd`:`pwd`" -w `pwd` ${CONTAINER_REGISTRY_REPO}:8.4-nts-alpine-slim-dev composer show -s --no-plugins) | grep -o "\(ext-\).\+" | sort | uniq | cut -d- -f2- | cut -d" " -f1 | xargs | sed -e 's/ /, /g' | tr -cd '[:alnum:],')
810
COMPOSER_SHOW_EXTENSION_LIST=$(shell echo "${COMPOSER_SHOW_EXTENSION_LIST_PROD},${COMPOSER_SHOW_EXTENSION_LIST_DEV}")
911
SLIM_DOCKER_IMAGE=$(shell php -r 'echo count(array_intersect(["gd", "vips"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}"))) > 0 ? "" : "-slim";')
1012
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")
13-
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)
13+
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]);")
14+
CONTAINER_NAME=$(shell echo "${CONTAINER_REGISTRY_REPO}:${PHP_VERSION}-${NTS_OR_ZTS_DOCKER_IMAGE}-alpine${SLIM_DOCKER_IMAGE}-dev")
15+
COMPOSER_CACHE_DIR=$(shell (command -v composer >/dev/null 2>&1) && composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
16+
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)
1517

1618
ifneq ("$(wildcard /.you-are-in-a-wyrihaximus.net-php-docker-image)","")
1719
IN_DOCKER=TRUE
@@ -22,12 +24,16 @@ endif
2224
ifeq ("$(IN_DOCKER)","TRUE")
2325
DOCKER_RUN:=
2426
else
25-
DOCKER_RUN:=docker run --rm -it \
26-
-v "`pwd`:`pwd`" \
27-
-v "${COMPOSER_CACHE_DIR}:${COMPOSER_CONTAINER_CACHE_DIR}" \
28-
-w "`pwd`" \
29-
-e OTEL_PHP_FIBERS_ENABLED="true" \
30-
"${CONTAINER_NAME}"
27+
ifeq ($(DOCKER_AVAILABLE),0)
28+
DOCKER_RUN:=docker run --rm -it \
29+
-v "`pwd`:`pwd`" \
30+
-v "${COMPOSER_CACHE_DIR}:${COMPOSER_CONTAINER_CACHE_DIR}" \
31+
-w "`pwd`" \
32+
-e OTEL_PHP_FIBERS_ENABLED="true" \
33+
"${CONTAINER_NAME}"
34+
else
35+
DOCKER_RUN:=
36+
endif
3137
endif
3238

3339
ifneq (,$(findstring icrosoft,$(shell cat /proc/version)))
@@ -37,15 +43,22 @@ else
3743
endif
3844

3945
all: ## Runs everything ####
40-
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "####" | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs --open-tty $(MAKE)
46+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "##*I*##" | grep -v "####" | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs -o $(MAKE)
4147

42-
syntax-php: ## Lint PHP syntax ##*LH*##
48+
on-install-or-update: ## Runs everything ####
49+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E "##\*(I|ILH)\*##" | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs -o $(MAKE)
50+
51+
syntax-php: ## Lint PHP syntax ##*ILH*##
4352
$(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor .
4453

45-
rector-upgrade: ## Upgrade any automatically upgradable old code ###
54+
composer-normalize: ### Normalize composer.json ##*I*##
55+
$(DOCKER_RUN) composer normalize
56+
$(DOCKER_RUN) composer update --lock --no-scripts
57+
58+
rector-upgrade: ## Upgrade any automatically upgradable old code ##*I*##
4659
$(DOCKER_RUN) vendor/bin/rector -c ./etc/qa/rector.php
4760

48-
cs-fix: ## Fix any automatically fixable code style issues ###
61+
cs-fix: ## Fix any automatically fixable code style issues ##*I*##
4962
$(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
5063

5164
cs: ## Check the code for code style issues ##*LCH*##
@@ -56,27 +69,22 @@ stan: ## Run static analysis (PHPStan) ##*LCH*##
5669

5770
unit-testing: ## Run tests ##*A*##
5871
$(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
59-
$(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
6072

6173
unit-testing-raw: ## Run tests ##*D*## ####
6274
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
63-
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
6475

6576
mutation-testing: ## Run mutation testing ##*LCH*##
66-
$(DOCKER_RUN) vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations --threads=$(THREADS) || (cat ./var/infection.log && false)
77+
$(DOCKER_RUN) vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations --configuration=./etc/qa/infection.json5 --threads=$(THREADS) || (cat ./var/infection.log && false)
6778

6879
mutation-testing-raw: ## Run mutation testing ####
69-
vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations --threads=$(THREADS) || (cat ./var/infection.log && false)
80+
vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations --configuration=./etc/qa/infection.json5 --threads=$(THREADS) || (cat ./var/infection.log && false)
7081

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

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

77-
libyear: ### Calculate how many libyear this package is behind with dependencies
78-
$(DOCKER_RUN) vendor/bin/libyear
79-
8088
backward-compatibility-check: ## Check code for backwards incompatible changes ##*C*##
8189
$(MAKE) backward-compatibility-check-raw || true
8290

@@ -115,3 +123,14 @@ task-list-ci-locked: ## CI: Generate a JSON array of jobs to run against the loc
115123
task-list-ci-high: ## CI: Generate a JSON array of jobs to run against the highest dependencies on the primary threading target
116124
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E "##\*(H|LH|LCH|LC)\*##" | grep -v "###" | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c 'split("\n")| .[0:-1]'
117125

126+
127+
## Temporary set of migrations to get all my repos in shape
128+
php-migrations-move-infection: #### Move infection.json.dist to etc/qa/infection.json5 ##*I*##
129+
($(DOCKER_RUN) mv infection.json.dist etc/qa/infection.json5 || true)
130+
131+
php-migrations-remove-phpunit-config-dir-from-infection: #### Drop XXX from etc/qa/infection.json5 ##*I*##
132+
($(DOCKER_RUN) php -r '$$infectionFile = "etc/qa/infection.json5"; if (!file_exists($$infectionFile)) {exit;} $$json = json_decode(file_get_contents($$infectionFile), true); if (!is_array($$json)) {exit;} if (!array_key_exists("phpUnit", $$json)) {exit;} unset($$json["phpUnit"]); file_put_contents($$infectionFile, json_encode($$json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\r\n");' || true)
133+
134+
php-migrations-fix-logs-relative-paths-for-infection: #### Fix logs paths in etc/qa/infection.json5 ##*I*##
135+
($(DOCKER_RUN) php -r '$$infectionFile = "etc/qa/infection.json5"; if (!file_exists($$infectionFile)) {exit;} $$json = json_decode(file_get_contents($$infectionFile), true); if (!is_array($$json)) {exit;} if (!array_key_exists("logs", $$json)) {exit;} foreach ($$json["logs"] as $$logsKey => $$logsPath) { if (is_string($$json["logs"][$$logsKey]) && str_starts_with($$json["logs"][$$logsKey], "./var/infection")) { $$json["logs"][$$logsKey] = str_replace("./var/infection", "../../var/infection", $$json["logs"][$$logsKey]); } } file_put_contents($$infectionFile, json_encode($$json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\r\n");' || true)
136+

composer.json

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"name": "mammatus/queue",
3-
"description": "⏱️ Queue manager",
3+
"description": "\u23f1\ufe0f Queue manager",
44
"license": "MIT",
55
"type": "composer-plugin",
66
"require": {
7-
"php": "^8.3",
8-
"ext-json": "^8.3",
7+
"php": "^8.4",
8+
"ext-json": "^8.4",
99
"composer-plugin-api": "^2.0",
1010
"eventsauce/object-hydrator": "^1.6.1",
1111
"mammatus/app": "dev-master",
1212
"mammatus/kubernetes-attributes": "^1",
1313
"mammatus/kubernetes-contracts": "^1",
1414
"mammatus/kubernetes-events": "^1",
1515
"mammatus/life-cycle-events": "^2",
16-
"mammatus/queue-attributes": "dev-main",
17-
"mammatus/queue-contracts": "dev-main",
16+
"mammatus/queue-attributes": "^0.1.0",
17+
"mammatus/queue-contracts": "^0.1.0",
1818
"open-telemetry/api": "^1.4.0",
1919
"psr/container": "^1.1.2 || ^2",
2020
"psr/event-dispatcher": "^1.0",
@@ -36,8 +36,8 @@
3636
"require-dev": {
3737
"bbqueue/bunny": "dev-main",
3838
"bunny/bunny": "^0.6@dev",
39-
"wyrihaximus/async-test-utilities": "^9.4.1",
40-
"wyrihaximus/makefiles": "^0.4.3"
39+
"wyrihaximus/async-test-utilities": "^10.1.0",
40+
"wyrihaximus/makefiles": "^0.7.5"
4141
},
4242
"autoload": {
4343
"psr-4": {
@@ -63,10 +63,11 @@
6363
"mindplay/composer-locator": true,
6464
"phpstan/extension-installer": true,
6565
"wyrihaximus/broadcast": true,
66-
"wyrihaximus/makefiles": true
66+
"wyrihaximus/makefiles": true,
67+
"wyrihaximus/test-utilities": true
6768
},
6869
"platform": {
69-
"php": "8.3.13"
70+
"php": "8.4.13"
7071
},
7172
"sort-packages": true
7273
},
@@ -91,14 +92,10 @@
9192
},
9293
"scripts": {
9394
"post-install-cmd": [
94-
"composer normalize",
95-
"composer update --lock --no-scripts",
96-
"make cs-fix"
95+
"make on-install-or-update || true"
9796
],
9897
"post-update-cmd": [
99-
"composer normalize",
100-
"composer update --lock --no-scripts",
101-
"make cs-fix"
98+
"make on-install-or-update || true"
10299
],
103100
"pre-autoload-dump": [
104101
"Mammatus\\Queue\\Composer\\Installer::findActions"

0 commit comments

Comments
 (0)