mirror of
https://github.com/davegallant/rfd.git
synced 2025-08-05 08:23:38 +00:00
Enhance Makefile by changing some Make defaults (#54)
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -88,3 +88,5 @@ venv.bak/
|
|||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
.dmypy.json
|
.dmypy.json
|
||||||
dmypy.json
|
dmypy.json
|
||||||
|
|
||||||
|
tmp/
|
||||||
|
66
Makefile
66
Makefile
@@ -1,35 +1,57 @@
|
|||||||
|
|
||||||
SRC:=rfd
|
SRC := rfd
|
||||||
|
SHELL := bash
|
||||||
|
.ONESHELL:
|
||||||
|
.SHELLFLAGS := -eu -o pipefail -c
|
||||||
|
.DELETE_ON_ERROR:
|
||||||
|
MAKEFLAGS += --warn-undefined-variables
|
||||||
|
MAKEFLAGS += --no-builtin-rules
|
||||||
|
|
||||||
.PHONY: build
|
|
||||||
|
ifeq ($(origin .RECIPEPREFIX), undefined)
|
||||||
|
$(error This Make does not support .RECIPEPREFIX. Please use GNU Make 4.0 or later)
|
||||||
|
endif
|
||||||
|
.RECIPEPREFIX = >
|
||||||
|
|
||||||
|
## build: Build a tar.gz of the python package
|
||||||
build:
|
build:
|
||||||
rm -rf dist/
|
> rm -rf dist/
|
||||||
python setup.py sdist
|
> python setup.py sdist
|
||||||
|
.PHONY: build
|
||||||
.PHONY: push_test
|
|
||||||
push_test:
|
|
||||||
twine upload -r testpypi dist/*.tar.gz
|
|
||||||
|
|
||||||
.PHONY: push_prod
|
|
||||||
push_prod:
|
|
||||||
twine upload dist/*.tar.gz
|
|
||||||
|
|
||||||
|
## precommit: Run all pre-commit hooks
|
||||||
|
precommit:
|
||||||
|
> pre-commit run \
|
||||||
|
--all-files \
|
||||||
|
--show-diff-on-failure
|
||||||
.PHONY: precommit
|
.PHONY: precommit
|
||||||
precommit: ## Run pre-commit
|
|
||||||
pre-commit run \
|
|
||||||
--all-files \
|
|
||||||
--show-diff-on-failure
|
|
||||||
|
|
||||||
.PHONY: lint
|
## lint: Run static analysis on the code
|
||||||
lint:
|
lint:
|
||||||
pylint $(SRC)
|
> pylint $(SRC)
|
||||||
|
.PHONY: lint
|
||||||
|
|
||||||
|
## test: Run all unit tests
|
||||||
|
test: tmp/.tests-passed.sentinel
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
|
||||||
pytest -v
|
|
||||||
|
|
||||||
.PHONY: pr
|
# Tests - re-ran if any file under src has been changed since tmp/.tests-passed.sentinel was last touched
|
||||||
|
tmp/.tests-passed.sentinel: $(shell find ${SRC} -type f)
|
||||||
|
> mkdir -p $(@D)
|
||||||
|
> pytest -v
|
||||||
|
> touch $@
|
||||||
|
|
||||||
|
## pr: Run pre-commit, lint and test
|
||||||
pr: precommit lint test
|
pr: precommit lint test
|
||||||
|
.PHONY: pr
|
||||||
|
|
||||||
.PHONY: ci
|
|
||||||
ci: lint test
|
ci: lint test
|
||||||
|
.PHONY: ci
|
||||||
|
|
||||||
|
## help: Print this help message
|
||||||
|
help:
|
||||||
|
> @echo "Usage:"
|
||||||
|
> @echo
|
||||||
|
> @sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /' | sort
|
||||||
|
> @echo
|
||||||
|
.PHONY: help
|
||||||
|
Reference in New Issue
Block a user