Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (67 loc) · 2.59 KB
/
Copy pathMakefile
File metadata and controls
84 lines (67 loc) · 2.59 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
.PHONY: install install-dev dev server test test-ci test-cov test-frontend test-e2e lhci lint clean docker-build docker-run deploy fallbacks
# Install runtime dependencies
install:
uv sync --no-dev
cd frontend && pnpm install
# Install all dependencies (runtime + dev)
install-dev:
uv sync
cd frontend && pnpm install
# Run the SvelteKit frontend (proxies API to backend on 8001)
dev:
cd frontend && pnpm dev
# Run the FastAPI backend
server:
uv run uvicorn app.main:app --reload --port 8001
# Run the full test suite: backend pytest + frontend unit/component + e2e + Lighthouse.
# "test" means every tier — unit, integration, e2e, and perf/a11y audits — so a
# green `make test` is the ship-ready signal.
test:
uv run pytest tests/ -v --tb=short
cd frontend && pnpm test
cd frontend && pnpm test:e2e
cd frontend && pnpm lhci
# CI-safe: skip the timing-sensitive backend e2e marker and skip LHCI (which
# requires a full build + Chromium audit and is too slow for per-commit CI).
# Frontend unit + Playwright e2e still run — they're deterministic and fast.
test-ci:
uv run pytest tests/ -v --tb=short -m "not e2e"
cd frontend && pnpm test
cd frontend && pnpm test:e2e
# Run tests with coverage (CI-safe)
test-cov:
uv run pytest tests/ -v --tb=short -m "not e2e" --cov=app --cov-report=term-missing
# Frontend unit/component tests (Vitest + jsdom + @testing-library/svelte)
test-frontend:
cd frontend && pnpm test
# Frontend e2e tests (Playwright, Chromium, mocked backend)
test-e2e:
cd frontend && pnpm test:e2e
# Lighthouse CI (thresholds: a11y>=1.0, SEO>=1.0, best-practices>=0.98, perf>=0.90)
lhci:
cd frontend && pnpm lhci
# Lint with ruff (install separately: uv pip install ruff)
lint:
uv run ruff check app/ tests/
uv run ruff format --check app/ tests/
# Auto-format code
fmt:
uv run ruff format app/ tests/
# Generate fallback JSON files from live Snowflake
fallbacks:
uv run python -m scripts.generate_fallbacks
# Build Docker image (reads VITE_GOOGLE_MAPS_KEY from frontend/.env)
docker-build:
docker build --build-arg VITE_GOOGLE_MAPS_KEY=$$(grep VITE_GOOGLE_MAPS_KEY frontend/.env | cut -d= -f2) -t unearthed .
# Run Docker container locally
docker-run:
docker run --rm -p 8080:8080 --env-file .env unearthed
# Deploy to Cloud Run (builds, pushes, maps domain, configures secrets)
deploy:
./deploy.sh
# Remove build artifacts
clean:
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
rm -rf dist/ build/ .coverage htmlcov/