-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
53 lines (41 loc) · 1.67 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
.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 --extras anyio
git init .
poetry run pre-commit install --install-hooks
touch .init
.clean:
rm -rf .init .pytest_cache
poetry -V || rm -rf .install-poetry
init: .clean .init
@echo ---- 🔧 Re-initialized project ----
lint: .init
poetry run ruff --fix di tests docs_src
poetry run black di tests docs_src
poetry run mypy di tests
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-build: .init
@echo ---- 🏗️ Building docs ----
@poetry run mkdocs build
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)