-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (100 loc) · 3.11 KB
/
Copy pathMakefile
File metadata and controls
117 lines (100 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
PHP_VERSION ?= 8.3
VERSION ?= $$(git rev-parse --verify HEAD)
USER = $$(id -u)
ARGS = $(filter-out $@,$(MAKECMDGOALS))
DOCKER_RUN = docker run --init -it --rm -u ${USER} -v "$$(pwd):/app" -w /app
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help tests fix check
.DEFAULT_GOAL := help
help: ## Display this help screen
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
composer: ## composer install
$(DOCKER_RUN) \
composer:latest \
composer install --optimize-autoloader --ignore-platform-reqs
composer-up: ## composer update
$(DOCKER_RUN) \
composer:latest \
composer update --no-cache --ignore-platform-reqs
composer-dump: ## composer dump-autoload
$(DOCKER_RUN) \
composer:latest \
composer dump-autoload
cr: ## composer require
$(DOCKER_RUN) \
composer:latest \
composer require $(ARGS) --ignore-platform-reqs
psalm: ## psalm
$(DOCKER_RUN) \
ghcr.io/kuaukutsu/php:${PHP_VERSION}-cli \
./vendor/bin/psalm --php-version=${PHP_VERSION} --no-cache --show-info=true --force-jit
phpstan: ## phpstan
$(DOCKER_RUN) \
ghcr.io/kuaukutsu/php:${PHP_VERSION}-cli \
./vendor/bin/phpstan analyse -c phpstan.neon
phpunit: ## phpunit
$(DOCKER_RUN) \
ghcr.io/kuaukutsu/php:${PHP_VERSION}-cli \
./vendor/bin/phpunit
phpcs: ## php code snifferphp: detect violations of a defined coding standard
$(DOCKER_RUN) \
ghcr.io/kuaukutsu/php:${PHP_VERSION}-cli \
./vendor/bin/phpcs
phpcbf: ## php code sniffer: automatically correct
$(DOCKER_RUN) \
ghcr.io/kuaukutsu/php:${PHP_VERSION}-cli \
./vendor/bin/phpcbf
rector: ## rector
$(DOCKER_RUN) \
ghcr.io/kuaukutsu/php:${PHP_VERSION}-cli \
./vendor/bin/rector
fix: ## run fix tools
make phpcbf
make rector
check: ## run analysis tools
make phpcs
make psalm
make phpstan
infection:
docker build \
--build-arg PHP_VERSION=$(PHP_VERSION) \
--build-arg USER=$(USER) \
--build-arg WORKDIR=/app \
--target tests \
-t app_cli .docker/php/cli
- docker run --init -it --rm \
--add-host=host.docker.internal:host-gateway \
-u $(USER) \
-v "$$(pwd):/app" \
-w /app \
app_cli ./vendor/bin/infection
docker image rm -f app_cli
tests:
docker build \
--build-arg PHP_VERSION=$(PHP_VERSION) \
--build-arg USER=$(USER) \
--build-arg WORKDIR=/app \
--target tests \
-t app_cli .docker/php/cli
- docker run --init -it --rm \
--add-host=host.docker.internal:host-gateway \
-u $(USER) \
-v "$$(pwd):/app" \
-w /app \
app_cli ./vendor/bin/phpunit \
--configuration phpunit.xml.dist \
--coverage-xml=/app/runtime/coverage/coverage-xml \
--coverage-clover=/app/runtime/coverage/clover.xml \
--log-junit=/app/runtime/coverage/phpunit.junit.xml
- docker run --init -it --rm \
--add-host=host.docker.internal:host-gateway \
-u $(USER) \
-v "$$(pwd):/app" \
-w /app \
app_cli ./vendor/bin/infection \
--coverage=/app/runtime/coverage \
--threads=max \
--skip-initial-tests
docker image rm -f app_cli
## AI
-include .claude/Makefile