-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (76 loc) · 3.07 KB
/
Makefile
File metadata and controls
103 lines (76 loc) · 3.07 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
.PHONY: help install install-js test test-fast lint lint-js format clean run debug docker-build docker-run venv vulture vulture-all
VENV = venv
PYTHON = $(VENV)/bin/python
PIP = $(VENV)/bin/pip
PYTEST = $(VENV)/bin/pytest
BLACK = $(VENV)/bin/black
ISORT = $(VENV)/bin/isort
FLAKE8 = $(VENV)/bin/flake8
MYPY = $(VENV)/bin/mypy
VULTURE = $(VENV)/bin/vulture
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Available targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
venv: ## Create virtual environment
python3 -m venv $(VENV)
$(PIP) install --upgrade pip
install: install-py install-js ## Install all dependencies
install-py: venv ## Install Python dependencies in venv
$(PIP) install -r requirements.txt
$(PIP) install -r requirements-dev.txt
install-js: ## Install JavaScript dependencies
npm install
test: install ## Run tests with coverage in venv
$(PYTEST) tests/ -v --cov=. --cov-report=html --cov-report=term-missing
test-fast: install ## Run tests without coverage in venv
$(PYTEST) tests/ -v
lint-py: install ## Run Python linting checks in venv
$(FLAKE8) . --count --select=E9,F63,F7,F82 --show-source --statistics
$(FLAKE8) . --count --exit-zero --statistics
$(BLACK) --check .
$(ISORT) --check-only .
$(MYPY) app.py models.py services/ routes/
vulture: install ## Find dead code with vulture
$(VULTURE) app.py models.py services/ routes/ schemas.py error_handling.py vulture_whitelist.py --min-confidence 80
vulture-all: install ## Find dead code including lower confidence results
$(VULTURE) app.py models.py services/ routes/ schemas.py error_handling.py vulture_whitelist.py --min-confidence 60
lint-js: ## Run JavaScript/HTML linting
npm run lint
lint: lint-py lint-js ## Run all linting checks (Python + JavaScript)
format: venv ## Format code with black and isort in venv
$(BLACK) .
$(ISORT) .
clean: ## Clean up Python generated files
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name '*.pyc' -delete
find . -type f -name '*.pyo' -delete
rm -rf htmlcov/
rm -rf .coverage
rm -rf .pytest_cache/
rm -rf .mypy_cache/
rm -rf $(VENV)/
# Local development environment variables
export DATABASE_URL ?= sqlite:///$(PWD)/data/iptv_proxy.db
export SECRET_KEY ?= dev-secret-key
clean-js: ## Clean up JavaScript dependencies
rm -rf node_modules package-lock.json
clean-all: clean clean-js ## Clean up all generated files
run: ## Run the application locally
python app.py
debug: ## Run the application in debug mode with auto-reload
FLASK_DEBUG=1 FLASK_ENV=development python app.py
migrate: ## Run database migrations
python run_migrations.py
docker-build: ## Build Docker image
docker-compose build
docker-run: ## Run with Docker Compose
docker-compose up -d
docker-logs: ## View Docker logs
docker-compose logs -f
docker-stop: ## Stop Docker containers
docker-compose down
docker-migrate: ## Run migrations in Docker container
docker exec -it iptv-proxy-v2 python run_migrations.py
ci: lint-all test ## Run all CI checks (Python + JavaScript linting + tests)