config-skeleton/Makefile

53 lines
1005 B
Makefile
Raw Normal View History

2021-05-22 18:24:59 +02:00
# =====CONFIG=====
PYTHON := python3
# This can't contain spaces (I think)
VENV := .venv
# Minimum % coverage for tests to succeed
MIN_COV := 50
2021-05-22 21:28:01 +02:00
SRC := setup.py config_skeleton tests
2021-05-22 18:24:59 +02:00
# =====GENERAL=====
## By default, create the venv
all: venv
.PHONY: all
## Remove any temporary files
clean:
@ rm -rf '$(VENV)'
.PHONY: clean
# =====BACKEND=====
## VENV
### Create the venv
$(VENV)/bin/activate: setup.cfg
@ '$(PYTHON)' -m venv '$(VENV)'
@ '$(VENV)'/bin/pip install -e .[develop]
### Convenient alias for the venv
venv: $(VENV)/bin/activate
.PHONY: venv
## Formatting & linting
### Format the codebase using black
format: venv
@ '$(VENV)'/bin/isort $(SRC)
2021-05-22 21:28:01 +02:00
@ '$(VENV)'/bin/black $(SRC)
2021-05-22 18:24:59 +02:00
.PHONY: format
### Lint using black & flake8
lint: venv
@ '$(VENV)'/bin/flake8 $(SRC)
@ '$(VENV)'/bin/black --check $(SRC)
2021-05-22 21:28:01 +02:00
@ '$(VENV)'/bin/isort --check $(SRC)
2021-05-22 18:24:59 +02:00
.PHONY: lint
## Testing
test: venv
2021-05-22 21:28:01 +02:00
@ '$(VENV)'/bin/pytest --cov=config_skeleton --cov-fail-under='$(MIN_COV)' tests/
2021-05-22 18:24:59 +02:00
.PHONY: test