-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (54 loc) · 2.27 KB
/
Copy pathMakefile
File metadata and controls
68 lines (54 loc) · 2.27 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
.PHONY: init test lint pretty precommit_install bump_major bump_minor bump_patch docs
# if BIN not provided, try to detect the binary from the environment
PYTHON_INSTALL := $(shell python3 -c 'import sys;print(sys.executable)')
BIN ?= $(shell [ -e .venv/bin ] && echo `pwd`/'.venv/bin' || dirname $(PYTHON_INSTALL))/
CODE = sqredirect
help: ## This help dialog.
@IFS=$$'\n' ; \
help_lines=(`fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##/:/'`); \
printf "%-15s %s\n" "target" "help" ; \
printf "%-15s %s\n" "------" "----" ; \
for help_line in $${help_lines[@]}; do \
IFS=$$':' ; \
help_split=($$help_line) ; \
help_command=`echo $${help_split[0]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
help_info=`echo $${help_split[2]} | sed -e 's/^ *//' -e 's/ *$$//'` ; \
printf '\033[36m'; \
printf "%-15s %s" $$help_command ; \
printf '\033[0m'; \
printf "%s\n" $$help_info; \
done
init:
python3 -m venv .venv
poetry install
test: ## Запуск тестов
$(BIN)python -m pytest --cov=$(CODE) $(args)
lint: ## Проверка кода (linting)
$(BIN)flake8 --jobs 4 --statistics --show-source $(CODE) tests
$(BIN)black --target-version=py37 --skip-string-normalization --line-length=120 --check $(CODE) tests
#$(BIN)python -m pytest --dead-fixtures --dup-fixtures # disabled due _old_style_conf_d_globals detected as unused
pretty: ## Автоформатирование согласно code-style
$(BIN)isort $(CODE) tests
$(BIN)black --target-version=py37 --skip-string-normalization --line-length=120 $(CODE) tests
$(BIN)unify --in-place --recursive $(CODE) tests
precommit_install: ## Установка pre-commit хука с проверками code-style и мелкими авто-справлениеями
echo '#!/bin/sh' > .git/hooks/pre-commit
echo "exec make lint test BIN=$(BIN)" >> .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
bump_major:
$(BIN)bumpversion major
$(BIN)python3 update_setup.py
git add setup.py
git commit --amend --no-edit
bump_minor:
$(BIN)bumpversion minor
$(BIN)python3 update_setup.py
git add setup.py
git commit --amend --no-edit
bump_patch:
$(BIN)bumpversion patch
$(BIN)python3 update_setup.py
git add setup.py
git commit --amend --no-edit
publish:
git push origin master --tags