Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (60 loc) · 3.38 KB
/
Copy pathMakefile
File metadata and controls
80 lines (60 loc) · 3.38 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
.DEFAULT_GOAL := help
PY := backend/.venv/bin
help: ## Show this help
@grep -E '^[a-z-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
up: ## Build and start localcode at http://localhost:4173
docker compose up -d --build
down: ## Stop localcode (your data volume is kept)
docker compose down
logs: ## Follow app and runner logs
docker compose logs -f
setup: ## Install local dev dependencies (Python venv + web node_modules)
python3.14 -m venv backend/.venv
$(PY)/pip install -e 'backend[dev]'
npm --prefix web ci
test: test-backend test-web test-runner ## Run every test suite
test-backend: ## Backend unit tests
$(PY)/pytest -q backend
test-runner: ## Runner tests (inside the pinned toolchain image)
docker build --target test -t localcode-runner-test runner
docker run --rm --init --sysctl kernel.shmmax=16777216 --sysctl kernel.shmall=4096 localcode-runner-test
test-web: ## Web typecheck, unit tests and production build
npm --prefix web run typecheck
npm --prefix web test
npm --prefix web run build
lint: ## Lint and format-check everything
$(PY)/ruff check backend runner
$(PY)/ruff format --check backend runner
npm --prefix web run lint
npm --prefix web run format:check
format: ## Auto-format everything
$(PY)/ruff check --fix backend runner
$(PY)/ruff format backend runner
npm --prefix web run format
dev-web: ## Vite dev server on :5173 (proxies /api to a running stack)
npm --prefix web run dev
api-types: ## Regenerate web/openapi.json and the web client's TypeScript types from the API
$(PY)/python -m localcode.tools.openapi web/openapi.json
npm --prefix web run api-types
screenshots: ## Regenerate the README images from the running stack
npm --prefix web run screenshots
smoke: ## End-to-end smoke test against the running stack
$(PY)/python -m localcode.tools.smoke
update: ## Re-download sources and rebuild problem data (your progress is kept)
@# As the app user: root in the container has no capability to write its data volume.
docker compose exec -u localcode app python -m localcode.importer
validate-content: ## Check content/ against the running stack (FULL=1 also runs local solutions on upstream tests)
docker compose exec -T -u localcode app python -m localcode.tools.validate_content $(if $(FULL),--full)
validate-cases: ## Maintainers: regenerate the excluded test-case list from the unfiltered sources (slow)
docker compose up -d --build --scale runner=3
docker compose exec -T -u localcode app python -m localcode.tools.validate_cases \
--from-sources /data/validate /data/validate/excluded_cases.json
docker compose cp app:/data/validate/excluded_cases.json backend/localcode/data/excluded_cases.json
@echo "Order-only differences (give these a compare mode):"
@docker compose exec -T -u localcode app cat /data/validate/excluded_cases.order.json
@echo "Exclusions to confirm by hand (no reference passed half the suite):"
@docker compose exec -T -u localcode app cat /data/validate/excluded_cases.review.json
docker compose up -d --scale runner=1
check-checkers: ## Maintainers: every answer checker must accept the dataset's expected answers
docker compose exec -T -u localcode app python -m localcode.tools.check_checkers
.PHONY: help up down logs setup test test-backend test-runner test-web lint format dev-web api-types screenshots smoke update validate-content validate-cases check-checkers