Skip to content

Commit 635dbb6

Browse files
committed
Update QA tooling
1 parent 869be40 commit 635dbb6

File tree

7 files changed

+1543
-3560
lines changed

7 files changed

+1543
-3560
lines changed

.github/workflows/release-managment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ permissions:
2020
jobs:
2121
release-managment:
2222
name: Release Management
23-
uses: WyriHaximus/github-workflows/.github/workflows/package-release-managment.yaml@main
23+
uses: WyriHaximus/github-workflows/.github/workflows/package-release-management.yaml@main
2424
with:
2525
milestone: ${{ github.event.milestone.title }}
2626
description: ${{ github.event.milestone.title }}

Makefile

Lines changed: 51 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ SHELL=bash
55

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

1213
ifneq ("$(wildcard /.you-are-in-a-wyrihaximus.net-php-docker-image)","")
1314
IN_DOCKER=TRUE
@@ -22,7 +23,7 @@ else
2223
-v "`pwd`:`pwd`" \
2324
-v "${COMPOSER_CACHE_DIR}:${COMPOSER_CONTAINER_CACHE_DIR}" \
2425
-w "`pwd`" \
25-
"ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-nts-alpine${SLIM_DOCKER_IMAGE}-dev"
26+
"${CONTAINER_NAME}"
2627
endif
2728

2829
ifneq (,$(findstring icrosoft,$(shell cat /proc/version)))
@@ -31,56 +32,79 @@ else
3132
THREADS=$(shell nproc)
3233
endif
3334

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

37-
syntax-php: ## Lint PHP syntax
39+
syntax-php: ## Lint PHP syntax ##*LH*##
3840
$(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor .
3941

40-
cs-fix: ## Fix any automatically fixable code style issues
42+
cs-fix: ## Fix any automatically fixable code style issues ###
4143
$(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
4244

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

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

49-
unit-testing: ## Run tests
51+
unit-testing: ## Run tests ##*A*##
5052
$(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
5153
$(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
5254

53-
unit-testing-raw: ## Run tests ###
55+
unit-testing-raw: ## Run tests ##*D*## ####
5456
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
5557
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
5658

57-
mutation-testing: ## Run mutation testing
58-
$(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)
59+
mutation-testing: ## Run mutation testing ##*LCH*##
60+
$(DOCKER_RUN) vendor/bin/infection --ansi --log-verbosity=all --threads=$(THREADS) || (cat ./var/infection.log && false)
5961

60-
mutation-testing-raw: ## Run mutation testing ###
61-
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)
62+
mutation-testing-raw: ## Run mutation testing ####
63+
vendor/bin/infection --ansi --log-verbosity=all --threads=$(THREADS) || (cat ./var/infection.log && false)
6264

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

66-
composer-unused: ## Ensure we don't require any package we don't use in this package directly
67-
$(DOCKER_RUN) vendor/bin/composer-unused --ansi
68+
composer-unused: ## Ensure we don't require any package we don't use in this package directly ##*C*##
69+
$(DOCKER_RUN) vendor/bin/composer-unused --ansi --configuration=./etc/qa/composer-unused.php
6870

69-
composer-install: ## Install dependencies
70-
$(DOCKER_RUN) composer install --no-progress --ansi --no-interaction --prefer-dist -o
71+
libyear: ### Calculate how many libyear this package is behind with dependencies
72+
$(DOCKER_RUN) vendor/bin/libyear
7173

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

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

78-
shell: ## Provides Shell access in the expected environment ###
79-
$(DOCKER_RUN) ash
80+
install: ### Install dependencies ####
81+
$(DOCKER_RUN) composer install
8082

81-
task-list-ci: ## CI: Generate a JSON array of jobs to run, matches the commands run when running `make (|all)` ###
82-
@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]'
83+
update: ### Update dependencies ####
84+
$(DOCKER_RUN) composer update -W
8385

84-
help: ## Show this help ###
86+
outdated: ### Show outdated dependencies ####
87+
$(DOCKER_RUN) composer outdated
88+
89+
shell: ## Provides Shell access in the expected environment ####
90+
$(DOCKER_RUN) bash
91+
92+
help: ## Show this help ####
8593
@printf "\033[33mUsage:\033[0m\n make [target]\n\n\033[33mTargets:\033[0m\n"
8694
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-32s\033[0m %s\n", $$1, $$2}' | tr -d '#'
95+
96+
task-list-ci-all: ## CI: Generate a JSON array of jobs to run on all variations
97+
@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]'
98+
99+
task-list-ci-dos: ## CI: Generate a JSON array of jobs to run Directly on the OS variations
100+
@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]'
101+
102+
task-list-ci-low: ## CI: Generate a JSON array of jobs to run against the lowest dependencies on the primary threading target
103+
@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]'
104+
105+
task-list-ci-locked: ## CI: Generate a JSON array of jobs to run against the locked dependencies on the primary threading target
106+
@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]'
107+
108+
task-list-ci-high: ## CI: Generate a JSON array of jobs to run against the highest dependencies on the primary threading target
109+
@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]'
110+

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"react/promise": "^3.2"
1717
},
1818
"require-dev": {
19-
"wyrihaximus/async-test-utilities": "^8.0.5"
19+
"wyrihaximus/async-test-utilities": "^9.0.0",
20+
"wyrihaximus/makefiles": "^0.3.1"
2021
},
2122
"autoload": {
2223
"psr-4": {
@@ -33,7 +34,9 @@
3334
"dealerdirect/phpcodesniffer-composer-installer": true,
3435
"ergebnis/composer-normalize": true,
3536
"icanhazstring/composer-unused": true,
36-
"infection/extension-installer": true
37+
"infection/extension-installer": true,
38+
"phpstan/extension-installer": true,
39+
"wyrihaximus/makefiles": true
3740
},
3841
"platform": {
3942
"php": "8.3.13"

0 commit comments

Comments
 (0)