Skip to content

Commit

Permalink
build: move clean to invoke, run coverage locally, read command from tox
Browse files Browse the repository at this point in the history
  • Loading branch information
andreoliwa committed Feb 28, 2021
1 parent 54ae801 commit 60d779c
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 59 deletions.
23 changes: 10 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
.DEFAULT_GOAL := dev
.DEFAULT_GOAL := build
.PHONY: Makefile

SRC := src/*/*.py *.py docs/*.py
SRC := $(shell find -f docs src -type f -iname '*.py')
DOCS := docs/*.rst *.rst *.md
STYLES := styles/*/*
TESTS := tests/*/*
GITHUB = .github/*/*
STYLES := $(shell find styles -type f)
TESTS := $(shell find tests -type f -iname '*.py')
GITHUB = $(shell find .github -type f)
ANY := $(SRC) $(DOCS) $(STYLES) $(TESTS) $(GITHUB)

# Create the cache dir if it doesn't exist
$(shell mkdir -p .cache/make)

help:
@echo 'Choose one of the following targets:'
@echo "Make targets (run 'make -B' or 'make --always-make' to force):"
@cat Makefile | egrep '^[a-z0-9 ./-]*:.*#' | sed -E -e 's/:.+# */@ /g' -e 's/ .+@/@/g' | sort | awk -F@ '{printf " \033[1;34m%-18s\033[0m %s\n", $$1, $$2}'
@echo
@echo 'Run 'make -B' or 'make --always-make' to force a rebuild of all targets'
@echo 'Use invoke to run other tasks that were previously make targets:'
invoke --list
.PHONY: help

dev: .cache/make/pytest .cache/make/nitpick .cache/make/pylint .cache/make/pre-commit # Quick build for local development
.PHONY: dev
build: .cache/make/pytest .cache/make/nitpick .cache/make/pylint .cache/make/pre-commit # Quick build for local development
.PHONY: build

.cache/make/pytest: $(SRC) $(TESTS)
invoke test
Expand All @@ -40,7 +41,3 @@ dev: .cache/make/pytest .cache/make/nitpick .cache/make/pylint .cache/make/pre-c
.cache/make/doc: $(DOCS) $(STYLES)
invoke doc
touch .cache/make/doc

clean: # Clean build output
rm -rf .cache .mypy_cache docs/_build src/*.egg-info .pytest_cache .coverage htmlcov/
.PHONY: clean
Loading

0 comments on commit 60d779c

Please sign in to comment.