-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
128 lines (100 loc) · 3.21 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
PYTHON = python
PIP = venv/bin/pip
BAMP = bamp
HATCH = hatch
GIT = git
.PHONY: install version test-pypi-release pypi-release bamp-patch bamp-minor bamp-major
# utils
create-venv:
$(info Creating virtual environment...)
@$(PYTHON) -m venv venv
upgrade-pip:
$(info Upgrading pip...)
@$(PIP) install --upgrade pip
install-package:
$(info Installing package in editable mode...)
@$(PIP) install -e .
tag:
$(info Tagging commit...)
@$(GIT) tag v$(shell $(BAMP) current)
current-branch:
@$(GIT) rev-parse --abbrev-ref HEAD
push:
$(info Pushing commit and tag...)
@$(GIT) push origin $(shell $(GIT) rev-parse --abbrev-ref HEAD)
@$(GIT) push --tags
version:
@$(BAMP) current
# utils aliases
install: create-venv upgrade-pip dev-requirements install-package
re-install: upgrade-pip dev-requirements install-package
# requirements
build-dev-requirements:
$(info Building development requirements...)
@$(VENV)pip-compile requirements/development.in -o requirements/development.txt
build-production-requirements:
$(info Building production requirements...)
@$(VENV)pip-compile requirements/base.in -o requirements/production.txt
build-test-requirements:
$(info Building test requirements...)
@$(VENV)pip-compile requirements/test.in -o requirements/test.txt
install-development-requirements:
$(info Installing development requirements...)
@$(PIP) install -r requirements/development.txt
install-production-requirements:
$(info Installing production requirements...)
@$(PIP) install -r requirements/development.txt
install-test-requirements:
$(info Installing test requirements...)
@$(PIP) install -r requirements/test.txt
delete-requirements-txt:
$(info Resetting requirements...)
@rm -f requirements/*.txt
reset-requirements: delete-requirements-txt build-requirements
# requirements aliases
build-requirements: build-dev-requirements build-production-requirements build-test-requirements
dev-requirements: build-dev-requirements install-development-requirements install-package
prod-requirements: build-production-requirements install-production-requirements install-package
test-requirements: build-test-requirements install-test-requirements install-package
# tests
coverage-report:
coverage run -m pytest -x
coverage json -o "coverage-summary.json"
coverage report -m
test:
pytest -x
# tests aliases
cov: coverage-report
# PyPi
test-pypi-release:
$(info Removing old build...)
rm -rf dist/
$(info Building new version...)
python -m build
$(info Publishing to test.pypi.org...)
@$(HATCH) publish --repo https://test.pypi.org/legacy/
pypi-release:
$(info Removing old build...)
rm -rf dist/
$(info Building new version...)
python -m build
$(info Publishing to pypi.org...)
@$(HATCH) publish
# Bamping
patch:
$(info Setting version (patch)...)
@$(BAMP) patch
minor:
$(info Setting version (minor)...)
@$(BAMP) minor
major:
$(info Setting version (major)...)
@$(BAMP) major
commit-bamp:
$(info Committing changes...)
@$(GIT) add bamp.cfg ppieces/version.py pyproject.toml
@$(GIT) commit -m "Bamp version to $(shell $(BAMP) current)"
# bamping aliases
patch-release: patch commit-bamp tag push pypi-release
minor-release: minor commit-bamp tag push pypi-release
major-release: major commit-bamp tag push pypi-release