-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
131 lines (93 loc) · 2.01 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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
PYTHON_TEST_COMMAND=pytest
ifeq ($(OS),Windows_NT)
OPEN_FILE_COMMAND=start
DEL_COMMAND=del
else
OPEN_FILE_COMMAND=xdg-open
DEL_COMMAND=gio trash
endif
SYNC=--sync
.PHONY: build
# Install
upgrade-pip:
pip install --upgrade pip
install-ci: upgrade-pip
pip install poetry==1.7.1
poetry config virtualenvs.create false
install-run:
poetry install --only main
install-test:
poetry install --only main --only test --extras web
install-lint:
poetry install --only lint
install-dev: upgrade-pip
poetry install --all-extras $(SYNC)
pre-commit install
install: lock-check install-dev lint cover
# Poetry
lock:
poetry lock --no-update
lock-check:
poetry check --lock
# Test
test:
python -m $(PYTHON_TEST_COMMAND)
test-fast:
python -m $(PYTHON_TEST_COMMAND) -m "not web"
cover-base:
coverage run -m $(PYTHON_TEST_COMMAND) $(COVERAGE_EXTRA)
cover-xml: cover-base
coverage xml
coverage report
cover-html: cover-base
coverage html
coverage report
cover: cover-html
$(OPEN_FILE_COMMAND) htmlcov/index.html > /dev/null 2>&1 &
$(DEL_COMMAND) .coverage*
cover-fast:
@make cover COVERAGE_EXTRA="-m 'not web'"
# Packaging
build:
$(DEL_COMMAND) -f dist/*
poetry build
upload-test:
twine upload --repository testpypi dist/*
upload:
twine upload dist/*
build-and-upload: build upload
# Semantic release
semrel:
@echo "Releasing version..."
semantic-release version
semrel-dev:
@echo "Releasing dev version..."
semantic-release version --no-commit --no-push
# Replace "-dev.1" with epoch time in version
sed -i 's/-dev.1/.dev.$(shell date +%s)/g' pyproject.toml
make build
# Lint
format:
black .
isort .
ruff check --fix
check-ruff:
ruff check
check-black:
black --check .
check-isort:
isort --check .
check-mypy:
mypy .
check-pylint:
pylint codenames/ --fail-under=10
lint: format
pre-commit run --all-files
@make check-pylint --no-print-directory
# Quick and dirty
wip: format
git add .
git commit -m "Auto commit." --no-verify
amend: format
git add .
git commit --amend --no-edit --no-verify