-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMakefile
More file actions
153 lines (126 loc) · 3.87 KB
/
Copy pathMakefile
File metadata and controls
153 lines (126 loc) · 3.87 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
# OCPP Proxy Makefile
# Provides convenient commands for development and testing
.PHONY: help install test test-unit test-integration test-e2e test-coverage test-quick test-all lint format check clean build run docker-build docker-run
# Default target
help:
@echo "OCPP Proxy Development Commands"
@echo "==============================="
@echo ""
@echo "Setup:"
@echo " install Install dependencies"
@echo " install-dev Install development dependencies"
@echo ""
@echo "Testing:"
@echo " test Run all tests with coverage"
@echo " test-unit Run unit tests only"
@echo " test-integration Run integration tests only"
@echo " test-e2e Run end-to-end tests only"
@echo " test-coverage Generate coverage report"
@echo " test-quick Run quick test suite (unit tests)"
@echo " test-all Run complete test suite"
@echo ""
@echo "Code Quality:"
@echo " lint Run linting checks (ruff + mypy)"
@echo " lint-fix Run linting with auto-fix"
@echo " format Format code (black + ruff)"
@echo " format-check Check code formatting"
@echo " type-check Run type checking (mypy)"
@echo " check Run all quality checks"
@echo ""
@echo "Development:"
@echo " run Run the application"
@echo " clean Clean temporary files"
@echo ""
@echo "Docker:"
@echo " docker-build Build Docker image"
@echo " docker-run Run in Docker container"
# Installation targets
install:
poetry install --only=main
install-dev:
poetry install
# Testing targets
test:
poetry run python run_tests.py
test-unit:
poetry run python run_tests.py --unit
test-integration:
poetry run python run_tests.py --integration
test-e2e:
poetry run python run_tests.py --e2e
test-coverage:
poetry run python run_tests.py --coverage
test-quick:
poetry run pytest tests/ -m "unit" --cov=src/ocpp_proxy --cov-report=term-missing -v
test-all:
poetry run pytest tests/ --cov=src/ocpp_proxy --cov-report=term-missing --cov-report=html:htmlcov -v
# Code quality targets
lint:
@echo "Running linting checks..."
poetry run ruff check src/ tests/
poetry run mypy src/
lint-fix:
@echo "Running linting with auto-fix..."
poetry run ruff check --fix src/ tests/
format:
@echo "Formatting code..."
poetry run ruff format src/ tests/
format-check:
@echo "Checking code formatting..."
poetry run ruff format --check src/ tests/
type-check:
@echo "Running type checking..."
poetry run mypy src/
check: format-check lint type-check
@echo "Running all quality checks..."
poetry run python run_tests.py --unit
# Development targets
run:
poetry run python -m ocpp_proxy.main
clean:
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
find . -type d -name "*.egg-info" -exec rm -rf {} +
rm -rf htmlcov/
rm -rf .coverage
rm -rf .pytest_cache/
rm -rf build/
rm -rf dist/
rm -rf poetry.lock
# Docker targets
docker-build:
docker build -t ocpp-proxy .
docker-run:
docker run -p 9000:9000 ocpp-proxy
# Development helpers
deps-check:
pip list --outdated
deps-tree:
pip show --verbose ev-charger-proxy || echo "Package not installed in development mode"
# Test database management
test-db-clean:
rm -f tests/test_*.db
rm -f usage_log.db
# Coverage targets
coverage-open:
@if [ -f htmlcov/index.html ]; then \
echo "Opening coverage report..."; \
python -m webbrowser htmlcov/index.html; \
else \
echo "No coverage report found. Run 'make test-coverage' first."; \
fi
# Continuous integration simulation
ci:
@echo "Running CI pipeline simulation..."
make clean
make install
make test-all
@echo "CI pipeline completed successfully!"
# Development setup
dev-setup:
@echo "Setting up development environment..."
@echo "Installing Poetry if not already available..."
@which poetry || curl -sSL https://install.python-poetry.org | python3 -
poetry install
@echo "Development environment ready!"
@echo "Run 'make test' to verify everything works."