-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
110 lines (86 loc) · 3.06 KB
/
Copy pathMakefile
File metadata and controls
110 lines (86 loc) · 3.06 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
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 example
.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: phpcbf rector ## run fix tools
check: phpcs psalm phpstan ## run analysis tools
## Smoke test
docker-runtime: ## Build runtime image and run the sqlite example through it
docker build -t migrator-runtime:dev .docker/migrator
docker run --rm -u $(USER) -e MIGRATOR_CONFIG=/app/example/docker/migrator.php \
-v "$$(pwd):/app" migrator-runtime:dev migrate:init
docker run --rm -u $(USER) -e MIGRATOR_CONFIG=/app/example/docker/migrator.php \
-v "$$(pwd):/app" migrator-runtime:dev migrate:up
docker run --rm -u $(USER) -e MIGRATOR_CONFIG=/app/example/docker/migrator.php \
-v "$$(pwd):/app" migrator-runtime:dev migrate:down
git clean -fd example/data
## Application
cli:
$(DOCKER_RUN) -w /app/example \
ghcr.io/kuaukutsu/php:${PHP_VERSION}-cli \
sh -l
remove: down _image_remove _container_remove _volume_remove
_image_remove:
docker image rm -f \
migrator-app \
migrator-postgres \
migrator-mysql
_container_remove:
docker rm -f \
migrator_postgres \
migrator_mysql
_volume_remove:
docker volume rm -f \
migrator_pg_data \
migrator_mysql_data
## AI
-include .claude/Makefile
# Спец-правило, чтобы Makefile не ругался на неизвестные команды (аргументы)
%:
@: