-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
102 lines (81 loc) · 1.66 KB
/
Makefile
File metadata and controls
102 lines (81 loc) · 1.66 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
.PHONY: all
all: install
.PHONY: ci
ci: check test
# INSTALL
BACKEND_DEPENDENCIES := .venv/.flag
.PHONY: install
install: $(BACKEND_DEPENDENCIES)
$(BACKEND_DEPENDENCIES): poetry.lock
@ poetry config virtualenvs.in-project true
poetry install
@ touch $@
ifndef CI
poetry.lock: pyproject.toml
poetry lock --no-update
@ touch $@
endif
# TEST
PACKAGES = app tests
.PHONY: format
format: install
poetry run autoflake --recursive $(PACKAGES) --in-place --remove-all-unused-imports
poetry run isort $(PACKAGES)
poetry run black $(PACKAGES)
.PHONY: check
check: install format
ifdef CI
git diff --exit-code
endif
poetry run mypy $(PACKAGES)
.PHONY: test
test: test-unit test-e2e
.PHONY: test-unit
test-unit: install
poetry run pytest
.PHONY: test-e2e
test-e2e: install
ifdef CI
ifdef HONCHO_PROCESS_NAME
poetry run pomace exec tests/e2e.py --headless
else
poetry run honcho start --procfile tests/Procfile
endif
else
poetry run pomace exec tests/e2e.py
endif
.PHONY: dev
dev: install
cp tests/files/test.yml data/games
poetry run ptw --nobeep --beforerun "clear" --onpass "echo && make check && echo"
# RUN
.PHONY: run
run: install .envrc
@ echo "poetry run python run.py"
@ status=1; \
while [ $$status -eq 1 ] ; do \
poetry run python run.py; \
status=$$?; \
sleep 1; \
done; \
.envrc:
echo "export SIZE=5" >> $@
echo "export PLAYERS=2" >> $@
echo "export SHARED=false" >> $@
- direnv allow
.PHONY: serve
serve:
ifndef CI
git pull
poetry install --no-dev
endif
ifndef PYTHONANYWHERE_DOMAIN
poetry run gunicorn --workers 4 --bind 0.0.0.0:5000 app.views:app
endif
# CLEAN
.PHONY: clean
clean:
rm -rf data
.PHONY: clean-all
clean-all: clean
rm -rf .venv