From cab24ba467b93116ef690c453fdac791d64cc133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chris=20M=C3=BCller?= <2566282+brotkrueml@users.noreply.github.com> Date: Sun, 20 Oct 2024 20:33:49 +0200 Subject: [PATCH] chore: adjust Makefile --- .github/workflows/ci.yml | 14 +++++----- Makefile | 58 ++++++++++++++++++++++++++++------------ 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 763eb21..747529a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,10 +39,10 @@ jobs: composer update --no-progress --prefer-dist --optimize-autoloader - name: Run PHP linter run: | - find . -type f -name '*.php' ! -path "./vendor/*" -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" ) + make lint-php - name: Run tests run: | - make tests + make tests-php-unit code-quality: name: Code Quality runs-on: ubuntu-latest @@ -77,16 +77,16 @@ jobs: - name: Check coding standards if: always() run: | - vendor/bin/ecs check --no-progress-bar + make cs-php-check - name: Run mutation tests if: always() run: | - make infection - - name: Run phpstan + make tests-php-mutation + - name: Run static analysis if: always() run: | - make phpstan + make stan - name: Run rector if: always() run: | - make rector-dry + make rector-check diff --git a/Makefile b/Makefile index 7e63775..90c3089 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,50 @@ -.PHONY: qa -qa: cs tests infection phpstan rector-dry +.PHONY: $(filter-out vendor,$(MAKECMDGOALS)) -.PHONY: cs -cs: - vendor/bin/ecs --fix +help: + @printf "\033[33mUsage:\033[0m\n make [target] [arg=\"val\"...]\n\n\033[33mTargets:\033[0m\n" + @grep -E '^[-a-zA-Z0-9_\.\/]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-15s\033[0m %s\n", $$1, $$2}' -.PHONY: infection -infection: - vendor/bin/infection --min-msi=92 +qa: comp lint stan rector-check tests cs ## Run all relevant code checks -.PHONY: phpstan -phpstan: - vendor/bin/phpstan analyse +comp: comp-check comp-norm ## Validate and normalize composer.json + +comp-check: ## Validate composer.json + composer validate + +comp-norm: vendor ## Normalize composer.json + composer normalize + +cs: cs-php ## Check and fix coding standards + +cs-check: cs-php-check ## Only check coding standards + +cs-php: vendor ## Check and fix PHP coding standards + vendor/bin/ecs check --fix + +cs-php-check: vendor ## Only check PHP coding standards + vendor/bin/ecs check -.PHONY: rector -rector: +lint: lint-php + +lint-php: ## Lint PHP files + find . -type f -name '*.php' ! -path "./vendor/*" -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" ) + +rector: vendor ## Apply rector rules vendor/bin/rector -.PHONY: rector-dry -rector-dry: +rector-check: vendor ## Only check against rector rules vendor/bin/rector --dry-run -.PHONY: tests -tests: +stan: vendor ## Run static analysis + vendor/bin/phpstan analyse + +tests: tests-php-unit tests-php-mutation ## Run all tests + +tests-php-mutation: vendor ## Run PHP unit tests + vendor/bin/infection --min-msi=92 + +tests-php-unit: vendor ## Run PHP unit tests vendor/bin/phpunit --configuration=phpunit.xml.dist + +vendor: composer.json $(wildcard composer.lock) ## Install PHP dependencies + composer install