forked from DogukanUrker/FlaskBlog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (50 loc) · 1.91 KB
/
Makefile
File metadata and controls
65 lines (50 loc) · 1.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
# FlaskBlog Makefile
APP_DIR := app
TESTS_DIR := tests/e2e
UV := uv
.DEFAULT_GOAL := help
.PHONY: help install install-app run docker docker-build docker-run test test-slow lint ci clean
# Help
help: ## Show all available commands
@echo "FlaskBlog Development Commands"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*##/ { printf " %-15s %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
# Dependencies
install: ## Install all dependencies (app + dev + test + Playwright)
cd $(APP_DIR) && $(UV) sync --all-extras
cd $(APP_DIR) && $(UV) run playwright install chromium --with-deps
install-app: ## Install app dependencies only
cd $(APP_DIR) && $(UV) sync
# Application
run: ## Run the Flask application (http://localhost:1283)
cd $(APP_DIR) && $(UV) run app.py
# Docker
docker: docker-build docker-run ## Build and run with Docker
docker-build: ## Build Docker image
docker build -t flaskblog .
docker-run: ## Run Docker container
docker run --rm -p 1283:1283 \
$(if $(wildcard .env),--env-file .env) \
flaskblog
# Testing
test: ## Run E2E tests (parallel)
cd $(APP_DIR) && $(UV) run pytest ../$(TESTS_DIR) -v
test-slow: ## Run tests with visible browser in slow-mo (sequential)
cd $(APP_DIR) && $(UV) run pytest ../$(TESTS_DIR) --headed --slowmo 500 -v -n 0
# Code Quality
lint: ## Format and lint code with Ruff (with auto-fix)
cd $(APP_DIR) && $(UV) run ruff format ..
cd $(APP_DIR) && $(UV) run ruff check --fix ..
cd $(APP_DIR) && $(UV) run ruff format ..
# CI
ci: ## Run CI checks (format check + lint)
cd $(APP_DIR) && $(UV) run ruff format --check --diff ..
cd $(APP_DIR) && $(UV) run ruff check ..
# Cleanup
clean: ## Remove cache files
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true