-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
101 lines (63 loc) · 2.24 KB
/
Makefile
File metadata and controls
101 lines (63 loc) · 2.24 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
.PHONY: clean \
clean-dev update-dev-req install-dev-req install touch-dev \
check format check-format lint check-typing clean-test test-wo-install test \
clean-doc doc \
clean-build build-release check-release release
VIRTUAL_ENV = .venv
DEV_BUILD_FLAG = $(VIRTUAL_ENV)/DEV_BUILD_FLAG
clean: clean-dev clean-test clean-doc clean-build
# init
clean-dev:
rm -rf $(VIRTUAL_ENV)
update-dev-req: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/pip-compile --upgrade dev-requirements.in
install-dev-req:
$(VIRTUAL_ENV)/bin/pip install -r dev-requirements.txt
install:
$(VIRTUAL_ENV)/bin/python setup.py install
touch-dev:
touch $(DEV_BUILD_FLAG)
dev: $(DEV_BUILD_FLAG)
$(DEV_BUILD_FLAG):
python3 -m venv $(VIRTUAL_ENV)
$(VIRTUAL_ENV)/bin/python -m pip install --upgrade pip
$(MAKE) -f Makefile install
$(MAKE) -f Makefile install-dev-req
$(VIRTUAL_ENV)/bin/pre-commit install --hook-type pre-commit --hook-type pre-push
$(MAKE) -f Makefile touch-dev
# ci
check: check-format lint check-typing test
format: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/black src tests setup.py
check-format: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/black --check src tests setup.py
lint: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/pylint src tests setup.py
check-typing: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/mypy src tests setup.py
clean-test:
rm -rf tests/.unittest
rm -rf docs/coverage
test-wo-install: $(DEV_BUILD_FLAG)
rm -rf tests/.unittest
mkdir -p docs/coverage
$(VIRTUAL_ENV)/bin/coverage run --data-file docs/coverage/.coverage --branch --source writecondastat -m unittest discover tests
$(VIRTUAL_ENV)/bin/coverage html --data-file docs/coverage/.coverage -d docs/coverage
$(VIRTUAL_ENV)/bin/coverage report --data-file docs/coverage/.coverage -m --fail-under=100
test: $(DEV_BUILD_FLAG) install test-wo-install
# doc
clean-doc:
rm -rf docs
doc: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/pdoc --docformat google src/writecondastat -o docs
# release
clean-build:
rm -rf build
rm -rf dist
rm -rf `find . -name '*.egg-info'`
rm -rf `find . -name '__pycache__'`
build-release: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/python -m build
check-release: $(DEV_BUILD_FLAG)
$(VIRTUAL_ENV)/bin/python -m twine check dist/*.tar.gz dist/*.whl
release: clean-build build-release check-release