-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
166 lines (136 loc) · 5.8 KB
/
Makefile
File metadata and controls
166 lines (136 loc) · 5.8 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
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
# FastStack — Hybrid FastAPI Framework
# Runtime core + CLI generator for async FastAPI projects
# ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
#
# Author: Manav Gupta <manavg@gmail.com>
# Usage: run `make` or `make help` to view available targets
#
# help: FastStack (Hybrid FastAPI framework — runtime core + CLI generator)
#
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
# ─────────────────────────────────────────────────────────────────────────
# Project variables
# ─────────────────────────────────────────────────────────────────────────
PROJECT_NAME := faststack
VENV_DIR := .venv
COVERAGE_MIN := 85
# Directories and files to clean
DIRS_TO_CLEAN := __pycache__ .pytest_cache .mypy_cache .ruff_cache \
htmlcov dist build .eggs *.egg-info
FILES_TO_CLEAN := .coverage coverage.xml
# =============================================================================
# DYNAMIC HELP
# =============================================================================
.PHONY: help
help:
@grep "^# help\:" Makefile | grep -v grep | sed 's/\# help\: //' | sed 's/\# help\://'
.DEFAULT_GOAL := help
# =============================================================================
# help:
# help: 🌱 VIRTUAL ENVIRONMENT & INSTALLATION
# =============================================================================
# help: venv - Create a fresh virtual environment
.PHONY: venv
venv:
python3 -m venv $(VENV_DIR)
$(VENV_DIR)/bin/pip install --upgrade pip
# help: install - Install all dependencies
.PHONY: install
install:
poetry install
# help: install-dev - Full dev setup (venv + deps + pre-commit hooks)
.PHONY: install-dev
install-dev: venv install
poetry run pre-commit install
@echo ""
@echo "✅ Dev environment ready. Run 'make check' to verify."
# help: update - Update dependencies to latest compatible versions
.PHONY: update
update:
poetry update
poetry run pre-commit autoupdate
# =============================================================================
# help:
# help: 🧪 TESTING
# =============================================================================
# help: test - Run tests with coverage (CI gate: fails if <$(COVERAGE_MIN)%)
.PHONY: test
test:
poetry run pytest --cov --cov-fail-under=$(COVERAGE_MIN) --no-header -q || test $$? -eq 5
# help: test-verbose - Run tests with verbose output + coverage
.PHONY: test-verbose
test-verbose:
poetry run pytest --cov
# help: test-single - Run a single test (usage: make test-single K=test_name)
.PHONY: test-single
test-single:
poetry run pytest -k "$(K)"
# help: test-unit - Run only unit tests (core + templates)
.PHONY: test-unit
test-unit:
poetry run pytest -m unit --no-header -q
# help: test-integration - Run only integration tests (CLI commands)
.PHONY: test-integration
test-integration:
poetry run pytest -m integration --no-header -q
# help: test-e2e - Run only e2e tests (full workflow validation)
.PHONY: test-e2e
test-e2e:
poetry run pytest -m e2e --no-header -q
# help: test-fast - Run all tests except slow ones
.PHONY: test-fast
test-fast:
poetry run pytest -m "not slow" --no-header -q
# help: coverage - Generate HTML + XML coverage report
.PHONY: coverage
coverage:
poetry run pytest --cov --cov-report=html --cov-report=xml --no-header -q
@echo "Coverage report: htmlcov/index.html"
# =============================================================================
# help:
# help: 🔍 CODE QUALITY
# =============================================================================
# help: lint - Check linting (ruff + black)
.PHONY: lint
lint:
poetry run ruff check .
poetry run black --check .
# help: format - Auto-format code (ruff fix + black)
.PHONY: format
format:
poetry run ruff check --fix .
poetry run black .
# help: typecheck - Run static type checking (mypy)
.PHONY: typecheck
typecheck:
poetry run mypy faststack_core/ cli/
# help: check - Run all checks: lint + typecheck + test (CI gate)
.PHONY: check
check: lint typecheck test
# help: pre-commit - Run pre-commit hooks on all files
.PHONY: pre-commit
pre-commit:
poetry run pre-commit run --all-files
# help: pre-commit-install - Install pre-commit hooks into .git/hooks
.PHONY: pre-commit-install
pre-commit-install:
poetry run pre-commit install
# =============================================================================
# help:
# help: 🧹 CLEANUP
# =============================================================================
# help: clean - Remove build artifacts and caches
.PHONY: clean
clean:
@echo "🧹 Cleaning workspace..."
@find . -type d \( -name __pycache__ -o -name .pytest_cache -o -name .mypy_cache -o -name .ruff_cache -o -name htmlcov -o -name "*.egg-info" \) -exec rm -rf {} + 2>/dev/null || true
@rm -rf dist/ build/ .coverage coverage.xml
@echo "✅ Clean complete."
# help: clean-all - Remove everything including virtual environment
.PHONY: clean-all
clean-all: clean
@echo "🗑️ Removing virtual environment..."
@rm -rf $(VENV_DIR)
@echo "✅ Full clean complete."