Skip to content

Commit fabf857

Browse files
committed
Raise minimum PHP version to 8.4
* Drop Safe * Update QA set up * GitHub config
1 parent a21a053 commit fabf857

35 files changed

+4713
-4254
lines changed

.github/workflows/release-managment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ permissions:
1616
pull-requests: write
1717
jobs:
1818
release-managment:
19-
name: Release Management
19+
name: Create Release
2020
uses: WyriHaximus/github-workflows/.github/workflows/package-release-managment.yaml@main
2121
with:
2222
milestone: ${{ github.event.milestone.title }}

Makefile

Lines changed: 59 additions & 38 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,7 +27,8 @@ else
2327
-v "`pwd`:`pwd`" \
2428
-v "${COMPOSER_CACHE_DIR}:${COMPOSER_CONTAINER_CACHE_DIR}" \
2529
-w "`pwd`" \
26-
${CONTAINER_NAME}
30+
-e OTEL_PHP_FIBERS_ENABLED="true" \
31+
"${CONTAINER_NAME}"
2732
endif
2833

2934
ifneq (,$(findstring icrosoft,$(shell cat /proc/version)))
@@ -33,67 +38,83 @@ 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

38-
syntax-php: ## Lint PHP syntax
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*##
3947
$(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor .
4048

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

44-
cs: ## Check the code for code style issues
45-
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml
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
4658

47-
stan: ## Run static analysis (PHPStan)
48-
$(DOCKER_RUN) vendor/bin/phpstan analyse src tests --level max --ansi -c ./etc/qa/phpstan.neon
59+
cs: ## Check the code for code style issues ##*LCH*##
60+
$(DOCKER_RUN) vendor/bin/phpcs --parallel=1 --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml
4961

50-
psalm: ## Run static analysis (Psalm)
51-
$(DOCKER_RUN) vendor/bin/psalm --threads=$(THREADS) --shepherd --stats --config=./etc/qa/psalm.xml
62+
stan: ## Run static analysis (PHPStan) ##*LCH*##
63+
$(DOCKER_RUN) vendor/bin/phpstan analyse etc src tests --level max --ansi -c ./etc/qa/phpstan.neon
5264

53-
unit-testing: ## Run tests
65+
unit-testing: ## Run tests ##*A*##
5466
$(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
5667

57-
unit-testing-raw: ## Run tests ####
68+
unit-testing-raw: ## Run tests ##*D*## ####
5869
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
6070

61-
mutation-testing: ## Run mutation testing
62-
$(DOCKER_RUN) vendor/bin/roave-infection-static-analysis-plugin --ansi --log-verbosity=all --threads=$(THREADS) --psalm-config etc/qa/psalm.xml || (cat ./var/infection.log && false)
71+
mutation-testing: ## Run mutation testing ##*LCH*##
72+
$(DOCKER_RUN) vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations --threads=$(THREADS) || (cat ./var/infection.log && false)
6373

6474
mutation-testing-raw: ## Run mutation testing ####
65-
php vendor/roave/infection-static-analysis-plugin/bin/roave-infection-static-analysis-plugin --ansi --log-verbosity=all --threads=$(THREADS) --psalm-config etc/qa/psalm.xml || (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)
6676

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

70-
composer-unused: ## Ensure we don't require any package we don't use in this package directly
71-
$(DOCKER_RUN) vendor/bin/composer-unused --ansi
80+
composer-unused: ## Ensure we don't require any package we don't use in this package directly ##*C*##
81+
$(DOCKER_RUN) vendor/bin/composer-unused --ansi --configuration=./etc/qa/composer-unused.php
7282

73-
composer-install: ## Install dependencies
74-
$(DOCKER_RUN) composer install --no-progress --ansi --no-interaction --prefer-dist -o
75-
76-
backward-compatibility-check: ## Check code for backwards incompatible changes
83+
backward-compatibility-check: ## Check code for backwards incompatible changes ##*C*##
7784
$(MAKE) backward-compatibility-check-raw || true
7885

7986
backward-compatibility-check-raw: ## Check code for backwards incompatible changes, doesn't ignore the failure ###
8087
$(DOCKER_RUN) vendor/bin/roave-backward-compatibility-check
8188

82-
shell: ## Provides Shell access in the expected environment ####
83-
$(DOCKER_RUN) bash
84-
85-
install: ## Install dependencies ####
89+
install: ### Install dependencies ####
8690
$(DOCKER_RUN) composer install
8791

88-
update: ## Update dependencies ####
92+
update: ### Update dependencies ####
8993
$(DOCKER_RUN) composer update -W
9094

91-
outdated: ## Show outdated dependencies ####
95+
outdated: ### Show outdated dependencies ####
9296
$(DOCKER_RUN) composer outdated
9397

94-
task-list-ci: ## CI: Generate a JSON array of jobs to run, matches the commands run when running `make (|all)` ####
95-
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "###" | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c 'split("\n")| .[0:-1]'
98+
shell: ## Provides Shell access in the expected environment ####
99+
$(DOCKER_RUN) bash
100+
96101

97102
help: ## Show this help ####
98103
@printf "\033[33mUsage:\033[0m\n make [target]\n\n\033[33mTargets:\033[0m\n"
99104
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-32s\033[0m %s\n", $$1, $$2}' | tr -d '#'
105+
106+
task-list-ci-all: ## CI: Generate a JSON array of jobs to run on all variations
107+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E "##\*A\*##" | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c 'split("\n")| .[0:-1]'
108+
109+
task-list-ci-dos: ## CI: Generate a JSON array of jobs to run Directly on the OS variations
110+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E "##\*D\*##" | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c 'split("\n")| .[0:-1]'
111+
112+
task-list-ci-low: ## CI: Generate a JSON array of jobs to run against the lowest dependencies on the primary threading target
113+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E "##\*(L|LC|LCH|LH)\*##" | grep -v "###" | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c 'split("\n")| .[0:-1]'
114+
115+
task-list-ci-locked: ## CI: Generate a JSON array of jobs to run against the locked dependencies on the primary threading target
116+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E "##\*(C|LC|LCH|CH)\*##" | grep -v "###" | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c 'split("\n")| .[0:-1]'
117+
118+
task-list-ci-high: ## CI: Generate a JSON array of jobs to run against the highest dependencies on the primary threading target
119+
@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]'
120+

composer.json

Lines changed: 60 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,65 @@
11
{
2-
"name": "wyrihaximus/json-psr7",
3-
"description": "JSON encode and decode PSR-7 requests and responses",
4-
"license": "MIT",
5-
"authors": [
6-
{
7-
"name": "Cees-Jan Kiewiet",
8-
"email": "[email protected]"
9-
}
10-
],
11-
"require": {
12-
"php": "^8 || ^7.4",
13-
"ancarda/psr7-string-stream": "^1.3",
14-
"cakephp/utility": "^3.7 || ^4.0",
15-
"laminas/laminas-diactoros": "^2.3",
16-
"psr/http-message": "^1.0 || ^2.0",
17-
"react/http": "^1.3",
18-
"ringcentral/psr7": "^1.2.2",
19-
"thecodingmachine/safe": "^2 || ^1.1",
20-
"wyrihaximus/json-utilities": "^1.2"
21-
},
22-
"require-dev": {
23-
"guzzlehttp/psr7": "^1.6 || ^2.0",
24-
"nyholm/psr7": "^1.2",
25-
"slim/psr7": "^0.5.0 || ^0.6 || ^1.0",
26-
"wyrihaximus/test-utilities": "^5 || ^3.7.6"
27-
},
28-
"autoload": {
29-
"psr-4": {
30-
"WyriHaximus\\": "src/"
31-
},
32-
"files": [
33-
"src/functions_include.php"
34-
]
2+
"name": "wyrihaximus/json-psr7",
3+
"description": "JSON encode and decode PSR-7 requests and responses",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Cees-Jan Kiewiet",
8+
"email": "[email protected]"
9+
}
10+
],
11+
"require": {
12+
"php": "^8.4",
13+
"ancarda/psr7-string-stream": "^1.3",
14+
"cakephp/utility": "^3.7 || ^4.0",
15+
"laminas/laminas-diactoros": "^3",
16+
"psr/http-message": "^1.0 || ^2.0",
17+
"react/http": "^1.3",
18+
"ringcentral/psr7": "^1.2.2",
19+
"wyrihaximus/json-utilities": "^1.2"
20+
},
21+
"require-dev": {
22+
"guzzlehttp/psr7": "^1.6 || ^2.0",
23+
"nyholm/psr7": "^1.2",
24+
"slim/psr7": "^0.5.0 || ^0.6 || ^1.0",
25+
"wyrihaximus/makefiles": "^0.6",
26+
"wyrihaximus/test-utilities": "^8.1.0"
27+
},
28+
"autoload": {
29+
"psr-4": {
30+
"WyriHaximus\\": "src/"
3531
},
36-
"autoload-dev": {
37-
"psr-4": {
38-
"WyriHaximus\\Tests\\": "tests/"
39-
}
32+
"files": [
33+
"src/functions_include.php"
34+
]
35+
},
36+
"autoload-dev": {
37+
"psr-4": {
38+
"WyriHaximus\\Tests\\": "tests/"
39+
}
40+
},
41+
"config": {
42+
"allow-plugins": {
43+
"composer/package-versions-deprecated": true,
44+
"dealerdirect/phpcodesniffer-composer-installer": true,
45+
"ergebnis/composer-normalize": true,
46+
"icanhazstring/composer-unused": true,
47+
"infection/extension-installer": true,
48+
"phpstan/extension-installer": true,
49+
"wyrihaximus/makefiles": true,
50+
"wyrihaximus/test-utilities": true
4051
},
41-
"config": {
42-
"allow-plugins": {
43-
"composer/package-versions-deprecated": true,
44-
"infection/extension-installer": true,
45-
"dealerdirect/phpcodesniffer-composer-installer": true,
46-
"icanhazstring/composer-unused": true,
47-
"ergebnis/composer-normalize": true
48-
},
49-
"platform": {
50-
"php": "7.4.7"
51-
},
52-
"sort-packages": true
52+
"platform": {
53+
"php": "8.4.13"
5354
},
54-
"scripts": {
55-
"post-install-cmd": [
56-
"composer normalize"
57-
],
58-
"post-update-cmd": [
59-
"composer normalize"
60-
]
61-
}
55+
"sort-packages": true
56+
},
57+
"scripts": {
58+
"post-install-cmd": [
59+
"make on-install-or-update || true"
60+
],
61+
"post-update-cmd": [
62+
"make on-install-or-update || true"
63+
]
64+
}
6265
}

0 commit comments

Comments
 (0)