-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
132 lines (100 loc) · 3.88 KB
/
Makefile
File metadata and controls
132 lines (100 loc) · 3.88 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
COMPOSE := docker compose -f .docker/compose.yml
.PHONY: up down destroy build test test-unit test-integration test-js test-e2e test-e2e-ui coverage coverage-unit coverage-integration coverage-js coverage-check mutate mutate-js analyse rector rector-dry qa qa-js flush dev-build _qa-analyse _qa-coverage _qa-lint _qa-typecheck _qa-test-js
## Generate .docker/.env with deterministic ports (auto-runs if missing)
.docker/.env:
.docker/env.sh
## Start services (build if needed)
up: .docker/.env
$(COMPOSE) up -d --build
@echo "\n Testbed running at https://localhost:$$(grep WEB_PORT .docker/.env | cut -d= -f2)\n"
## Stop services
down:
$(COMPOSE) down
## Stop services and remove volumes
destroy:
$(COMPOSE) down -v
## Build images without starting
build:
$(COMPOSE) build
## Ensure services are running and ready
ensure-up:
@$(COMPOSE) exec app true 2>/dev/null || $(COMPOSE) up -d --build --wait
## Run all tests (PHP unit + integration + JS)
test: ensure-up test-unit test-integration test-js
## Run unit tests (no database or framework)
test-unit: ensure-up
$(COMPOSE) exec app vendor/bin/phpunit --testsuite unit
## Run integration tests (full SilverStripe environment)
test-integration: ensure-up
$(COMPOSE) exec app vendor/bin/phpunit --testsuite integration
## Run JavaScript tests (Vitest)
test-js:
npm run test
## Run all tests with merged coverage (HTML + Clover XML)
coverage: ensure-up
$(COMPOSE) exec app vendor/bin/phpunit \
--coverage-html coverage/combined/html \
--coverage-clover coverage/combined/clover.xml
## Run unit tests with coverage (individual report)
coverage-unit: ensure-up
$(COMPOSE) exec app vendor/bin/phpunit --testsuite unit \
--coverage-html coverage/unit/html \
--coverage-clover coverage/unit/clover.xml
## Run integration tests with coverage (individual report)
coverage-integration: ensure-up
$(COMPOSE) exec app vendor/bin/phpunit --testsuite integration \
--coverage-html coverage/integration/html \
--coverage-clover coverage/integration/clover.xml
## Run JavaScript tests with coverage
coverage-js:
npm run coverage
## Check PHP coverage meets minimum threshold
coverage-check: coverage
$(COMPOSE) exec app vendor/bin/coverage-check coverage/combined/clover.xml 90
## Run PHP mutation testing (Infection)
mutate: ensure-up
$(COMPOSE) exec app php -d memory_limit=256M vendor/bin/infection --threads=4
## Run JavaScript mutation testing (Stryker)
mutate-js:
npm run mutate
## Run PHPStan static analysis
analyse: ensure-up
$(COMPOSE) exec app vendor/bin/phpstan analyse -c phpstan.neon.dist --memory-limit=512M
## Run Rector refactoring (applies changes)
rector: ensure-up
$(COMPOSE) exec app vendor/bin/rector process
## Run Rector in dry-run mode (preview only)
rector-dry: ensure-up
$(COMPOSE) exec app vendor/bin/rector process --dry-run
## Run full QA suite (all checks in parallel)
qa: ensure-up
$(MAKE) -j5 _qa-analyse _qa-coverage _qa-lint _qa-typecheck _qa-test-js
## QA sub-targets (not intended to be called directly)
_qa-analyse:
$(COMPOSE) exec app vendor/bin/phpstan analyse -c phpstan.neon.dist --memory-limit=512M
_qa-coverage:
$(COMPOSE) exec app vendor/bin/phpunit \
--coverage-html coverage/combined/html \
--coverage-clover coverage/combined/clover.xml
$(COMPOSE) exec app vendor/bin/coverage-check coverage/combined/clover.xml 90
_qa-lint:
npm run lint
_qa-typecheck:
npm run typecheck
_qa-test-js:
npm run test
## Run E2E tests (Playwright, requires running Docker services)
test-e2e: ensure-up
npx playwright test
## Run E2E tests with interactive UI
test-e2e-ui: ensure-up
npx playwright test --ui
## Clear SilverStripe cache
flush: ensure-up
$(COMPOSE) exec app vendor/bin/sake flush
## Run dev/build to rebuild the database and manifest
dev-build: ensure-up
$(COMPOSE) exec app vendor/bin/sake dev/build flush=1
## Run JavaScript QA (lint + typecheck + test, in parallel)
qa-js:
$(MAKE) -j3 _qa-lint _qa-typecheck _qa-test-js