diff --git a/Makefile b/Makefile index 6fdf8cd..f99cfff 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,58 @@ -.PHONY: clean-pyc +.DEFAULT_GOAL := help + +PYTHON ?= $(shell which python) + -default: test +.PHONY: help +help: ## Prints help for available target rule + $(info Available target rules:) + @echo + @cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' + +.PHONY: clean-pyc clean-pyc: + $(info Cleaning Python files..) @find . -iname '*.py[co]' -delete @find . -iname '__pycache__' -delete @find . -iname '.coverage' -delete @rm -rf htmlcov/ + +.PHONY: clean-dist clean-dist: + $(info Cleaning Python distribution files..) @rm -rf dist/ @rm -rf build/ @rm -rf *.egg-info -clean: clean-pyc clean-dist -test: +.PHONY: clean +clean: clean-pyc clean-dist ## Cleans project building and caching files + + +.PHONY: test +test: ## Runs project tests using Pytest + $(info Running project tests..) py.test -vvv --cov=simple_rest_client tests + +.PHONY: dist dist: clean - python setup.py sdist - python setup.py bdist_wheel + $(info Building Python distribution..) + $(PYTHON) setup.py sdist + $(PYTHON) setup.py bdist_wheel -release: dist + +.PHONY: release +release: dist ## Generates a new project release + $(info Generating a new project release..) git tag `python setup.py -q version` git push origin `python setup.py -q version` twine upload dist/* -lint: + +.PHONY: lint +lint: ## Runs Python lint on the source code + $(info Running lint against project..) SKIP=no-commit-to-branch pre-commit run -a -v