-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
75 lines (59 loc) · 2.35 KB
/
Makefile
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
# Define the commands
SETUP_CMD = pip3 install -e .[dev,doc]
SETUP_TEST_CMD = pip3 install -e .[dev]
CLEAN_CMD = rm -rf .coverage* && rm -rf .pytest_cache && rm -rf build && rm -rf dist && rm -rf htmlcov && rm -rf site && find . -type d -name __pycache__ | xargs rm -rf
FORMAT_CMD = python3 -m ruff --fix-only src tests ; black ./src
# TODO introduce dependency security check
# TODO introduce breaking API changes check
CHECK_CMD = python3 -m ruff check src tests
TEST_CMD = python -m coverage run -m pytest tests/*.py && python -m coverage report && python -m coverage html
ORM_CMD = alembic revision --autogenerate -m "Autogenerated model update"
ORM_UPGRADE_CMD = alembic upgrade heads
DOCS_CMD = mkdir -p htmlcov/ && touch htmlcov/index.html && mkdir -p docs/.overrides && python3 ./scripts/gen_plugin_docs.py && python3 ./scripts/gen_platform_docs.py && mkdocs build -vs
DOCS_SERVE_CMD = mkdir -p htmlcov/ && touch htmlcov/index.html && mkdir -p docs/.overrides && python3 ./scripts/gen_plugin_docs.py && python3 ./scripts/gen_platform_docs.py && mkdocs serve -s
POETRY_SETUP_CMD = poetry install --all-extras --sync
POETRY_PUBLISH_CMD = poetry build && poetry publish
CHANGELOG_CMD = git-changelog -c angular -t keepachangelog -s build,deps,feat,fix,refactor,docs -i -o CHANGELOG.md -T --bump=auto .
RELEASE_CMD = git add pyproject.toml CHANGELOG.md && git commit -m "chore: prepare release $(version)" && git tag $(version) && git push && git push --tags
.PHONY: setup setup-test setup-poetry clean format check test docs orm orm-upgrade changelog publish release
# Default target
all: format check test orm build-docs
# Command targets
setup:
@$(SETUP_CMD)
setup-test:
@$(SETUP_TEST_CMD)
setup-poetry:
@$(POETRY_SETUP_CMD)
clean:
@$(CLEAN_CMD)
format:
@$(FORMAT_CMD)
check:
@$(CHECK_CMD)
test:
@$(TEST_CMD)
build-docs:
@$(DOCS_CMD)
docs:
@$(DOCS_SERVE_CMD)
orm:
@if git diff --name-only | grep -q 'src/nendo/library/model.py'; then \
echo "Detected changes in db/model.py. Creating alembic auto-migration..."; \
$(ORM_CMD); \
else \
echo "No changes to model. Skipping alembic auto-migration."; \
exit 0; \
fi
orm-upgrade:
@$(ORM_UPGRADE_CMD)
changelog:
@$(CHANGELOG_CMD)
release:
@if [ -z "$(version)" ]; then \
echo "Please specify a version number (e.g., make release version=0.1.1)"; \
exit 1; \
fi
@$(RELEASE_CMD)
publish:
@$(POETRY_PUBLISH_CMD)