86 lines
2.8 KiB
Makefile
86 lines
2.8 KiB
Makefile
# Fjerkroa Bot Development Makefile (uv-managed)
|
|
|
|
.PHONY: help install install-dev clean test test-cov test-fast lint format format-check type-check security-check audit trace check all-checks pre-commit run run-dev build ci
|
|
|
|
# Default target
|
|
help: ## Show this help message
|
|
@echo "Fjerkroa Bot Development Commands:"
|
|
@echo ""
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
|
|
|
# Installation targets
|
|
install: ## Sync production dependencies
|
|
uv sync --no-dev
|
|
|
|
install-dev: ## Sync all dependencies and install pre-commit hooks
|
|
uv sync
|
|
uv run pre-commit install
|
|
|
|
# Cleaning targets
|
|
clean: ## Clean up temporary files and caches
|
|
find . -type f -name "*.pyc" -delete
|
|
find . -type d -name "__pycache__" -delete
|
|
find . -type d -name "*.egg-info" -exec rm -rf {} +
|
|
find . -type d -name ".pytest_cache" -exec rm -rf {} +
|
|
find . -type d -name ".mypy_cache" -exec rm -rf {} +
|
|
find . -name ".coverage" -delete
|
|
rm -rf build dist htmlcov
|
|
|
|
# Testing targets
|
|
test: ## Run tests
|
|
uv run pytest -v
|
|
|
|
test-cov: ## Run tests with coverage report
|
|
uv run pytest --cov=fjerkroa_bot --cov-report=html --cov-report=term-missing
|
|
|
|
test-fast: ## Run tests without slow tests
|
|
uv run pytest -v -m "not slow"
|
|
|
|
# Code quality targets
|
|
lint: ## Run linter (flake8)
|
|
uv run flake8 fjerkroa_bot tests
|
|
|
|
format: ## Format code with black and isort
|
|
uv run black fjerkroa_bot tests
|
|
uv run isort fjerkroa_bot tests
|
|
|
|
format-check: ## Check if code is properly formatted
|
|
uv run black --check fjerkroa_bot tests
|
|
uv run isort --check-only fjerkroa_bot tests
|
|
|
|
type-check: ## Run type checker (mypy)
|
|
uv run mypy fjerkroa_bot tests
|
|
|
|
security-check: ## Run security scanner (bandit)
|
|
uv run bandit -r fjerkroa_bot --configfile pyproject.toml
|
|
|
|
audit: ## Audit locked dependencies for known CVEs
|
|
uv export --no-dev --no-emit-project --format requirements-txt | uv run pip-audit -r /dev/stdin --disable-pip
|
|
|
|
trace: ## Verify spec requirement coverage (SDD/BDD/TDD)
|
|
uv run python tools/trace.py
|
|
|
|
# Combined targets
|
|
check: lint format-check type-check security-check trace test ## The gate: all quality checks + spec trace + tests
|
|
all-checks: check audit ## check + dependency audit
|
|
|
|
pre-commit: format lint type-check security-check test ## Run all pre-commit checks (format, then check)
|
|
|
|
# Development targets
|
|
run: ## Run the bot (requires config.toml)
|
|
uv run python -m fjerkroa_bot
|
|
|
|
run-dev: ## Run the bot in development mode with auto-reload
|
|
uv run watchmedo auto-restart --patterns="*.py" --recursive -- python -m fjerkroa_bot
|
|
|
|
# Build targets
|
|
build: clean ## Build distribution packages
|
|
uv build
|
|
|
|
# CI targets
|
|
ci: install-dev all-checks ## Full CI pipeline (install deps and run all checks)
|
|
|
|
# Deploy targets (SPEC-007)
|
|
deploy: ## Deploy a tag to a host: make deploy HOST=ggg TAG=v3.0.0
|
|
bash deploy/deploy.sh $(HOST) $(TAG)
|