-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
95 lines (78 loc) · 1.95 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
PORT:=8083
DEVEL_BRANCH="devel"
# https://github.com/sio/Makefile.venv
# Seamlessly manage Python virtual environment with a Makefile
Makefile.venv:
curl \
-o Makefile.fetched \
-L "https://github.com/sio/Makefile.venv/raw/v2023.04.17/Makefile.venv"
echo "fb48375ed1fd19e41e0cdcf51a4a0c6d1010dfe03b672ffc4c26a91878544f82 *Makefile.fetched" \
| sha256sum --check - \
&& mv Makefile.fetched Makefile.venv
include Makefile.venv
.PHONY: help
# target: help - Display callable targets
help:
@egrep "^# target:" [Mm]akefile
.PHONY: install
# target: install - Install pip requirements
install: Makefile.venv $(VENV)
$(VENV)/pip install -r requirements.txt
.PHONY: clean
# target: clean - Clean repo
clean:
@rm -rf build dist docs/_build
find $(CURDIR) -name "*.pyc" -delete
find $(CURDIR) -name "*.orig" -delete
find $(CURDIR) -name "__pycache__" | xargs rm -rf
# ==============
# Bump version
# ==============
.PHONY: release
VERSION?=minor
# target: release - Bump version
release:
$(VENV)/pip install bumpversion
$(VENV)/bumpversion $(VERSION)
@git checkout master
@git merge $(DEVEL_BRANCH)
@git checkout $(DEVEL_BRANCH)
@git push --all
@git push --tags
.PHONY: minor
minor: release
.PHONY: patch
patch:
make release VERSION=patch
.PHONY: major
major:
make release VERSION=major
# ===========
# Development
# ===========
.PHONY: test
# target: test - Runs tests with pytest
test:
@$(VENV)/pytest
.PHONY: cov
# target: cov - short alias for `coverage`
cov: coverage
.PHONY: coverage
# target: coverage - create test coverage report
coverage:
$(VENV)/coverage run \
--source=telega \
-m pytest
$(VENV)/coverage report
.PHONY: run
run:
DEBUG=$(DEBUG)
$(VENV)/uvicorn telega.app:app --port ${PORT}
.PHONY: login
# target: login - Log into telegram account and create session file.
login:
$(VENV)/python3 login.py
.PHONY: bak
# target: bak - Create session backup
bak:
gzip --best --stdout *.session > session-backup-$(shell date +%Y-%m-%d).gz