-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
147 lines (126 loc) · 4.21 KB
/
Makefile
File metadata and controls
147 lines (126 loc) · 4.21 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
# ELF Development Makefile
# Common development tasks for the ELF project
.PHONY: help install install-dev clean test test-cov lint format typecheck security pre-commit docs build release
# Default target
help:
@echo "ELF Development Commands:"
@echo ""
@echo "Setup:"
@echo " make install Install ELF in development mode"
@echo " make install-dev Install with development dependencies"
@echo " make clean Clean build artifacts and caches"
@echo ""
@echo "Code Quality:"
@echo " make lint Run linting with ruff"
@echo " make format Format code with ruff"
@echo " make typecheck Run type checking with mypy"
@echo " make security Run security scans"
@echo " make pre-commit Run all pre-commit hooks"
@echo ""
@echo "Testing:"
@echo " make test Run test suite"
@echo " make test-cov Run tests with coverage report"
@echo " make test-fast Run tests (skip slow tests)"
@echo ""
@echo "Documentation:"
@echo " make docs Build documentation"
@echo " make docs-serve Serve docs locally"
@echo ""
@echo "Build & Release:"
@echo " make build Build distribution packages"
@echo " make release Create a new release"
@echo ""
@echo "Examples:"
@echo " make examples Validate example workflows"
# Setup commands
install:
uv pip install -e .
install-dev:
uv pip install -e .
uv pip install --group dev --group test --group docs
clean:
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type d -name "*.egg-info" -exec rm -rf {} +
find . -type d -name "*.egg" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.pyd" -delete
find . -type f -name ".coverage" -delete
find . -type d -name "*.egg" -exec rm -rf {} +
find . -type d -name "build" -exec rm -rf {} +
find . -type d -name "dist" -exec rm -rf {} +
find . -type d -name ".pytest_cache" -exec rm -rf {} +
find . -type d -name ".coverage" -exec rm -rf {} +
find . -type d -name "htmlcov" -exec rm -rf {} +
find . -type d -name ".mypy_cache" -exec rm -rf {} +
find . -type d -name ".ruff_cache" -exec rm -rf {} +
find . -type d -name ".hypothesis" -exec rm -rf {} +
# Code quality
lint:
uv run ruff check src/ tests/
format:
uv run ruff format src/ tests/
uv run ruff check --fix src/ tests/
typecheck:
uv run mypy src/
security:
uv run bandit -r src/
uv run safety check
pre-commit:
uv run pre-commit run --all-files
# Testing
test:
uv run pytest tests/ -v
test-cov:
uv run pytest tests/ -v --cov=src/elf --cov-report=html --cov-report=term-missing
test-fast:
uv run pytest tests/ -v -m "not slow"
# Documentation
docs:
@echo "Building documentation..."
@python -c "import markdown; print('README validation: OK')"
docs-serve:
@echo "Documentation serving not implemented yet"
@echo "Use: python -m http.server 8000 -d docs/"
# Build and release
build: clean
python -m build
release: clean test lint typecheck
@echo "Creating release..."
@echo "1. Run tests and quality checks: ✓"
@echo "2. Update version in src/elf/__init__.py"
@echo "3. Update CHANGELOG.md"
@echo "4. Commit changes: git commit -am 'Release vX.Y.Z'"
@echo "5. Create tag: git tag vX.Y.Z"
@echo "6. Push: git push && git push --tags"
@echo "7. GitHub Actions will handle the rest"
# Examples validation
examples:
@echo "Validating example workflows..."
@python -c "
import yaml
from pathlib import Path
specs_dir = Path('specs/examples')
if specs_dir.exists():
for yaml_file in specs_dir.glob('*.yaml'):
try:
with open(yaml_file, 'r') as f:
yaml.safe_load(f)
print(f'✓ {yaml_file.name}')
except yaml.YAMLError as e:
print(f'✗ {yaml_file.name}: {e}')
exit(1)
print('All examples validated successfully!')
else:
print('No examples directory found')
"
# Development workflow
dev: install-dev pre-commit test
@echo "Development environment ready!"
@echo "Run 'make help' for available commands"
# Continuous integration simulation
ci: lint typecheck security test
@echo "CI checks passed!"
# Quick check before commit
check: format lint typecheck test-fast
@echo "Pre-commit checks passed!"