-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
88 lines (70 loc) · 2.17 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
.PHONY: clean-pyc clean-build clean lint test doctest rollback version
VERSION='0.3.7'
SOURCE_PATH=./ferien
TEST_PATH=./tests
# Environment overrides
VERSION_PART?=patch
help:
@echo " clean"
@echo " Remove python and release artifacts."
@echo " setup"
@echo " Installs dependencies into the environment"
@echo " lint"
@echo " Check style with flake8."
@echo " test"
@echo " Run py.test"
@echo " doctest"
@echo " Run doctest"
@echo " version"
@echo " Prints out the current version"
@echo " release-test"
@echo " Bundles a release and deploys it to test.pypi"
@echo " release"
@echo " Bundles a release and deploys it to pypi"
clean-pyc:
find . -name '*.pyc' -delete
find . -name '*.pyo' -delete
# find . -name '*~' -exec rm --force {} +
clean-build:
rm -rf build/
rm -rf dist/
rm -rf *.egg-info
rm -rf .pytest_cache
clean: clean-pyc clean-build
setup:
pip install pip --upgrade
pip install -r requirements.txt --upgrade
docs: README.mdpp
markdown-pp README.mdpp -o README.md
lint:
flake8 $(SOURCE_PATH)
pylint $(SOURCE_PATH)
mypy --strict --no-warn-unused-ignores $(SOURCE_PATH)
test:
pytest --verbose --color=yes -s \
--doctest-modules \
--cov=$(SOURCE_PATH) --cov-report html --cov-report term $(TEST_PATH) \
$(SOURCE_PATH)
doctest:
pytest --verbose --color=yes --doctest-modules $(SOURCE_PATH)
version:
@echo $(VERSION)
next-version: lint test
$(eval NEXT_VERSION := $(shell bumpversion --dry-run --allow-dirty --list $(VERSION_PART) | grep new_version | sed s,"^.*=",,))
@echo Next version is $(NEXT_VERSION)
bumpversion $(VERSION_PART)
@echo "Review your version changes first"
@echo "Accept your version: \`make accept-version\`"
@echo "Revoke your version: \`make revoke-version\`"
accept-version:
git push && git push --tags
revoke-version:
git tag -d `git describe --tags --abbrev=0` # delete the tag
git reset --hard HEAD~1 # rollback the commit
sdist:
rm -f dist/*
python setup.py sdist
release-test: sdist
twine upload dist/* -r testpypi
release: sdist
twine upload dist/* -r pypi