Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (63 loc) · 2.79 KB
/
Copy pathMakefile
File metadata and controls
79 lines (63 loc) · 2.79 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
.PHONY: help install test coverage lint format type-check clean all commit bump pre-commit test-integration integration-coverage docs docs-serve
help:
@echo "Available commands:"
@echo " make install - Install dependencies"
@echo " make test - Run tests (excludes 'staging' by default)"
@echo " make coverage - Run tests with coverage"
@echo " make test-integration - Run only staging integration tests"
@echo " make integration-coverage - Run staging tests with coverage"
@echo " make lint - Run ruff checks"
@echo " make format - Format code with ruff"
@echo " make type-check - Run mypy type checking"
@echo " make clean - Remove cache and build files"
@echo " make all - Run pre-commit on all files, then tests"
@echo " make pre-commit - Run pre-commit hooks on all files"
@echo " make commit - Create a conventional commit using commitizen"
@echo " make bump - Bump version and update changelog"
@echo " make docs - Generate API docs with pdoc into ./docs"
@echo " make docs-serve - Serve API docs locally with pdoc"
install:
poetry install
test:
poetry run pytest tests/unit/ -v --cov=databrarypy --cov-report=term-missing
coverage:
poetry run pytest tests/unit/ -v --cov=databrarypy --cov-report=term-missing --cov-report=json --cov-fail-under=80
@COVERAGE=$$(poetry run python -c "import json; print(json.load(open('coverage.json'))['totals']['percent_covered'])"); \
echo "Coverage: $${COVERAGE}%"; \
if [ $$(echo "$${COVERAGE} < 80" | bc -l) -eq 1 ]; then \
echo "❌ Coverage is below 80% ($${COVERAGE}%)"; \
exit 1; \
elif [ $$(echo "$${COVERAGE} < 90" | bc -l) -eq 1 ]; then \
echo "⚠️ Warning: Coverage is below 90% ($${COVERAGE}%)"; \
else \
echo "✅ Coverage is above 90% ($${COVERAGE}%)"; \
fi
test-integration:
poetry run pytest -s tests/integration
integration-coverage:
poetry run pytest -s tests/integration --cov=databrarypy --cov-report=term-missing
lint:
poetry run ruff check src/ tests/
format:
poetry run ruff check --fix src/ tests/
poetry run ruff format src/ tests/
type-check:
poetry run mypy src/
clean:
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
rm -rf dist/ build/ *.egg-info .coverage htmlcov/ coverage.json
all: pre-commit test
pre-commit:
poetry run pre-commit run --all-files
commit:
poetry run cz commit
bump:
poetry run cz bump
docs:
poetry run pdoc -d google -o docs src/databrarypy
docs-serve:
poetry run pdoc -d google -h 127.0.0.1 -p 8080 src/databrarypy