refactor: update Makefile for new deploy/ structure

This commit is contained in:
2025-12-30 20:35:09 -05:00
parent f921412f01
commit 3d68de4c54

View File

@@ -1,34 +1,37 @@
.PHONY: help test build integration-up integration-test integration-down integration pre-deploy clean .PHONY: help test test-unit test-integration build dev-up dev-down pre-deploy clean
VERBOSE ?= 0
PYTEST_ARGS := $(if $(filter 1,$(VERBOSE)),-v,-q)
# Default target # Default target
help: ## Show this help help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
test: ## Run unit tests # Testing
uv run pytest tests/unit/ -v test: test-unit ## Run all tests (unit only by default)
build: ## Build Docker images for testing test-unit: ## Run unit tests
docker compose -f docker-compose.test.yaml build uv run pytest tests/unit/ $(PYTEST_ARGS)
integration-up: ## Start integration test containers test-integration: ## Run integration tests (starts/stops containers)
docker compose -f docker-compose.test.yaml up -d ./scripts/run-integration-tests.sh
@echo "Waiting for services to be ready..."
@sleep 5
integration-test: ## Run integration tests (containers must be up) # Docker
uv run pytest tests/integration/ -v build: ## Build Docker image
docker build -t grist-mcp:latest .
integration-down: ## Stop and remove test containers dev-up: ## Start development environment
docker compose -f docker-compose.test.yaml down -v cd deploy/dev && docker compose up -d --build
integration: build integration-up ## Full integration cycle (build, up, test, down) dev-down: ## Stop development environment
@$(MAKE) integration-test || ($(MAKE) integration-down && exit 1) cd deploy/dev && docker compose down
@$(MAKE) integration-down
pre-deploy: test integration ## Full pre-deployment pipeline (unit tests + integration) # Pre-deployment
pre-deploy: test-unit test-integration ## Full pre-deployment pipeline
@echo "Pre-deployment checks passed!" @echo "Pre-deployment checks passed!"
clean: ## Remove all test artifacts and containers # Cleanup
docker compose -f docker-compose.test.yaml down -v --rmi local 2>/dev/null || true clean: ## Remove test artifacts and containers
cd deploy/test && docker compose down -v --rmi local 2>/dev/null || true
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true 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 .pytest_cache -exec rm -rf {} + 2>/dev/null || true