forked from feldlime/RecoServiceTemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
79 lines (47 loc) · 914 Bytes
/
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
VENV := .venv
ifeq ($(OS),Windows_NT)
BIN=$(VENV)/Scripts
else
BIN=$(VENV)/bin
endif
export PATH := $(BIN):$(PATH)
PROJECT := service
TESTS := tests
IMAGE_NAME := reco_service
CONTAINER_NAME := reco_service
# Prepare
.venv:
poetry install --no-root
poetry check
setup: .venv
# Clean
clean:
rm -rf .mypy_cache
rm -rf .pytest_cache
rm -rf $(VENV)
# Format
isort_fix: .venv
isort $(PROJECT) $(TESTS)
format: isort_fix
# Lint
isort: .venv
isort --check $(PROJECT) $(TESTS)
flake: .venv
flake8 $(PROJECT) $(TESTS)
mypy: .venv
mypy $(PROJECT) $(TESTS)
pylint: .venv
pylint $(PROJECT) $(TESTS)
lint: isort flake mypy pylint
# Test
.pytest-ci:
pytest -m "not secured"
test: .venv .pytest-ci
# Docker
build:
docker build . -t $(IMAGE_NAME)
run: build
docker run -p 8080:8080 --name $(CONTAINER_NAME) $(IMAGE_NAME)
# All
all: setup format lint test run
.DEFAULT_GOAL = all