From dea092e1bbbe467de56d8bd601c94c471498afef Mon Sep 17 00:00:00 2001 From: Felipe Cardoso Date: Mon, 5 Jan 2026 01:02:09 +0100 Subject: [PATCH] feat: extend Makefile with testing and validation commands, expand help section - Added new targets for testing (`test`, `test-backend`, `test-mcp`, `test-frontend`, etc.) and validation (`validate`, `validate-all`). - Enhanced help section to reflect updates, including detailed descriptions for testing, validation, and new MCP-specific commands. - Improved developer workflow by centralizing testing and linting processes in the Makefile. --- Makefile | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 29e3f68..1afd330 100755 --- a/Makefile +++ b/Makefile @@ -1,18 +1,31 @@ .PHONY: help dev dev-full prod down logs logs-dev clean clean-slate drop-db reset-db push-images deploy +.PHONY: test test-backend test-mcp test-frontend test-all test-cov test-integration validate validate-all VERSION ?= latest REGISTRY ?= ghcr.io/cardosofelipe/pragma-stack # Default target help: - @echo "FastAPI + Next.js Full-Stack Template" + @echo "Syndarix - AI-Powered Software Consulting Agency" @echo "" @echo "Development:" - @echo " make dev - Start backend + db (frontend runs separately)" + @echo " make dev - Start backend + db + MCP servers (frontend runs separately)" @echo " make dev-full - Start all services including frontend" @echo " make down - Stop all services" @echo " make logs-dev - Follow dev container logs" @echo "" + @echo "Testing:" + @echo " make test - Run all tests (backend + MCP servers)" + @echo " make test-backend - Run backend tests only" + @echo " make test-mcp - Run MCP server tests only" + @echo " make test-frontend - Run frontend tests only" + @echo " make test-cov - Run all tests with coverage reports" + @echo " make test-integration - Run MCP integration tests (requires running stack)" + @echo "" + @echo "Validation:" + @echo " make validate - Validate backend + MCP servers (lint, type-check, test)" + @echo " make validate-all - Validate everything including frontend" + @echo "" @echo "Database:" @echo " make drop-db - Drop and recreate empty database" @echo " make reset-db - Drop database and apply all migrations" @@ -28,8 +41,10 @@ help: @echo " make clean-slate - Stop containers AND delete volumes (DATA LOSS!)" @echo "" @echo "Subdirectory commands:" - @echo " cd backend && make help - Backend-specific commands" - @echo " cd frontend && npm run - Frontend-specific commands" + @echo " cd backend && make help - Backend-specific commands" + @echo " cd mcp-servers/llm-gateway && make - LLM Gateway commands" + @echo " cd mcp-servers/knowledge-base && make - Knowledge Base commands" + @echo " cd frontend && npm run - Frontend-specific commands" # ============================================================================ # Development @@ -99,3 +114,72 @@ clean: # WARNING! THIS REMOVES CONTAINERS AND VOLUMES AS WELL - DO NOT USE THIS UNLESS YOU WANT TO START OVER WITH DATA AND ALL clean-slate: docker compose -f docker-compose.dev.yml down -v --remove-orphans + +# ============================================================================ +# Testing +# ============================================================================ + +test: test-backend test-mcp + @echo "" + @echo "All tests passed!" + +test-backend: + @echo "Running backend tests..." + @cd backend && IS_TEST=True uv run pytest tests/ -v + +test-mcp: + @echo "Running MCP server tests..." + @echo "" + @echo "=== LLM Gateway ===" + @cd mcp-servers/llm-gateway && uv run pytest tests/ -v + @echo "" + @echo "=== Knowledge Base ===" + @cd mcp-servers/knowledge-base && uv run pytest tests/ -v + +test-frontend: + @echo "Running frontend tests..." + @cd frontend && npm test + +test-all: test test-frontend + @echo "" + @echo "All tests (backend + MCP + frontend) passed!" + +test-cov: + @echo "Running all tests with coverage..." + @echo "" + @echo "=== Backend Coverage ===" + @cd backend && IS_TEST=True uv run pytest tests/ -v --cov=app --cov-report=term-missing + @echo "" + @echo "=== LLM Gateway Coverage ===" + @cd mcp-servers/llm-gateway && uv run pytest tests/ -v --cov=. --cov-report=term-missing + @echo "" + @echo "=== Knowledge Base Coverage ===" + @cd mcp-servers/knowledge-base && uv run pytest tests/ -v --cov=. --cov-report=term-missing + +test-integration: + @echo "Running MCP integration tests..." + @echo "Note: Requires running stack (make dev first)" + @cd backend && RUN_INTEGRATION_TESTS=true IS_TEST=True uv run pytest tests/integration/ -v + +# ============================================================================ +# Validation (lint + type-check + test) +# ============================================================================ + +validate: + @echo "Validating backend..." + @cd backend && make validate + @echo "" + @echo "Validating LLM Gateway..." + @cd mcp-servers/llm-gateway && make validate + @echo "" + @echo "Validating Knowledge Base..." + @cd mcp-servers/knowledge-base && make validate + @echo "" + @echo "All validations passed!" + +validate-all: validate + @echo "" + @echo "Validating frontend..." + @cd frontend && npm run validate + @echo "" + @echo "Full validation passed!"