-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (52 loc) · 1.83 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
.PHONY: run kill docker-build docker-run docker-stop docker-rm lint clear-records test test-cov clean
APP_NAME=fl-service
PORT=8000
TEST_CMD=pytest tests/
COV_DIR=.coverage
HTML_COV_DIR=htmlcov/
DOCKER_IMAGE_NAME=fl-service
DOCKER_CONTAINER_NAME=fl-service
START_DIR = app
START_FASTAPI_SOURCE = main
VAR_NAME = app
LOG_LEVEL = --log-level debug
# $(LOG_LEVEL)
run:
uvicorn ${START_DIR}.${START_FASTAPI_SOURCE}:${VAR_NAME} --host 0.0.0.0 --reload --port ${PORT}
kill:
ps aux | grep uvicorn | grep -v grep | awk '{print $$2}' | xargs kill -SIGINT
# docker-build:
# docker build -t ${DOCKER_IMAGE_NAME} .
# docker-run:
# docker run -d -p ${PORT}:${PORT} --name ${DOCKER_CONTAINER_NAME} ${DOCKER_IMAGE_NAME}
# docker-stop:
# docker stop ${DOCKER_CONTAINER_NAME}
# docker-rm:
# docker rm ${DOCKER_CONTAINER_NAME}
lint:
autoflake --in-place --remove-all-unused-imports --recursive .
black .
isort .
clear-records:
rm -d sql_app.db 2>/dev/null || true
find ./app/ansible/inventory -mindepth 1 -type d -exec rm -rf {} +
# test:
# ${TEST_CMD}
# test-cov:
# pytest --cov-report term-missing --cov=${APP_NAME} tests/
# coverage html -d ${HTML_COV_DIR} --omit="${APP_NAME}/__init__.py"
clean:
rm -rf .pytest_cache .coverage htmlcov
help:
@echo "Available commands:"
@echo " run Run the application locally"
@echo " kill Kill the application which is running in the background"
# @echo " docker-build Build the Docker image"
# @echo " docker-run Run the application with Docker"
# @echo " docker-stop Stop the Docker container"
# @echo " docker-rm Remove the Docker container"
# @echo " test Run the tests"
# @echo " test-cov Run the tests with code coverage"
@echo " lint Run the linter(black, autoflake)"
@echo " clean Remove code coverage files"
@echo " help Print this help message"