2025-12-21 21:56:46 +01:00
|
|
|
.PHONY: install-backend install-frontend install setup-hooks backend frontend db db-stop db-ready db-seed dev test test-backend test-frontend test-e2e typecheck generate-types generate-types-standalone check-types-fresh check-constants lint-backend format-backend fix-backend security-backend
|
2025-12-18 22:42:32 +01:00
|
|
|
|
|
|
|
|
-include .env
|
|
|
|
|
export
|
2025-12-18 21:37:28 +01:00
|
|
|
|
|
|
|
|
install-backend:
|
2025-12-18 21:48:41 +01:00
|
|
|
cd backend && uv sync --all-groups
|
2025-12-18 21:37:28 +01:00
|
|
|
|
|
|
|
|
install-frontend:
|
|
|
|
|
cd frontend && npm install
|
|
|
|
|
|
2025-12-20 23:09:46 +01:00
|
|
|
install: install-backend install-frontend setup-hooks
|
|
|
|
|
|
|
|
|
|
setup-hooks:
|
|
|
|
|
git config core.hooksPath .githooks
|
2025-12-18 21:37:28 +01:00
|
|
|
|
|
|
|
|
backend:
|
|
|
|
|
cd backend && uv run uvicorn main:app --reload
|
|
|
|
|
|
|
|
|
|
frontend:
|
|
|
|
|
cd frontend && npm run dev
|
|
|
|
|
|
2025-12-18 21:48:41 +01:00
|
|
|
db:
|
|
|
|
|
docker compose up -d db
|
|
|
|
|
|
|
|
|
|
db-stop:
|
|
|
|
|
docker compose down
|
|
|
|
|
|
2025-12-20 11:43:32 +01:00
|
|
|
db-clean:
|
|
|
|
|
docker compose down -v
|
|
|
|
|
|
2025-12-18 22:08:31 +01:00
|
|
|
db-ready:
|
|
|
|
|
@docker compose up -d db
|
|
|
|
|
@echo "Waiting for PostgreSQL to be ready..."
|
|
|
|
|
@until docker compose exec -T db pg_isready -U postgres > /dev/null 2>&1; do \
|
|
|
|
|
sleep 1; \
|
|
|
|
|
done
|
|
|
|
|
@docker compose exec -T db psql -U postgres -tc "SELECT 1 FROM pg_database WHERE datname = 'arbret_test'" | grep -q 1 || \
|
|
|
|
|
docker compose exec -T db psql -U postgres -c "CREATE DATABASE arbret_test"
|
|
|
|
|
@echo "PostgreSQL is ready"
|
|
|
|
|
|
2025-12-18 22:42:32 +01:00
|
|
|
db-seed: db-ready
|
|
|
|
|
cd backend && uv run python seed.py
|
|
|
|
|
|
2025-12-18 21:48:41 +01:00
|
|
|
dev:
|
2025-12-18 22:42:32 +01:00
|
|
|
$(MAKE) db-seed
|
2025-12-18 21:48:41 +01:00
|
|
|
cd backend && uv run uvicorn main:app --reload & \
|
|
|
|
|
cd frontend && npm run dev & \
|
|
|
|
|
wait
|
|
|
|
|
|
2025-12-21 18:20:22 +01:00
|
|
|
# TEST variable can be used to select specific tests:
|
|
|
|
|
# Backend: TEST="-m auth" (marker) or TEST="tests/test_booking.py" (file) or TEST="tests/test_booking.py::TestBooking::test_specific" (specific test)
|
|
|
|
|
# Frontend: TEST="app/login" (file pattern matching app/**/*.test.{ts,tsx})
|
|
|
|
|
# E2E: TEST="auth" (file pattern matching e2e/*.spec.ts)
|
|
|
|
|
TEST ?=
|
|
|
|
|
|
2025-12-20 11:43:32 +01:00
|
|
|
test-backend: db-clean db-ready
|
2025-12-21 18:20:22 +01:00
|
|
|
cd backend && uv run pytest -v $(TEST)
|
2025-12-18 21:48:41 +01:00
|
|
|
|
|
|
|
|
test-frontend:
|
2025-12-21 18:20:22 +01:00
|
|
|
cd frontend && npm run test $(if $(TEST),-- $(TEST),)
|
2025-12-18 21:48:41 +01:00
|
|
|
|
2025-12-20 11:43:32 +01:00
|
|
|
test-e2e: db-clean db-ready
|
2025-12-21 18:20:22 +01:00
|
|
|
./scripts/e2e.sh $(TEST)
|
2025-12-18 21:48:41 +01:00
|
|
|
|
2025-12-20 23:06:05 +01:00
|
|
|
test: check-constants check-types-fresh test-backend test-frontend test-e2e
|
2025-12-19 00:12:43 +01:00
|
|
|
|
2025-12-20 23:06:05 +01:00
|
|
|
typecheck: generate-types-standalone
|
2025-12-19 00:12:43 +01:00
|
|
|
cd backend && uv run mypy .
|
2025-12-20 23:06:05 +01:00
|
|
|
cd frontend && npx tsc --noEmit
|
|
|
|
|
|
|
|
|
|
generate-types:
|
|
|
|
|
cd frontend && npm run generate-api-types
|
|
|
|
|
|
|
|
|
|
generate-types-standalone: db-seed
|
|
|
|
|
@echo "Starting backend for type generation..."
|
|
|
|
|
@cd backend && uv run uvicorn main:app --port 8000 --log-level warning & \
|
|
|
|
|
BACKEND_PID=$$!; \
|
|
|
|
|
sleep 3; \
|
|
|
|
|
cd frontend && npm run generate-api-types; \
|
|
|
|
|
EXIT_CODE=$$?; \
|
|
|
|
|
kill $$BACKEND_PID 2>/dev/null || true; \
|
|
|
|
|
exit $$EXIT_CODE
|
|
|
|
|
|
|
|
|
|
check-types-fresh: generate-types-standalone
|
|
|
|
|
@if git diff --quiet frontend/app/generated/api.ts 2>/dev/null; then \
|
|
|
|
|
echo "✓ Generated types are up to date"; \
|
|
|
|
|
else \
|
|
|
|
|
echo "✗ Generated types are stale. Run 'make generate-types-standalone' and commit."; \
|
|
|
|
|
git diff frontend/app/generated/api.ts; \
|
|
|
|
|
exit 1; \
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
check-constants:
|
|
|
|
|
@cd backend && uv run python validate_constants.py
|
2025-12-21 21:54:26 +01:00
|
|
|
|
|
|
|
|
lint-backend:
|
|
|
|
|
cd backend && uv run ruff check .
|
|
|
|
|
|
|
|
|
|
format-backend:
|
|
|
|
|
cd backend && uv run ruff format .
|
|
|
|
|
|
|
|
|
|
fix-backend:
|
|
|
|
|
cd backend && uv run ruff check --fix . && uv run ruff format .
|
2025-12-21 21:56:46 +01:00
|
|
|
|
|
|
|
|
security-backend:
|
|
|
|
|
cd backend && uv run bandit -r . -c pyproject.toml
|