-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
62 lines (51 loc) · 1.33 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
all: setup format mypy cov pylint flake8
.PHONY: setup
setup:
@echo "Current version: $(shell ./get-version.sh)"
poetry install -E auth -E search
.PHONY: format
format:
poetry run isort .
poetry run autopep8 -r --in-place .
.PHONY: pylint
pylint:
poetry run pylint publ tests
.PHONY: flake8
flake8:
poetry run flake8
.PHONY: mypy
mypy:
poetry run mypy -p publ -m tests --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 branch differs from upstream" 1>&2 \
&& exit 1 || exit 0
.PHONY: test
test:
FLASK_APP=test_app.py poetry run flask publ reindex
poetry run coverage run -m pytest
.PHONY: cov
cov: test
poetry run coverage html
poetry run coverage report
.PHONY: build
build: preflight pylint flake8
poetry build
.PHONY: clean
clean:
rm -rf dist .mypy_cache .pytest_cache .coverage
find . -name __pycache__ -print0 | xargs -0 rm -r
.PHONY: upload
upload: clean test build
poetry publish