-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
138 lines (104 loc) · 4.74 KB
/
Copy pathMakefile
File metadata and controls
138 lines (104 loc) · 4.74 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
.PHONY: help up down down-dev build shell ensure-up install assets assets-test test test-coverage test-ts cs-check cs-fix phpstan rector rector-dry qa composer-sync release-check release-check-demos demo-smoke validate-translations clean update validate setup-hooks check-no-cursor-coauthor strip-cursor-coauthor-from-history check-twig-extra
COMPOSE_FILE ?= docker-compose.yml
# Prefer Compose V2; absolute docker path avoids shadowing by local docker/ when PATH has "." (REQ-MAKE-010).
DOCKER_BIN := $(shell PATH="/usr/local/bin:/usr/bin:/bin:$$PATH" command -v docker 2>/dev/null)
ifeq ($(DOCKER_BIN),)
COMPOSE_BIN ?= docker-compose
else
COMPOSE_BIN ?= $(shell $(DOCKER_BIN) compose version >/dev/null 2>&1 && echo "$(DOCKER_BIN) compose" || echo "docker-compose")
endif
COMPOSE ?= $(COMPOSE_BIN) -f $(COMPOSE_FILE)
SERVICE_PHP ?= php
help:
@echo "Tag Input Bundle - Development Commands"
@echo ""
@echo "Usage: make <target>"
@echo ""
@echo "Container: up down down-dev build shell"
@echo "Dependencies: install assets"
@echo "Tests: test test-coverage test-ts demo-smoke"
@echo "Quality: cs-check cs-fix rector rector-dry phpstan qa validate-translations"
@echo "Release: release-check composer-sync"
@echo "Cleanup: clean"
@echo "Composer: update update-deps validate"
up:
$(COMPOSE) build
$(COMPOSE) up -d
@sleep 3
$(COMPOSE) exec -T $(SERVICE_PHP) composer install --no-interaction
$(COMPOSE) exec -T -e CI=true $(SERVICE_PHP) pnpm install
down:
$(COMPOSE) down
down-dev:
$(COMPOSE) down --remove-orphans
build:
$(COMPOSE) build --no-cache
shell: ensure-up
$(COMPOSE) exec $(SERVICE_PHP) sh
ensure-up:
@if ! $(COMPOSE) exec -T $(SERVICE_PHP) true 2>/dev/null; then \
$(COMPOSE) up -d; sleep 3; \
$(COMPOSE) exec -T $(SERVICE_PHP) composer install --no-interaction; \
$(COMPOSE) exec -T -e CI=true $(SERVICE_PHP) pnpm install; \
fi
install: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer install
$(COMPOSE) exec -T -e CI=true $(SERVICE_PHP) pnpm install
assets: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) pnpm run build
test: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer test
test-coverage: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer test-coverage | tee coverage-php.txt
./.scripts/php-coverage-percent.sh coverage-php.txt
test-ts: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) pnpm run test:coverage | tee coverage-ts.txt
./.scripts/ts-coverage-percent.sh coverage-ts.txt
assets-test: test-ts
cs-check: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer cs-check
cs-fix: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer cs-fix
phpstan: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer phpstan
rector: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer rector
rector-dry: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer rector-dry
qa: cs-check twig-lint test
composer-sync: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer validate --strict
$(COMPOSE) exec -T $(SERVICE_PHP) composer update --lock --no-install --no-interaction
release-check-demos:
@if [ -d demo ]; then $(MAKE) -C demo release-check; fi
demo-smoke:
@$(MAKE) -C demo demo-smoke
check-twig-extra:
@chmod +x .scripts/check-twig-extra.sh
@./.scripts/check-twig-extra.sh
release-check: check-no-cursor-coauthor check-twig-extra ensure-up composer-sync cs-fix cs-check rector-dry phpstan test-coverage release-check-demos test-ts
clean:
rm -rf vendor coverage coverage-ts .phpunit.cache coverage-php.txt coverage-ts.txt
update: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer update --no-interaction
validate: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer validate --strict
validate-translations: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) php -r 'require "vendor/autoload.php"; foreach (glob("src/Resources/translations/*.yaml") as $$f) { Symfony\Component\Yaml\Yaml::parseFile($$f); } echo "OK\n";'
setup-hooks:
@chmod +x .githooks/pre-commit 2>/dev/null || true
@chmod +x .githooks/commit-msg 2>/dev/null || true
@git config core.hooksPath .githooks
@echo "✅ Git hooks installed (.githooks — includes commit-msg for REQ-GIT-001)."
# REQ-MAKE-008: update-deps (REQ-MAKE-008)
BUNDLE_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
# Optional: monorepo helper absent on standalone GitHub Actions checkout (REQ-MAKE-009).
-include $(BUNDLE_ROOT)/../.scripts/Makefile.update-deps.mk
check-no-cursor-coauthor:
@chmod +x .scripts/check-no-cursor-coauthor.sh
@./.scripts/check-no-cursor-coauthor.sh HEAD
strip-cursor-coauthor-from-history:
@chmod +x .scripts/strip-cursor-coauthor-from-history.sh
@./.scripts/strip-cursor-coauthor-from-history.sh main
twig-lint: ensure-up
@$(COMPOSE) exec -T $(SERVICE_PHP) composer twig:lint || $(COMPOSE) exec -T $(SERVICE_PHP) ./vendor/bin/twig-cs-fixer lint --config=.twig-cs-fixer.php