This repository has been archived on 2021-12-24. You can view files and clone it, but cannot push or open issues/pull-requests.
jos/Makefile

55 lines
936 B
Makefile

# =====CONFIG=====
PYTHON := python3.9
# This can't contain spaces (I think)
VENV := .venv
# Minimum % coverage for tests to succeed
MIN_COV := 10
# By default, just create the venv when needed
all: venv
# =====RECIPES=====
## VENV
### Create the venv
$(VENV)/bin/activate: setup.py 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/black setup.py app
.PHONY: format
### Lint using black & flake8
lint: venv
@ '$(VENV)'/bin/flake8 setup.py app
@ '$(VENV)'/bin/black --check setup.py app
.PHONY: lint
## Testing
test: venv
@ '$(VENV)'/bin/pytest --cov=app --cov-fail-under='$(MIN_COV)' tests/
.PHONY: test
## Cleaning
# Remove the venv
clean:
@ rm -rf '$(VENV)'
.PHONY: clean
# Run the Flask server
# TODO
run: venv