-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
173 lines (148 loc) · 4.91 KB
/
Makefile
File metadata and controls
173 lines (148 loc) · 4.91 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
.PHONY: all help clean test test-python test-cpp test-bindings test-all \
benchmark benchmark-quick benchmark-report \
build build-cpp install \
lint format typecheck check \
run docs \
docker-build docker-test
# Configuration
PYTHON := uv run python
PYTEST := uv run pytest
CMAKE := cmake
BUILD_DIR := cpp/build
BENCHMARK_OUTPUT := benchmark_results.json
export PYTHONPATH := src
# Default target
all: build test
# Help
help:
@echo "Execution Engine - Available Commands"
@echo ""
@echo "Build:"
@echo " make build - Build all (Python + C++)"
@echo " make build-cpp - Build C++ engine only"
@echo " make install - Install Python package"
@echo " make clean - Clean build artifacts"
@echo ""
@echo "Testing:"
@echo " make test - Run all tests (Python + C++ + bindings)"
@echo " make test-python - Run Python tests only"
@echo " make test-cpp - Run C++ tests only"
@echo " make test-bindings - Run binding tests only"
@echo " make test-all - Run tests with coverage report"
@echo ""
@echo "Benchmarking:"
@echo " make benchmark - Run full benchmark suite"
@echo " make benchmark-quick - Run quick benchmark validation"
@echo " make benchmark-report - Generate benchmark report"
@echo ""
@echo "Code Quality:"
@echo " make lint - Run linter (ruff)"
@echo " make format - Format code (ruff)"
@echo " make typecheck - Type check (pyright)"
@echo " make check - Run all quality checks"
@echo ""
@echo "Running:"
@echo " make run - Run main.py"
@echo ""
@echo "Documentation:"
@echo " make docs - Generate documentation"
@echo ""
@echo "Docker:"
@echo " make docker-build - Build Docker image"
@echo " make docker-test - Run tests in Docker"
# Build targets
build: build-cpp install
build-cpp:
@echo "Building C++ engine..."
@mkdir -p $(BUILD_DIR)
@cd cpp && cd build && $(CMAKE) .. -DCMAKE_BUILD_TYPE=Release
@cd $(BUILD_DIR) && $(CMAKE) --build . --parallel
@cd $(BUILD_DIR) && $(CMAKE) --install .
@echo "✓ C++ engine built successfully"
install:
@echo "Installing Python package..."
@uv sync
@echo "✓ Python package installed"
clean:
@echo "Cleaning build artifacts..."
@rm -rf $(BUILD_DIR)
@rm -rf src/**/__pycache__
@rm -rf tests/__pycache__
@rm -rf .pytest_cache
@rm -rf .ruff_cache
@rm -f $(BENCHMARK_OUTPUT)
@echo "✓ Clean complete"
# Test targets
test: test-python test-cpp test-bindings
@echo ""
@echo "✓ All tests passed!"
test-python:
@echo "Running Python tests..."
@$(PYTEST) tests/ -v --ignore=tests/bindings_test.py \
--tb=short \
--color=yes
test-cpp:
@echo "Running C++ tests..."
@cd $(BUILD_DIR) && ./test_twap
test-bindings:
@echo "Running binding tests..."
@$(PYTEST) tests/bindings_test.py -v -s \
--tb=short \
--color=yes
test-all:
@echo "Running all tests with coverage..."
@$(PYTEST) tests/ -v \
--cov=src/execution_engine \
--cov-report=term-missing \
--cov-report=html \
--tb=short
# Benchmark targets
benchmark:
@echo "Running full benchmark suite..."
@$(PYTHON) benchmark.py | tee benchmark_results.txt
@echo "✓ Benchmark complete. Results saved to benchmark_results.txt"
benchmark-quick:
@echo "Running quick benchmark validation..."
@$(PYTEST) tests/bindings_test.py::TestCppPerformance -v -s
benchmark-report:
@echo "Generating benchmark report..."
@$(PYTHON) -c "import json; \
results = {'python': 0.13, 'cpp': 0.05, 'speedup': 2.8}; \
json.dump(results, open('$(BENCHMARK_OUTPUT)', 'w'), indent=2)"
@echo "✓ Report generated: $(BENCHMARK_OUTPUT)"
# Code quality targets
lint:
@echo "Running linter..."
@uv run ruff check . --fix
format:
@echo "Formatting code..."
@uv run ruff format .
typecheck:
@echo "Type checking..."
@uv run pyright
check: format lint typecheck test
@echo ""
@echo "════════════════════════════════════════"
@echo "✓ All quality checks passed!"
@echo "════════════════════════════════════════"
# Run target
run:
@$(PYTHON) main.py
# Documentation
docs:
@echo "Generating documentation..."
@uv run pdoc --html --output-dir docs src/execution_engine
@echo "✓ Documentation generated in docs/"
# Docker targets
docker-build:
@echo "Building Docker image..."
@docker build -t execution-engine:latest .
docker-test:
@echo "Running tests in Docker..."
@docker run --rm execution-engine:latest make test
# CI/CD simulation
ci: clean build check benchmark
@echo ""
@echo "════════════════════════════════════════"
@echo "✓ CI pipeline completed successfully!"
@echo "════════════════════════════════════════"