-
Notifications
You must be signed in to change notification settings - Fork 233
/
Makefile
88 lines (74 loc) · 2.49 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Some simple testing tasks (sorry, UNIX only).
FLAGS?=--maxfail=3
SCALA_VERSION?=2.13
KAFKA_VERSION?=2.8.1
DOCKER_IMAGE=aiolibs/kafka:$(SCALA_VERSION)_$(KAFKA_VERSION)
DIFF_BRANCH=origin/master
FORMATTED_AREAS=aiokafka/util.py aiokafka/structs.py
.PHONY: setup
setup:
pip install -r requirements-dev.txt
pip install -Ue .
.PHONY: format
format:
isort $(FORMATTED_AREAS) setup.py
black $(FORMATTED_AREAS) setup.py
.PHONY: lint
lint:
black --check $(FORMATTED_AREAS) setup.py
@if ! isort -c $(FORMATTED_AREAS) setup.py; then \
echo "Import sort errors, run 'make format' to fix them!!!"; \
isort --diff --color $(FORMATTED_AREAS) setup.py; \
false; \
fi
ruff aiokafka tests setup.py
mypy --install-types --non-interactive $(FORMATTED_AREAS)
.PHONY: test
test: lint
pytest -s --show-capture=no --docker-image $(DOCKER_IMAGE) $(FLAGS) tests
.PHONY: vtest
vtest: lint
pytest -s -v --log-level INFO --docker-image $(DOCKER_IMAGE) $(FLAGS) tests
.PHONY: cov cover coverage
cov cover coverage: lint
pytest -s --cov aiokafka --cov-report html --docker-image $(DOCKER_IMAGE) $(FLAGS) tests
@echo "open file://`pwd`/htmlcov/index.html"
.PHONY: ci-test-unit
ci-test-unit:
pytest -s --log-format="%(asctime)s %(levelname)s %(message)s" --log-level DEBUG --cov aiokafka --cov-report xml --color=yes $(FLAGS) tests
.PHONY: ci-test-all
ci-test-all:
pytest -s -v --log-format="%(asctime)s %(levelname)s %(message)s" --log-level DEBUG --cov aiokafka --cov-report xml --color=yes --docker-image $(DOCKER_IMAGE) $(FLAGS) tests
coverage.xml: .coverage
coverage xml
.PHONY: diff-cov
diff-cov: coverage.xml
git fetch
diff-cover coverage.xml --html-report diff-cover.html --compare-branch=$(DIFF_BRANCH)
.PHONY: check-readme
check-readme:
python setup.py check -rms
.PHONY: clean
clean:
rm -rf `find . -name __pycache__`
rm -f `find . -type f -name '*.py[co]' `
rm -f `find . -type f -name '*~' `
rm -f `find . -type f -name '.*~' `
rm -f `find . -type f -name '@*' `
rm -f `find . -type f -name '#*#' `
rm -f `find . -type f -name '*.orig' `
rm -f `find . -type f -name '*.rej' `
rm -f .coverage
rm -rf htmlcov
rm -rf docs/_build/
rm -rf cover
rm -rf dist
rm -f aiokafka/record/_crecords/cutil.c
rm -f aiokafka/record/_crecords/default_records.c
rm -f aiokafka/record/_crecords/legacy_records.c
rm -f aiokafka/record/_crecords/memory_records.c
rm -f aiokafka/record/_crecords/*.html
.PHONY: doc
doc:
make -C docs html
@echo "open file://`pwd`/docs/_build/html/index.html"