/
Makefile
68 lines (46 loc) · 1.7 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
.PHONY: tests all unit integration clean dependencies tdd html purge dist
GIT_ROOT := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
VENV_ROOT := $(GIT_ROOT)/.venv
VENV ?= $(VENV_ROOT)
BENTO_BIN := $(shell which bento)
BENTO_EMAIL := gabriel@nacaolivre.org
export VENV
all: dependencies tests
$(VENV): # creates $(VENV) folder if does not exist
python3 -mvenv $(VENV)
$(VENV)/bin/pip install -U pip setuptools
$(VENV)/bin/steadymark $(VENV)/bin/sphinx-build $(VENV)/bin/twine $(VENV)/bin/nosetests $(VENV)/bin/python $(VENV)/bin/pip: # installs latest pip
test -e $(VENV)/bin/pip || make $(VENV)
$(VENV)/bin/pip install -r development.txt
$(VENV)/bin/pip install -e .
tests: unit integration docs
tdd: $(VENV)/bin/nosetests # runs all tests
$(VENV)/bin/nosetests tests --with-watch --cover-erase
# Install dependencies
dependencies: | $(VENV)/bin/nosetests
$(VENV)/bin/pip install -r development.txt
# runs unit tests
unit: $(VENV)/bin/nosetests # runs only unit tests
$(VENV)/bin/nosetests --cover-erase tests/unit
docs: $(VENV)/bin/steadymark
$(VENV)/bin/steadymark README.md
# runs integration tests
integration: $(VENV)/bin/nosetests # runs integration tests
$(VENV)/bin/nosetests tests/integration
release: | clean bento unit integration tests html
@rm -rf dist/*
@./.release
@make pypi
bento: | $(BENTO_BIN)
$(BENTO_BIN) --agree --email=$(BENTO_EMAIL) check --all
dist: | clean
$(VENV)/bin/python setup.py build sdist
pypi: dist | $(VENV)/bin/twine
$(VENV)/bin/twine upload dist/*.tar.gz
# cleanup temp files
clean:
rm -rf $(HTML_ROOT) build dist
# purge all virtualenv and temp files, causes everything to be rebuilt
# from scratch by other tasks
purge: clean
rm -rf $(VENV)