-
Notifications
You must be signed in to change notification settings - Fork 93
/
Makefile
65 lines (50 loc) · 1.75 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
PYTHON_MODULE=pyodata
PYTHON_BINARIES=
PYTHON_MODULE_FILES=$(shell find $(PYTHON_MODULE) -type f -name '*.py')
TESTS_DIR=tests
TESTS_UNIT_DIR=$(TESTS_DIR)
TESTS_UNIT_FILES=$(shell find $(TESTS_UNIT_DIR) -type f -name '*.py')
PYTHON_BIN=python3
PYTEST_MODULE=pytest
PYTEST_PARAMS=--cov-report term --cov=pyodata
PYLINT_BIN=pylint
PYLINT_RC_FILE=.pylintrc
PYLINT_PARAMS=--output-format=parseable --reports=no
FLAKE8_BIN=flake8
FLAKE8_CONFIG_FILE=.flake8
FLAKE8_PARAMS=
COVERAGE_BIN=coverage3
COVERAGE_REPORT_ARGS=--skip-covered
COVERAGE_CMD_REPORT=$(COVERAGE_BIN) report
COVERAGE_CMD_HTML=$(COVERAGE_BIN) html
COVERAGE_HTML_DIR=.htmlcov
COVERAGE_HTML_ARGS=$(COVERAGE_REPORT_ARGS) -d $(COVERAGE_HTML_DIR)
COVERAGE_REPORT_FILES=$(PYTHON_BINARIES) $(PYTHON_MODULE_FILES)
all: check
.PHONY=check
lint: doc
$(PYLINT_BIN) --rcfile=$(PYLINT_RC_FILE) $(PYLINT_PARAMS) $(PYTHON_MODULE)
$(FLAKE8_BIN) --config=$(FLAKE8_CONFIG_FILE) $(FLAKE8_PARAMS) $(PYTHON_MODULE)
.PHONY=test
test:
$(PYTHON_BIN) -m $(PYTEST_MODULE) $(PYTEST_PARAMS)
.coverage: $(COVERAGE_REPORT_FILES) $(TESTS_UNIT_FILES)
$(MAKE) test PYTEST_PARAMS="--cov-report= --cov=$(PYTHON_MODULE)"
.PHONY: report-coverage
report-coverage: .coverage
@ echo "Generating code coverage report ..."
@ $(COVERAGE_CMD_REPORT) $(COVERAGE_REPORT_ARGS) $(COVERAGE_REPORT_FILES)
.PHONY: report-coverage-html
report-coverage-html: .coverage
@ echo "Generating HTML code coverage report ..."
@ $(COVERAGE_CMD_HTML) $(COVERAGE_HTML_ARGS) $(COVERAGE_REPORT_FILES)
@ echo "Report: file://$$(pwd)/$(COVERAGE_HTML_DIR)/index.html"
.PHONY=check
check: lint test
.PHONY=doc
doc:
$(MAKE) -C docs html
@ echo -e "\nOpen: file://$$(pwd)/docs/_build/html/index.html"
.PHONY=clean
clean:
rm --preserve-root -rf $(COVERAGE_HTML_DIR) .coverage