-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (81 loc) · 3.58 KB
/
Copy pathMakefile
File metadata and controls
101 lines (81 loc) · 3.58 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
.PHONY: help up down build restart logs ensure-env \
migrate makemigrations seed flush shell check \
install e2e e2e-ui e2e-debug \
test
# ── colours ─────────────────────────────────────────────────────────────────
BOLD := \033[1m
RESET := \033[0m
GREEN := \033[32m
CYAN := \033[36m
# ── default target ───────────────────────────────────────────────────────────
help:
@echo ""
@echo "$(BOLD)OP TCG Tournament Manager$(RESET)"
@echo ""
@echo "$(CYAN)Docker$(RESET)"
@echo " make up Start containers (detached)"
@echo " make down Stop and remove containers"
@echo " make build Rebuild image and start containers"
@echo " make restart Restart the web container"
@echo " make logs Tail web container logs"
@echo ""
@echo "$(CYAN)Django$(RESET)"
@echo " make migrate Apply database migrations"
@echo " make migrations Create new migration files"
@echo " make seed Seed development data (keeps existing data)"
@echo " make flush Wipe database and re-seed from scratch"
@echo " make shell Open Django shell"
@echo " make check Run Django system checks"
@echo ""
@echo "$(CYAN)Testing$(RESET)"
@echo " make install Install Playwright + browser"
@echo " make e2e Run Playwright tests against current DB"
@echo " make e2e-ui Open Playwright UI mode"
@echo " make e2e-debug Run Playwright in headed + debug mode"
@echo " make test $(BOLD)Flush DB → seed → run all E2E tests$(RESET)"
@echo ""
# ── docker ───────────────────────────────────────────────────────────────────
ensure-env:
@if [ ! -f .env ]; then \
cp .env.example .env; \
echo "→ .env created from .env.example — edit before deploying to production."; \
fi
up: ensure-env
docker compose up -d
down:
docker compose down
build: ensure-env
docker compose up -d --build
restart:
docker compose restart web
logs:
docker compose logs -f web
# ── django management ────────────────────────────────────────────────────────
RUN := docker compose run --rm --entrypoint "" -v "$$PWD:/app" web python manage.py
migrate:
$(RUN) migrate
migrations:
$(RUN) makemigrations
seed:
$(RUN) seed
flush:
$(RUN) seed --flush
shell:
$(RUN) shell
check:
$(RUN) check
# ── playwright ───────────────────────────────────────────────────────────────
install:
cd e2e && npm install && npx playwright install chromium
e2e:
cd e2e && npx playwright test
e2e-ui:
cd e2e && npx playwright test --ui
e2e-debug:
cd e2e && npx playwright test --headed --debug
# ── full test run ─────────────────────────────────────────────────────────────
# Wipe the DB, seed fresh data, then run the entire Playwright suite.
# This guarantees a known database state for every CI / local test run.
test: flush restart e2e
@echo ""
@echo "$(GREEN)$(BOLD)✓ All E2E tests complete$(RESET)"