-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
132 lines (103 loc) · 4.42 KB
/
Copy pathMakefile
File metadata and controls
132 lines (103 loc) · 4.42 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
# Makefile for Composer Update Helper
# All dev targets use the root docker-compose.yml.
COMPOSE_FILE := docker-compose.yml
COMPOSE := docker-compose -f $(COMPOSE_FILE)
SERVICE_PHP := php
.PHONY: help up down build shell install ensure-up test test-coverage cs-check cs-fix rector rector-dry phpstan qa \
check-no-cursor-coauthor strip-cursor-coauthor-from-history \
release-check release-check-demos composer-sync clean update validate assets setup-hooks
help:
@echo "Composer Update Helper - Development Commands"
@echo ""
@echo "Usage: make <target>"
@echo ""
@echo "Targets:"
@echo " up Start Docker container"
@echo " down Stop Docker container"
@echo " build Rebuild Docker image (no cache)"
@echo " shell Open shell in container"
@echo " install Install Composer dependencies"
@echo " assets No-op (no frontend in this bundle)"
@echo " test Run PHPUnit tests"
@echo " test-coverage Run tests with code coverage"
@echo " cs-check Check code style"
@echo " cs-fix Fix code style"
@echo " rector Apply Rector refactoring"
@echo " rector-dry Run Rector in dry-run mode"
@echo " phpstan Run PHPStan static analysis"
@echo " qa Run QA (cs-check + test)"
@echo " release-check Pre-release pipeline (git hygiene, sync, style, analysis, coverage)"
@echo " check-no-cursor-coauthor Fail if Cursor co-author trailers in history (REQ-GIT-001)"
@echo " composer-sync Validate composer.json and align composer.lock"
@echo " clean Remove vendor and local artifacts"
@echo " update composer update in container"
@echo " validate composer validate --strict"
@echo " setup-hooks Install git hooks (pre-commit + commit-msg)"
@echo ""
build:
$(COMPOSE) build --no-cache
up:
$(COMPOSE) build
$(COMPOSE) up -d
@echo "Installing dependencies..."
$(COMPOSE) exec $(SERVICE_PHP) composer install --no-interaction
@echo "✅ Container ready!"
down:
$(COMPOSE) down
shell:
$(COMPOSE) exec $(SERVICE_PHP) sh
install: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer install
ensure-up:
@if ! $(COMPOSE) exec -T $(SERVICE_PHP) true 2>/dev/null; then \
echo "Starting container (root docker-compose)..."; \
$(COMPOSE) up -d; \
sleep 3; \
$(COMPOSE) exec -T $(SERVICE_PHP) composer install --no-interaction; \
fi
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
cs-check: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer cs-check
cs-fix: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer cs-fix
rector: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer rector
rector-dry: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer rector-dry
phpstan: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer phpstan
qa: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer qa
update: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer update --no-interaction
validate: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer validate --strict
composer-sync: ensure-up
$(COMPOSE) exec -T $(SERVICE_PHP) composer validate --strict
$(COMPOSE) exec -T $(SERVICE_PHP) composer update --no-install
release-check: check-no-cursor-coauthor ensure-up composer-sync cs-fix cs-check rector-dry phpstan test-coverage release-check-demos
release-check-demos:
@if [ -f demo/Makefile ]; then $(MAKE) -C demo release-check; else echo "No demo/Makefile — skip release-check-demos"; fi
clean:
rm -rf vendor .phpunit.cache coverage coverage.xml .php-cs-fixer.cache
rm -f coverage-php.txt
assets:
@echo "No frontend assets in this bundle."
check-no-cursor-coauthor:
@chmod +x .scripts/check-no-cursor-coauthor.sh
@./.scripts/check-no-cursor-coauthor.sh HEAD
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))))
include $(BUNDLE_ROOT)/../.scripts/Makefile.update-deps.mk
strip-cursor-coauthor-from-history:
@chmod +x .scripts/strip-cursor-coauthor-from-history.sh
@./.scripts/strip-cursor-coauthor-from-history.sh main