ploop/Makefile

86 lines
2.8 KiB
Makefile

.PHONY: \
check-docs \
check-backend lint-backend typecheck-backend test-backend \
frontend-deps check-frontend lint-frontend typecheck-frontend build-frontend \
check-architecture check-dev-services check-migrations check ci fmt format-backend format-frontend \
test-api test-frontend test-browser export-openapi check-contracts
UV ?= uv
PNPM ?= pnpm
PYTHON ?= python3
PYTHON_VERSION ?= 3.12
ENV_FILE ?= .env
ARCHITECTURE_ROOT ?= backend/src/ploop
check-docs:
python3 scripts/check_docs.py . --exclude .worktrees --exclude scripts/tests/fixtures --exclude frontend/node_modules --exclude frontend/dist --exclude backend/.venv
check-architecture: frontend-deps
$(PYTHON) scripts/check_architecture.py $(ARCHITECTURE_ROOT)
$(PYTHON) scripts/check_code_calls.py $(ARCHITECTURE_ROOT)
$(PYTHON) scripts/check_frontend_architecture.py frontend/src frontend/tests/e2e
check-backend: lint-backend typecheck-backend test-backend
lint-backend:
$(UV) --directory backend sync --locked --group dev --python $(PYTHON_VERSION)
$(UV) --directory backend run --python $(PYTHON_VERSION) ruff format --check .
$(UV) --directory backend run --python $(PYTHON_VERSION) ruff check .
typecheck-backend:
$(UV) --directory backend run --python $(PYTHON_VERSION) mypy src/ploop
test-backend:
$(UV) --directory backend run --python $(PYTHON_VERSION) pytest tests
check-frontend: lint-frontend typecheck-frontend build-frontend
frontend-deps:
$(PNPM) --dir frontend install --frozen-lockfile
lint-frontend: frontend-deps
$(PNPM) --dir frontend format:check
$(PNPM) --dir frontend lint
typecheck-frontend:
$(PNPM) --dir frontend typecheck
build-frontend:
$(PNPM) --dir frontend build
test-api:
$(UV) --directory backend run --python $(PYTHON_VERSION) pytest tests/api
test-frontend:
$(PNPM) --dir frontend exec vitest run
test-browser: build-frontend
$(PNPM) --dir frontend exec playwright test --config tests/e2e/playwright.config.ts
export-openapi:
$(UV) --directory backend run --python $(PYTHON_VERSION) python ../scripts/export_openapi.py
$(PNPM) --dir frontend generate:api
check-contracts: export-openapi
git diff --exit-code -- backend/openapi.json frontend/src/shared/api/generated/openapi.ts
check-dev-services:
$(PYTHON) scripts/check_dev_services.py --env $(ENV_FILE)
check-migrations:
$(UV) --directory backend run --python $(PYTHON_VERSION) python ../scripts/check_migrations.py --allow-migration
check: check-docs check-architecture check-backend check-frontend check-contracts test-frontend
ci: check
fmt: format-backend format-frontend
format-backend:
$(UV) --directory backend sync --locked --group dev --python $(PYTHON_VERSION)
$(UV) --directory backend run --python $(PYTHON_VERSION) ruff format .
format-frontend:
$(PNPM) --dir frontend install --frozen-lockfile
$(PNPM) --dir frontend format