Skip to content

Commit cab24ba

Browse files
committed
chore: adjust Makefile
1 parent f2811fe commit cab24ba

File tree

2 files changed

+48
-24
lines changed

2 files changed

+48
-24
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ jobs:
3939
composer update --no-progress --prefer-dist --optimize-autoloader
4040
- name: Run PHP linter
4141
run: |
42-
find . -type f -name '*.php' ! -path "./vendor/*" -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" )
42+
make lint-php
4343
- name: Run tests
4444
run: |
45-
make tests
45+
make tests-php-unit
4646
code-quality:
4747
name: Code Quality
4848
runs-on: ubuntu-latest
@@ -77,16 +77,16 @@ jobs:
7777
- name: Check coding standards
7878
if: always()
7979
run: |
80-
vendor/bin/ecs check --no-progress-bar
80+
make cs-php-check
8181
- name: Run mutation tests
8282
if: always()
8383
run: |
84-
make infection
85-
- name: Run phpstan
84+
make tests-php-mutation
85+
- name: Run static analysis
8686
if: always()
8787
run: |
88-
make phpstan
88+
make stan
8989
- name: Run rector
9090
if: always()
9191
run: |
92-
make rector-dry
92+
make rector-check

Makefile

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,50 @@
1-
.PHONY: qa
2-
qa: cs tests infection phpstan rector-dry
1+
.PHONY: $(filter-out vendor,$(MAKECMDGOALS))
32

4-
.PHONY: cs
5-
cs:
6-
vendor/bin/ecs --fix
3+
help:
4+
@printf "\033[33mUsage:\033[0m\n make [target] [arg=\"val\"...]\n\n\033[33mTargets:\033[0m\n"
5+
@grep -E '^[-a-zA-Z0-9_\.\/]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-15s\033[0m %s\n", $$1, $$2}'
76

8-
.PHONY: infection
9-
infection:
10-
vendor/bin/infection --min-msi=92
7+
qa: comp lint stan rector-check tests cs ## Run all relevant code checks
118

12-
.PHONY: phpstan
13-
phpstan:
14-
vendor/bin/phpstan analyse
9+
comp: comp-check comp-norm ## Validate and normalize composer.json
10+
11+
comp-check: ## Validate composer.json
12+
composer validate
13+
14+
comp-norm: vendor ## Normalize composer.json
15+
composer normalize
16+
17+
cs: cs-php ## Check and fix coding standards
18+
19+
cs-check: cs-php-check ## Only check coding standards
20+
21+
cs-php: vendor ## Check and fix PHP coding standards
22+
vendor/bin/ecs check --fix
23+
24+
cs-php-check: vendor ## Only check PHP coding standards
25+
vendor/bin/ecs check
1526

16-
.PHONY: rector
17-
rector:
27+
lint: lint-php
28+
29+
lint-php: ## Lint PHP files
30+
find . -type f -name '*.php' ! -path "./vendor/*" -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" )
31+
32+
rector: vendor ## Apply rector rules
1833
vendor/bin/rector
1934

20-
.PHONY: rector-dry
21-
rector-dry:
35+
rector-check: vendor ## Only check against rector rules
2236
vendor/bin/rector --dry-run
2337

24-
.PHONY: tests
25-
tests:
38+
stan: vendor ## Run static analysis
39+
vendor/bin/phpstan analyse
40+
41+
tests: tests-php-unit tests-php-mutation ## Run all tests
42+
43+
tests-php-mutation: vendor ## Run PHP unit tests
44+
vendor/bin/infection --min-msi=92
45+
46+
tests-php-unit: vendor ## Run PHP unit tests
2647
vendor/bin/phpunit --configuration=phpunit.xml.dist
48+
49+
vendor: composer.json $(wildcard composer.lock) ## Install PHP dependencies
50+
composer install

0 commit comments

Comments
 (0)