-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
127 lines (101 loc) · 3 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
#!make
.PHONY: clean-pyc clean-build
.DEFAULT_GOAL := help
SHELL = /bin/bash
PYPACKAGE = fastapi_plugins
help:
@echo ""
@echo " +---------------------------------------+"
@echo " | ${PYPACKAGE} |"
@echo " +---------------------------------------+"
@echo " clean"
@echo " Remove python and build artifacts"
@echo " install"
@echo " Install requirements for development and testing"
@echo " demo"
@echo " Run a simple demo"
@echo ""
@echo " test"
@echo " Run unit tests"
@echo " test-all"
@echo " Run integration tests"
@echo ""
clean-pyc:
@echo $@
find ./${PYPACKAGE} -name '*.pyc' -exec rm --force {} +
find ./${PYPACKAGE} -name '*.pyo' -exec rm --force {} +
find ./${PYPACKAGE} -name '*~' -exec rm --force {} +
clean-build:
@echo $@
rm --force --recursive .tox/
rm --force --recursive build/
rm --force --recursive dist/
rm --force --recursive *.egg-info
rm --force --recursive .pytest_cache/
clean-docker:
@echo $@
docker container prune -f
clean-pycache:
@echo $@
find . -name '__pycache__' -exec rm -rf {} +
clean: clean-build clean-docker clean-pyc clean-pycache
install: clean
@echo $@
pip install --no-cache-dir -U pip setuptools twine wheel
pip install --no-cache-dir -U --force-reinstall -r requirements.txt
rm -rf build *.egg-info
pip uninstall ${PYPACKAGE} -y || true
demo: clean
@echo $@
python demo.py
demo-app: clean
@echo $@
uvicorn scripts.demo_app:app
flake: clean
@echo $@
flake8 --statistics --ignore E252 ${PYPACKAGE} tests scripts setup.py
bandit: clean
@echo $@
bandit -r ${PYPACKAGE}/ scripts/ demo.py setup.py
bandit -s B101 -r tests/
test-unit-pytest:
@echo $@
python -m pytest -v -x tests/ --cov=${PYPACKAGE}
test-unit: clean flake bandit docker-up-test test-unit-pytest docker-down-test
@echo $@
test-toxtox:
@echo $@
tox -vv
test-tox: clean docker-up-test test-toxtox docker-down-test
@echo $@
test: test-unit
@echo $@
test-all: clean flake bandit docker-up-test test-unit-pytest test-toxtox docker-down-test
@echo $@
pypi-build: clean test-all
@echo $@
python setup.py sdist bdist_wheel
twine check dist/*
pypi-upload-test:
@echo $@
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
pypi-upload:
@echo $@
python -m twine upload dist/*
docker-build-dev:
@echo $@
docker compose -f docker-compose.memcached.yml -f docker-compose.sentinel.yml build
docker-up: clean-docker
@echo $@
docker compose build --force-rm --no-cache --pull && docker compose -f docker-compose.yml -f docker-compose.redis.yml -f docker-compose.memcached.yml up --build
docker-up-dev: clean-docker docker-build-dev
@echo $@
docker compose -f docker-compose.memcached.yml -f docker-compose.sentinel.yml up
docker-up-test: clean-docker docker-build-dev
@echo $@
docker compose -f docker-compose.memcached.yml -f docker-compose.sentinel.yml up -d
sleep 5
docker ps
docker-down-test:
@echo $@
docker compose -f docker-compose.memcached.yml -f docker-compose.sentinel.yml down