Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@ SHELL=bash

.PHONY: *

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/.$$//')
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:],')
CONTAINER_REGISTRY_REPO="ghcr.io/wyrihaximusnet/php"
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/.$$//')
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:],')
COMPOSER_SHOW_EXTENSION_LIST=$(shell echo "${COMPOSER_SHOW_EXTENSION_LIST_PROD},${COMPOSER_SHOW_EXTENSION_LIST_DEV}")
SLIM_DOCKER_IMAGE=$(shell php -r 'echo count(array_intersect(["gd", "vips"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}"))) > 0 ? "" : "-slim";')
NTS_OR_ZTS_DOCKER_IMAGE=$(shell php -r 'echo count(array_intersect(["parallel"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}"))) > 0 ? "zts" : "nts";')
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]);")
CONTAINER_NAME=$(shell echo "ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-${NTS_OR_ZTS_DOCKER_IMAGE}-alpine${SLIM_DOCKER_IMAGE}-dev")
COMPOSER_CACHE_DIR=$(shell composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
COMPOSER_CONTAINER_CACHE_DIR=$(shell docker run --rm -it ${CONTAINER_NAME} composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
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]);")
CONTAINER_NAME=$(shell echo "${CONTAINER_REGISTRY_REPO}:${PHP_VERSION}-${NTS_OR_ZTS_DOCKER_IMAGE}-alpine${SLIM_DOCKER_IMAGE}-dev")
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)
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)

ifneq ("$(wildcard /.you-are-in-a-wyrihaximus.net-php-docker-image)","")
IN_DOCKER=TRUE
Expand All @@ -26,6 +27,7 @@ else
-v "`pwd`:`pwd`" \
-v "${COMPOSER_CACHE_DIR}:${COMPOSER_CONTAINER_CACHE_DIR}" \
-w "`pwd`" \
-e OTEL_PHP_FIBERS_ENABLED="true" \
"${CONTAINER_NAME}"
endif

Expand All @@ -36,30 +38,35 @@ else
endif

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

syntax-php: ## Lint PHP syntax ##*LH*##
on-install-or-update: ## Runs everything ####
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E "##\*(I|ILH)\*##" | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs -o $(MAKE)

syntax-php: ## Lint PHP syntax ##*ILH*##
$(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor .

rector-upgrade: ## Upgrade any automatically upgradable old code ###
composer-normalize: ### Normalize composer.json ##*I*##
$(DOCKER_RUN) composer normalize
$(DOCKER_RUN) composer update --lock --no-scripts

rector-upgrade: ## Upgrade any automatically upgradable old code ##*I*##
$(DOCKER_RUN) vendor/bin/rector -c ./etc/qa/rector.php

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

cs: ## Check the code for code style issues ##*LCH*##
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml
$(DOCKER_RUN) vendor/bin/phpcs --parallel=1 --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml

stan: ## Run static analysis (PHPStan) ##*LCH*##
$(DOCKER_RUN) vendor/bin/phpstan analyse etc src tests --level max --ansi -c ./etc/qa/phpstan.neon

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

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

mutation-testing: ## Run mutation testing ##*LCH*##
$(DOCKER_RUN) vendor/bin/infection --ansi --log-verbosity=all --ignore-msi-with-no-mutations --threads=$(THREADS) || (cat ./var/infection.log && false)
Expand All @@ -73,9 +80,6 @@ composer-require-checker: ## Ensure we require every package used in this packag
composer-unused: ## Ensure we don't require any package we don't use in this package directly ##*C*##
$(DOCKER_RUN) vendor/bin/composer-unused --ansi --configuration=./etc/qa/composer-unused.php

libyear: ### Calculate how many libyear this package is behind with dependencies
$(DOCKER_RUN) vendor/bin/libyear

backward-compatibility-check: ## Check code for backwards incompatible changes ##*C*##
$(MAKE) backward-compatibility-check-raw || true

Expand Down
119 changes: 60 additions & 59 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,64 +1,65 @@
{
"name": "wyrihaximus/compress-test-utilities",
"description": "Compress test utilities",
"license": "MIT",
"keywords": [
"compress"
],
"authors": [
{
"name": "Cees-Jan Kiewiet",
"email": "[email protected]",
"homepage": "http://wyrihaximus.net/"
}
],
"require": {
"php": "^8.3",
"phpunit/phpunit": "^12.1.5",
"wyrihaximus/compress-contracts": "^1",
"wyrihaximus/test-utilities": "^7.2.0"
},
"require-dev": {
"wyrihaximus/makefiles": "^0.4.2"
},
"autoload": {
"psr-4": {
"WyriHaximus\\Compress\\TestUtilities\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"WyriHaximus\\Compress\\TestUtilities\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"ergebnis/composer-normalize": true,
"icanhazstring/composer-unused": true,
"infection/extension-installer": true,
"phpstan/extension-installer": true,
"wyrihaximus/makefiles": true
},
"platform": {
"php": "8.3.13"
},
"sort-packages": true
"name": "wyrihaximus/compress-test-utilities",
"description": "Compress test utilities",
"license": "MIT",
"keywords": [
"compress"
],
"authors": [
{
"name": "Cees-Jan Kiewiet",
"email": "[email protected]",
"homepage": "http://wyrihaximus.net/"
}
],
"require": {
"php": "^8.4",
"phpunit/phpunit": "^12.1.5",
"wyrihaximus/compress-contracts": "^1",
"wyrihaximus/test-utilities": "^8.1.0"
},
"require-dev": {
"wyrihaximus/makefiles": "^0.6.0"
},
"autoload": {
"psr-4": {
"WyriHaximus\\Compress\\TestUtilities\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"WyriHaximus\\Compress\\TestUtilities\\Tests\\": "tests/"
}
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"ergebnis/composer-normalize": true,
"icanhazstring/composer-unused": true,
"infection/extension-installer": true,
"phpstan/extension-installer": true,
"wyrihaximus/makefiles": true,
"wyrihaximus/test-utilities": true
},
"extra": {
"phpstan": {
"includes": [
"extension.neon"
]
}
"platform": {
"php": "8.4.13"
},
"scripts": {
"post-install-cmd": [
"composer normalize"
],
"post-update-cmd": [
"composer normalize"
]
"sort-packages": true
},
"extra": {
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"scripts": {
"post-install-cmd": [
"make on-install-or-update || true"
],
"post-update-cmd": [
"make on-install-or-update || true"
]
}
}
Loading
Loading