-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
164 lines (141 loc) · 3.87 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#Ensure the script is run as bash
SHELL:=/bin/bash
#Set help as the default for this makefile.
.DEFAULT: help
help:
@echo "Please use 'make <target>' where <target> is one of:"
@echo ""
@echo "venv Create a virtual environment"
@echo "install Install the package and all required core dependencies"
@echo "run Running the app locally"
@echo "deploy-deta Deploy the app on a Deta Micro"
@echo "clean Remove all build, test, coverage and Python artifacts"
@echo "lint Check style with pre-commit"
@echo "test Run tests quickly with pytest"
@echo "test-all Run tests on every Python version with tox"
@echo "build Build docker containers services"
@echo "up Spin up the built containers"
@echo "down Stop all running containers"
@echo "coverage Check code coverage quickly with the default Python"
clean: clean-build clean-pyc clean-test
generate_dot_env:
@if [[ ! -e .env ]]; then \
cp .env.example .env; \
fi
clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test:
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
venv:
@echo ""
@echo "*** make virtual env ***"
@echo ""
(rm -rf .venv; python3 -m venv .venv; source .venv/bin/activate;)
@echo ""
@echo "please activate your virtualenv by running:"
@echo "source .venv/bin/activate"
@echo ""
lint:
@echo ""
@echo "*** Running formatters locally... ***"
@echo ""
@echo ""
tox -ve lint
@echo ""
test:
@echo ""
@echo "*** Running tests locally... ***"
@echo ""
@echo ""
tox -e test
@echo ""
test-all:
@echo ""
@echo "*** Running tests, formatters... ***"
@echo ""
@echo ""
tox
@echo ""
coverage:
@echo ""
@echo "*** Checking code coverage, and generating a report... ***"
@echo ""
@echo ""
tox -e coverage
poetry run $(BROWSER) htmlcov/index.html
@echo ""
install: generate_dot_env
@echo ""
@echo "*** Generating a .env file and installing the required dependencies... ***"
@echo ""
@echo ""
: `curl -sSL https://install.python-poetry.org | python3 - --uninstall`
: `rm -rf /home/${USER}/.poetry`
: `rm -rf /home/${USER}/.pyenv/shims/poetry`
curl -sSL https://install.python-poetry.org | python3 - --version 1.6.1
poetry install --only main
@echo ""
docker-install:
@echo ""
@echo "*** installing the required dependencies... ***"
@echo ""
@echo ""
: `curl -sSL https://install.python-poetry.org | python3 - --uninstall`
: `rm -rf /home/${USER}/.poetry`
: `rm -rf /home/${USER}/.pyenv/shims/poetry`
curl -sSL https://install.python-poetry.org | python3 - --version 1.6.1
/root/.local/bin/poetry install --only main --no-root
@echo ""
docker-run:
@echo ""
@echo "*** Running the app locally... ***"
@echo ""
@echo ""
/root/.local/bin/poetry run server
@echo ""
run:
@echo ""
@echo "*** Running the app locally... ***"
@echo ""
@echo ""
poetry run server
@echo ""
deploy-deta:
@echo ""
@echo "*** Deploying the app on a Deta Micros... ***"
@echo ""
@echo "*** Running `deta login`... ***"
deta login
@echo "*** Running `deta new .`... ***"
deta new .
@echo "*** Running `deta deploy`... ***"
deta deploy
@echo "*** Running `deta auth disable`... ***"
deta auth disable
@echo "*** Running `deta update -e .env`... ***"
deta update -e .env
@echo ""
dist: clean ## builds source and wheel package
poetry build
build:
docker compose --file docker-compose.yml build
up:
docker compose up
down:
docker compose down
version-major:
bump2version major
version-minor:
bump2version minor