-
Notifications
You must be signed in to change notification settings - Fork 6
/
makefile
72 lines (57 loc) · 1.5 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
68
69
70
71
72
.PHONY: all setup
# make tests >debug.log 2>&1
ifeq ($(OS),Windows_NT)
GCLOUD = $(LOCALAPPDATA)\Google\Cloud SDK\google-cloud-sdk\bin\gcloud.cmd
PYTHON = venv/Scripts/python.exe
PTEST = venv/Scripts/pytest.exe
COVERAGE = venv/Scripts/coverage.exe
else
GCLOUD = gcloud
PYTHON = ./venv/bin/python
PTEST = ./venv/bin/pytest
COVERAGE = ./venv/bin/coverage
endif
SOURCE = source
TESTS = tests
DFLT = $(SOURCE)/default
BACK = $(SOURCE)/backend
PIP = $(PYTHON) -m pip install
DEPLOY = $(GCLOUD) app deploy --project
FLAKE8 = $(PYTHON) -m flake8
LINT = $(PYTHON) -m pylint
PEP257 = $(PYTHON) -m pydocstyle
PYTEST = $(PTEST) --cov=$(SOURCE) --cov-report term:skip-covered
PRJ = text-transform-198104
VERSION = py3
VERSION_BACK = py3b
all: tests
test:
$(PTEST) -s $(TESTS)/test/$(T)
tests: flake8 pep257 lint
$(PYTEST) --durations=5 $(TESTS)
$(COVERAGE) html --skip-covered
flake8:
$(FLAKE8) $(DFLT)
$(FLAKE8) $(BACK)
$(FLAKE8) $(TESTS)/test
pep257:
$(PEP257) $(DFLT)
$(PEP257) $(BACK)
$(PEP257) --match='.*\.py' $(TESTS)/test
lint:
$(LINT) $(DFLT)
$(LINT) $(BACK)
$(LINT) $(TESTS)/test
deploy:
$(DEPLOY) $(PRJ) --version $(VERSION) $(DFLT)/app.yaml
deployback:
$(DEPLOY) $(PRJ) --version $(VERSION_BACK) $(BACK)/app.yaml
cron:
$(DEPLOY) $(PRJ) $(SOURCE)/cron.yaml
setup: setup_python setup_pip
setup_pip:
$(PIP) --upgrade pip
$(PIP) -r $(DFLT)/requirements.txt
$(PIP) -r $(TESTS)/requirements.txt
setup_python:
$(PYTHON_BIN) -m venv ./venv