-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
182 lines (164 loc) · 4.7 KB
/
Copy pathMakefile
File metadata and controls
182 lines (164 loc) · 4.7 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
.PHONY: help install test test-unit test-integration test-performance test-all lint format clean coverage docs
# Default target
help:
@echo "ByteWaves Testing Framework"
@echo "=========================="
@echo ""
@echo "Available targets:"
@echo " install - Install the package with development dependencies"
@echo " test - Run all tests"
@echo " test-unit - Run unit tests only"
@echo " test-int - Run integration tests only"
@echo " test-perf - Run performance tests only"
@echo " test-all - Run all tests with coverage"
@echo " lint - Run linting checks"
@echo " format - Format code with black and isort"
@echo " clean - Clean up generated files"
@echo " coverage - Generate coverage report"
@echo " docs - Generate documentation"
@echo " ci - Run full CI pipeline locally"
# Installation
install:
@echo "Installing ByteWaves with development dependencies..."
@if command -v uv &> /dev/null; then \
uv sync --dev; \
else \
pip install -e ".[dev]"; \
fi
# Testing targets
test:
@echo "Running all tests..."
@if command -v uv &> /dev/null; then \
uv run pytest tests/ -v; \
else \
pytest tests/ -v; \
fi
test-unit:
@echo "Running unit tests..."
@if command -v uv &> /dev/null; then \
uv run pytest tests/unit/ -v; \
else \
pytest tests/unit/ -v; \
fi
test-int:
@echo "Running integration tests..."
@if command -v uv &> /dev/null; then \
uv run pytest tests/integration/ -v; \
else \
pytest tests/integration/ -v; \
fi
test-perf:
@echo "Running performance tests..."
@if command -v uv &> /dev/null; then \
uv run pytest tests/performance/ -v; \
else \
pytest tests/performance/ -v; \
fi
test-all:
@echo "Running all tests with coverage..."
@if command -v uv &> /dev/null; then \
uv run pytest tests/ --cov=bytewaves --cov-report=html --cov-report=term-missing; \
else \
pytest tests/ --cov=bytewaves --cov-report=html --cov-report=term-missing; \
fi
# Code quality
lint:
@echo "Running linting checks..."
@if command -v uv &> /dev/null; then \
uv run flake8 bytewaves/; \
uv run black --check --diff bytewaves/; \
uv run isort --check-only --diff bytewaves/; \
else \
flake8 bytewaves/; \
black --check --diff bytewaves/; \
isort --check-only --diff bytewaves/; \
fi
format:
@echo "Formatting code..."
@if command -v uv &> /dev/null; then \
uv run black bytewaves/; \
uv run isort bytewaves/; \
else \
black bytewaves/; \
isort bytewaves/; \
fi
# Cleanup
clean:
@echo "Cleaning up generated files..."
@rm -rf build/
@rm -rf dist/
@rm -rf *.egg-info/
@rm -rf .coverage
@rm -rf coverage.xml
@rm -rf htmlcov/
@rm -rf .pytest_cache/
@rm -rf __pycache__/
@find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
@find . -type f -name "*.pyc" -delete 2>/dev/null || true
# Coverage
coverage:
@echo "Generating coverage report..."
@if command -v uv &> /dev/null; then \
uv run pytest tests/ --cov=bytewaves --cov-report=html; \
else \
pytest tests/ --cov=bytewaves --cov-report=html; \
fi
@echo "Coverage report generated in htmlcov/index.html"
# Documentation
docs:
@echo "Generating documentation..."
@if command -v uv &> /dev/null; then \
uv run sphinx-build docs/ docs/_build/; \
else \
sphinx-build docs/ docs/_build/; \
fi
# Local CI simulation
ci: lint test-all coverage
@echo "CI pipeline completed successfully!"
# Quick test (fast feedback)
quick-test:
@echo "Running quick test suite..."
@if command -v uv &> /dev/null; then \
uv run pytest tests/unit/ -x; \
else \
pytest tests/unit/ -x; \
fi
# Benchmark specific components
benchmark:
@echo "Running benchmarks..."
@if command -v uv &> /dev/null; then \
uv run pytest tests/performance/test_benchmarks.py -v; \
else \
pytest tests/performance/test_benchmarks.py -v; \
fi
# Security scan
security:
@echo "Running security checks..."
@if command -v uv &> /dev/null; then \
uv run safety check; \
uv run bandit -r bytewaves/; \
else \
safety check; \
bandit -r bytewaves/; \
fi
# Development workflow
dev-setup: install
@echo "Setting up development environment..."
@cp -n requirements-dev.txt requirements-dev.txt.backup 2>/dev/null || true
@echo "Installing pre-commit hooks..."
@if command -v uv &> /dev/null; then \
uv run pre-commit install; \
else \
pre-commit install; \
fi
# Quick check for common issues
health-check:
@echo "Running health checks..."
@if command -v uv &> /dev/null; then \
uv run python -c "import bytewaves; print('✅ Import successful')"; \
uv run python -m py_compile bytewaves/*.py; \
else \
python -c "import bytewaves; print('✅ Import successful')"; \
python -m py_compile bytewaves/*.py; \
fi
@echo "Health check completed"