-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (96 loc) · 3.99 KB
/
Copy pathMakefile
File metadata and controls
117 lines (96 loc) · 3.99 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
PACKAGE_NAME = dj_signals_panel
PYPI_REPO ?= pypi # can be 'testpypi' or 'pypi'
.PHONY: help clean build publish test install
help:
@echo "Makefile targets:"
@echo " make clean Remove build artifacts"
@echo " make build Build sdist and wheel (in ./dist)"
@echo " make install_requirements Install all dev dependencies"
@echo " make install Install dependencies and package in editable mode"
@echo " make uninstall Uninstall package"
@echo " make uninstall_all Uninstall all packages"
@echo " make test_install Check if package can be imported"
@echo " make test_docker Run tests inside Docker dev container"
@echo " make test_local Run tests inside local environment"
@echo " make test_coverage Run tests with coverage report"
@echo " make coverage_html Generate HTML coverage report"
@echo " make publish Publish package to PyPI"
@echo " make docs Build documentation"
@echo " make docs_serve Serve documentation locally"
@echo " make docs_push Deploy documentation to GitHub Pages"
@echo " make docker_up Start all Docker services (dev, Redis, cluster)"
@echo " make docker_down Stop all Docker services and clean volumes"
@echo " make docker_shell Open shell in dev container"
clean:
rm -rf build dist *.egg-info
build: clean
python -m build
install_requirements:
python -m pip install -r requirements.txt
install: install_requirements
python -m pip install -e .
uninstall:
python -m pip uninstall -y $(PACKAGE_NAME) || true
uninstall_all:
python -m pip uninstall -y $(PACKAGE_NAME) || true
python -m pip uninstall -y -r requirements.txt || true
@echo "All packages in requirements.txt uninstalled"
@echo "Note that some dependent packages may still be installed"
@echo "To uninstall all packages, run 'pip freeze | xargs pip uninstall -y'"
@echo "Do this at your own risk. Use a python virtual environment always."
test_install: build
python -m pip uninstall -y $(PACKAGE_NAME) || true
python -m pip install -e .
python -c "import dj_signals_panel; print('✅ Import success!')"
test_local:
@echo "Running tests in local environment..."
@python -m pytest tests/ -v
@echo "✅ Tests completed"
test_docker:
@echo "Starting Docker services..."
docker compose up -d
@echo "Waiting for services to be ready..."
@sleep 3
@echo "Running tests in dev container..."
@docker compose exec dev bash -c "cd /app && REDIS_HOST=redis python -m pytest tests/ -v"
@echo "✅ Tests completed"
test_coverage:
@echo "Running tests with coverage"
@python -m pytest --cov=dj_signals_panel --cov-report=xml --cov-report=html --cov-report=term-missing tests/
@echo "✅ Tests with coverage completed"
test_coverage_docker:
@echo "Running tests with coverage in Docker"
@docker compose up -d
@echo "Waiting for containers to initialize..."
@sleep 3
@echo "Running all tests in dev container..."
@docker compose exec dev bash -c "cd /app && REDIS_HOST=redis python -m pytest --cov=dj_signals_panel --cov-report=xml --cov-report=html --cov-report=term-missing tests/"
@echo "✅ All tests completed"
coverage_html: test_coverage
@echo "Coverage report generated in htmlcov/index.html"
@echo "Open htmlcov/index.html in your browser to view the detailed report"
publish:
twine upload --repository $(PYPI_REPO) dist/*
docs: install
mkdocs build
docs_serve:
mkdocs serve
docs_push: docs
mkdocs gh-deploy --force
# Docker targets
docker_up:
@echo "Starting all Docker services..."
@docker compose up -d
@echo "Waiting for containers to initialize..."
@sleep 3
@echo "✅ All services are running:"
@echo " Dev container: dj-signals-panel-dev-1"
@echo ""
@echo "Run 'make docker_shell' to open a shell in the dev container"
docker_down:
@echo "Stopping all Docker services and cleaning volumes..."
@docker compose down -v
@echo "✅ All services stopped and volumes cleaned"
docker_shell:
@echo "Opening shell in dev container..."
@docker compose exec dev bash