-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (37 loc) · 1.66 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
.PHONY: install-poetry .clean test test-mutation docs-build docs-serve
GIT_SHA = $(shell git rev-parse --short HEAD)
PACKAGE_VERSION = $(shell poetry version -s | cut -d+ -f1)
.install-poetry:
@echo "---- 👷 Installing build dependencies ----"
deactivate > /dev/null 2>&1 || true
poetry -V || pip install -U poetry
touch .install-poetry
install-poetry: .install-poetry
.init: .install-poetry
@echo "---- 📦 Building package ----"
rm -rf .venv
poetry install
git init .
poetry run pre-commit install --install-hooks
touch .init
.clean:
rm -rf .init .mypy_cache .pytest_cache
poetry -V || rm -rf .install-poetry
init: .clean .init
@echo ---- 🔧 Re-initialized project ----
lint: .init
@echo ---- ⏳ Running linters ----
@(poetry run pre-commit run --all-files && echo "---- ✅ Linting passed ----" && exit 0|| echo "---- ❌ Linting failed ----" && exit 1)
test: .init
@echo ---- ⏳ Running tests ----
@(poetry run pytest -v --cov --cov-report term && echo "---- ✅ Tests passed ----" && exit 0 || echo "---- ❌ Tests failed ----" && exit 1)
test-mutation: .init
@echo ---- ⏳ Running mutation testing ----
@poetry run python -m pip install mutmut
@(poetry run pytest --cov && poetry run mutmut run --use-coverage && echo "---- ✅ Passed ----" && exit 0 || echo "---- ❌ Failed ----" && exit 1)
docs-serve: .init
@echo ---- 📝 Serving docs ----
@poetry run mkdocs serve --dev-addr localhost:8001
docs-deploy: .init
@echo ---- 🚀 Deploying docs ----
@(poetry run mike deploy --push --update-aliases --branch gh-docs $(shell poetry version -s) latest && echo "---- ✅ Deploy succeeded ----" && exit 0 || echo "---- ❌ Deploy failed ----" && exit 1)