-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
72 lines (59 loc) · 1.59 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
all: setup version format mypy cov pylint flake8 doc
.PHONY: setup
setup:
poetry install
.PHONY: format
format:
poetry run isort .
poetry run autopep8 -r --in-place .
.PHONY: pylint
pylint:
poetry run pylint authl tests
.PHONY: flake8
flake8:
poetry run flake8
.PHONY: mypy
mypy:
poetry run mypy -p authl -m test_app --ignore-missing-imports
.PHONY: preflight
preflight:
@echo "Checking commit status..."
@git status --porcelain | grep -q . \
&& echo "You have uncommitted changes" 1>&2 \
&& exit 1 || exit 0
@echo "Checking branch..."
@[ "$(shell git rev-parse --abbrev-ref HEAD)" != "main" ] \
&& echo "Can only build from main" 1>&2 \
&& exit 1 || exit 0
@echo "Checking upstream..."
@git fetch \
&& [ "$(shell git rev-parse main)" != "$(shell git rev-parse main@{upstream})" ] \
&& echo "main differs from upstream" 1>&2 \
&& exit 1 || exit 0
.PHONY: test
test:
poetry run coverage run -m pytest -vv -Werror
.PHONY: cov
cov: test
poetry run coverage html
poetry run coverage report
.PHONY: version
version: authl/__version__.py
authl/__version__.py: pyproject.toml
# Kind of a hacky way to get the version updated, until the poetry folks
# settle on a better approach
printf '""" version """\n__version__ = "%s"\n' \
`poetry version | cut -f2 -d\ ` > authl/__version__.py
.PHONY: build
build: version preflight pylint flake8
poetry build
.PHONY: clean
clean:
rm -rf build dist .mypy_cache docs/_build
find . -type d -name __pycache__ -print0 | xargs -0 rm -r
.PHONY: upload
upload: clean build
poetry publish
.PHONY: doc
doc:
poetry run sphinx-build -b html docs/ docs/_build