-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
129 lines (80 loc) · 2.38 KB
/
Makefile
File metadata and controls
129 lines (80 loc) · 2.38 KB
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
DOCKER_COMPOSE_DEV = docker compose
DOCKER_COMPOSE_CI = docker compose -f docker-compose.yml
DOCKER_COMPOSE = $(DOCKER_COMPOSE_DEV)
VENV = venv
PIP = $(VENV)/bin/pip
PYTHON = $(VENV)/bin/python
DOCKER_RUN = $(DOCKER_COMPOSE) run --rm data-hub-api
DOCKER_PYTHON = $(DOCKER_RUN) python
ARGS =
PYTEST_WATCH_MODULES = tests/unit_tests
venv-clean:
@if [ -d "$(VENV)" ]; then \
rm -rf "$(VENV)"; \
fi
venv-create:
python3 -m venv $(VENV)
venv-activate:
chmod +x venv/bin/activate
bash -c "venv/bin/activate"
dev-install:
$(PIP) install --disable-pip-version-check -r requirements.build.txt
$(PIP) install --disable-pip-version-check \
-r requirements.txt \
-r requirements.dev.txt
dev-venv: venv-create dev-install
dev-flake8:
$(PYTHON) -m flake8 data_hub_api tests
dev-pylint:
$(PYTHON) -m pylint data_hub_api tests
dev-mypy:
$(PYTHON) -m mypy data_hub_api tests
dev-lint: dev-flake8 dev-pylint dev-mypy
dev-unittest:
$(PYTHON) -m pytest -p no:cacheprovider $(ARGS) tests/unit_tests
dev-unittest-detailed-view:
$(PYTHON) -m pytest -p no:cacheprovider -vv $(ARGS) tests/unit_tests
dev-watch:
$(PYTHON) -m pytest_watch -- -p no:cacheprovider $(ARGS) $(PYTEST_WATCH_MODULES)
dev-update-regression-test-data:
$(PYTHON) data/docmaps/regression_test/update_regression_test_data.py
dev-regression-test:
$(PYTHON) -m pytest -p no:cacheprovider $(ARGS) tests/regression_tests
dev-regression-test-detailed-view:
$(PYTHON) -m pytest -p no:cacheprovider -vv $(ARGS) tests/regression_tests
dev-test: dev-lint dev-unittest
dev-start:
$(PYTHON) -m uvicorn \
data_hub_api.main:create_app \
--reload \
--factory \
--host 127.0.0.1 \
--port 8000 \
--log-config=config/logging.yaml
build:
$(DOCKER_COMPOSE) build data-hub-api
flake8:
$(DOCKER_PYTHON) -m flake8 data_hub_api tests
pylint:
$(DOCKER_PYTHON) -m pylint data_hub_api tests
mypy:
$(DOCKER_PYTHON) -m mypy data_hub_api tests
lint: flake8 pylint mypy
unittest:
$(DOCKER_PYTHON) -m pytest -p no:cacheprovider $(ARGS) tests/unit_tests
watch:
$(DOCKER_PYTHON) -m pytest_watch -- -p no:cacheprovider $(ARGS) $(PYTEST_WATCH_MODULES)
test: lint unittest
start:
$(DOCKER_COMPOSE) up -d
stop:
$(DOCKER_COMPOSE) down
logs:
$(DOCKER_COMPOSE) logs -f
docker-push:
$(DOCKER_COMPOSE) push data-hub-api
ci-build-and-test:
$(MAKE) DOCKER_COMPOSE="$(DOCKER_COMPOSE_CI)" \
build test
ci-clean:
$(DOCKER_COMPOSE_CI) down -v