-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #594 from alphagov/ldeb-add-invoke
Replace make with invoke
- Loading branch information
Showing
4 changed files
with
37 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ max-complexity = 12 | |
max-line-length = 120 | ||
per-file-ignores = | ||
**/__init__.py : F401 | ||
tasks.py: F401 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,20 @@ | ||
SHELL := /bin/bash | ||
VIRTUALENV_ROOT := $(shell [ -z $$VIRTUAL_ENV ] && echo $$(pwd)/venv || echo $$VIRTUAL_ENV) | ||
|
||
.PHONY: virtualenv | ||
virtualenv: | ||
[ -z $$VIRTUAL_ENV ] && [ ! -d venv ] && python3 -m venv venv || true | ||
|
||
.PHONY: requirements-dev | ||
requirements-dev: virtualenv requirements-dev.txt | ||
${VIRTUALENV_ROOT}/bin/pip install -Ur requirements-dev.txt | ||
|
||
.PHONY: test | ||
test: show-environment test-flake8 test-mypy test-python | ||
|
||
.PHONY: test-flake8 | ||
test-flake8: virtualenv | ||
${VIRTUALENV_ROOT}/bin/flake8 . | ||
|
||
.PHONY: test-mypy | ||
test-mypy: virtualenv requirements-dev | ||
${VIRTUALENV_ROOT}/bin/mypy dmutils/ | ||
|
||
.PHONY: test-python | ||
test-python: virtualenv requirements-dev | ||
${VIRTUALENV_ROOT}/bin/py.test ${PYTEST_ARGS} | ||
|
||
.PHONY: show-environment | ||
show-environment: | ||
@echo "Environment variables in use:" | ||
@env | grep DM_ || true | ||
|
||
.DEFAULT_GOAL := bootstrap | ||
|
||
%: | ||
@[ -z $$TERM ] || tput setaf 1 # red | ||
@echo 2>1 warning: calling '`make`' is being deprecated in this repo, you should use '`invoke` (https://pyinvoke.org)' instead. | ||
@[ -z $$TERM ] || tput setaf 9 # default | ||
@# pass goals to '`invoke`' | ||
invoke $(or $(MAKECMDGOALS), $@) | ||
|
||
help: | ||
invoke --list | ||
|
||
.PHONY: bootstrap | ||
bootstrap: | ||
pip install digitalmarketplace-developer-tools | ||
@echo done | ||
@[ -z $$TERM ] || tput setaf 2 # green | ||
@echo 2>1 dmdevtools has been installed globally, run developer tasks with '`invoke`' | ||
@[ -z $$TERM ] || tput setaf 9 # default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from invoke import task | ||
|
||
from dmdevtools.invoke_tasks import library_tasks as ns | ||
|
||
|
||
@task(ns["virtualenv"], ns["requirements_dev"]) | ||
def test_mypy(c): | ||
c.run("mypy dmutils/") | ||
|
||
|
||
ns.add_task(test_mypy) | ||
ns["test"].pre.insert(-1, test_mypy) |