-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
63 lines (49 loc) · 1.26 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
PYTHON = python3
VENV = venv
ACTIVATE := . $(VENV)/bin/activate
DOCKER = docker
TESTDB = solver-rewards-test-db
# Write a marker .install file to indicate that the dependencies have been
# installed.
INST := $(VENV)/.install
$(INST): requirements.txt
$(PYTHON) -m venv $(VENV)
$(ACTIVATE); pip install --upgrade pip
$(ACTIVATE); pip install -r requirements.txt
touch $@
.PHONY: install
install: $(INST)
.PHONY: clean
clean:
rm -rf __pycache__ venv
.PHONY: fmt
fmt: install
$(ACTIVATE); black ./
.PHONY: lint
lint: install
$(ACTIVATE); pylint src/
.PHONY: types
types: install
$(ACTIVATE); mypy src/ --strict
.PHONY: check
check: fmt lint types
.PHONY: test-unit
test-unit: install
$(ACTIVATE); python -m pytest tests/unit
.PHONY: test-e2e
test-e2e: install
$(ACTIVATE); python -m pytest tests/e2e
.PHONY: db
db:
$(DOCKER) build -t $(TESTDB) -f Dockerfile.db .;
.PHONY: test-db
test-db: install db
if ! $(DOCKER) container inspect $(TESTDB) >/dev/null 2>&1; then \
$(DOCKER) run --rm -d -p 5432:5432 $(TESTDB) \
`# sleep just long enough for the machine to recognize the establishing container.` \
sleep 1s \
fi
$(ACTIVATE); python -m pytest tests/db
$(ACTIVATE); python -m pytest tests/queries
.PHONY: test-all
test-all: test-unit test-e2e test-db