-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
196 lines (165 loc) · 5.12 KB
/
Makefile
File metadata and controls
196 lines (165 loc) · 5.12 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# Makefile for MCP Server Templates
.PHONY: help install test test-unit test-integration test-all test-quick clean lint format
# Default target
help:
@echo "MCP Server Templates Development Commands"
@echo "========================================"
@echo ""
@echo "Setup:"
@echo " install Install development dependencies"
@echo " install-dev Install in development mode"
@echo ""
@echo "Testing:"
@echo " test-quick Run quick validation tests"
@echo " test-unit Run unit tests (fast, no Docker)"
@echo " test-integration Run integration tests (requires Docker)"
@echo " test-all Run all tests"
@echo " test Alias for test-all"
@echo " test-template Run tests for a specific template (usage: make test-template TEMPLATE=file-server)"
@echo " test-templates Run tests for all templates"
@echo ""
@echo "Code Quality:"
@echo " lint Run code linting"
@echo " format Format code"
@echo " type-check Run type checking"
@echo ""
@echo "Deployment:"
@echo " build Build package"
@echo " clean Clean build artifacts"
@echo ""
@echo "Local Development:"
@echo " deploy-test Deploy a test template locally"
@echo " cleanup-test Cleanup test deployments"
# Installation
install:
pip install -r requirements.txt
pip install -r requirements-dev.txt
install-dev:
pip install -e .
# Testing
test-quick:
@echo "🔬 Running quick validation tests..."
pytest tests/runner.py quick
test-unit:
@echo "🧪 Running unit tests..."
pytest tests/runner.py unit
test-integration:
@echo "🐳 Running integration tests..."
pytest tests/runner.py integration
test-all:
@echo "🚀 Running all tests..."
pytest tests/runner.py all
test:
pytest tests
# Template-specific testing
test-template:
@if [ -z "$(TEMPLATE)" ]; then \
echo "❌ Please specify a template: make test-template TEMPLATE=file-server"; \
exit 1; \
fi; \
if [ -d "templates/$(TEMPLATE)/tests" ]; then \
echo "🧪 Running tests for template: $(TEMPLATE)"; \
cd templates/$(TEMPLATE) && pytest tests/ -v; \
else \
echo "❌ No tests found for template: $(TEMPLATE)"; \
exit 1; \
fi
test-templates:
@echo "🧪 Running tests for all templates..."
@for template in templates/*/; do \
template_name=$$(basename "$$template"); \
if [ -d "$$template/tests" ]; then \
echo "Testing $$template_name..."; \
cd "$$template" && pytest tests/ -v --tb=short || exit 1; \
cd - > /dev/null; \
else \
echo "⚠️ No tests found for $$template_name"; \
fi \
done; \
echo "✅ All template tests completed!"
# Code quality
lint:
@echo "🔍 Running code linting..."
flake8 mcp_template/ tests/ --max-line-length=100 --ignore=E203,W503
bandit -r mcp_template/ -f json -o bandit-report.json || true
format:
@echo "🎨 Formatting code..."
black mcp_template/ tests/
isort mcp_template/ tests/
type-check:
@echo "🔬 Running type checking..."
mypy mcp_template/ --ignore-missing-imports
# Package building
build:
@echo "📦 Building package..."
python -m build
clean:
@echo "🧹 Cleaning build artifacts..."
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf .pytest_cache/
rm -rf __pycache__/
find . -name "*.pyc" -delete
find . -name "*.pyo" -delete
find . -name "__pycache__" -type d -exec rm -rf {} +
# Local development helpers
deploy-test:
@echo "🚀 Deploying test template..."
python -m mcp_template deploy file-server
cleanup-test:
@echo "🧹 Cleaning up test deployments..."
python -m mcp_template cleanup --all
list-templates:
@echo "📋 Available templates:"
python -m mcp_template list
# CI/CD simulation
ci-quick:
@echo "⚡ Simulating CI quick tests..."
make test-quick
make lint
ci-full:
@echo "🏗️ Simulating full CI pipeline..."
make install
make test-quick
make test-unit
make lint
make type-check
make test-integration
make build
# Development workflow
dev-setup: install install-dev
@echo "✅ Development environment setup complete!"
dev-test: test-quick lint
@echo "✅ Development tests passed!"
# Coverage reporting
coverage:
@echo "📊 Generating coverage report..."
pytest tests/test_deployment_units.py -m unit --cov=mcp_template --cov-report=html --cov-report=term
@echo "📋 Coverage report generated in htmlcov/"
# Documentation
docs:
@echo "📚 Building documentation..."
python scripts/build_docs.py
docs-serve:
@echo "🌐 Serving documentation locally..."
mkdocs serve
docs-clean:
@echo "🧹 Cleaning documentation build..."
rm -rf site/
find docs/templates/ -mindepth 1 -maxdepth 1 -type d ! -name ".pages" -exec rm -rf {} +
# Docker helpers
docker-check:
@echo "🐳 Checking Docker availability..."
docker --version
docker ps
# Template development
validate-templates:
@echo "✅ Validating all templates..."
python -c "from mcp_template import TemplateDiscovery; import sys; d = TemplateDiscovery(); t = d.discover_templates(); print(f'Found {len(t)} templates: {list(t.keys())}') if t else sys.exit(1)"
# Release helpers
pre-release: ci-full
@echo "🚀 Pre-release checks complete!"
version:
@echo "📊 Package version:"
python -c "import mcp_template; print(getattr(mcp_template, '__version__', 'unknown'))"