-
Notifications
You must be signed in to change notification settings - Fork 33
/
Makefile
83 lines (66 loc) · 1.83 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
short_ver = 4.5.1
release = 1
PYTHON ?= python3
PYTHON_DIRS = aiven tests
all: install-py validate-style lint test
install-py:
$(PYTHON) -m pip install -e .[dev]
test: pytest
lint: ruff flake8 mypy
reformat:
$(PYTHON) -m isort $(PYTHON_DIRS)
$(PYTHON) -m black $(PYTHON_DIRS)
validate-style:
$(eval CHANGES_BEFORE := $(shell mktemp))
git diff > $(CHANGES_BEFORE)
$(MAKE) reformat
$(eval CHANGES_AFTER := $(shell mktemp))
git diff > $(CHANGES_AFTER)
diff $(CHANGES_BEFORE) $(CHANGES_AFTER)
-rm $(CHANGES_BEFORE) $(CHANGES_AFTER)
flake8:
$(PYTHON) -m flake8 $(PYTHON_DIRS)
mypy:
$(PYTHON) -m mypy $(PYTHON_DIRS)
ruff:
$(PYTHON) -m ruff check $(PYTHON_DIRS)
pytest:
$(PYTHON) -m pytest -vv tests/
coverage:
$(PYTHON) -m coverage run --source aiven -m pytest $(PYTEST_ARG) tests/
$(PYTHON) -m coverage report --show-missing
clean:
$(RM) -r rpms
build-dep-fedora:
sudo dnf install -y --best --allowerasing \
black \
python3-devel \
python3-certifi \
python3-hatch-vcs \
python3-hatchling \
python3-PyMySQL \
python3-wheel \
python3-flake8 \
python3-isort \
python3-mypy \
python3-pytest \
python3-requests \
python3-requests-toolbelt \
python3-types-requests \
python3-setuptools_scm \
rpmdevtools \
tar
rpm:
git archive --prefix=aiven-client/ HEAD -o rpm-src-aiven-client.tar
# add generated files to the tar, they're not in git repository
tar -r -f rpm-src-aiven-client.tar --transform=s,aiven/,aiven-client/aiven/, $(generated)
rpmbuild -bb aiven-client.spec \
--define '_sourcedir $(CURDIR)' \
--define '_rpmdir $(PWD)/rpms' \
--define 'major_version $(short_ver)' \
--define 'minor_version $(release)'
$(RM) rpm-src-aiven-client.tar
.PHONY: install-rpm
install-rpm: $(RPM)
sudo dnf install $<
.PHONY: build-dep-fedora clean coverage pytest mypy flake8 reformat test validate-style ruff