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
Raw Normal View History

# =====CONFIG=====
PYTHON := python3.9
# This can't contain spaces (I think)
2021-05-18 08:57:40 +02:00
VENV := .venv
# Minimum % coverage for tests to succeed
MIN_COV := 10
# By default, just create the venv when needed
all: venv
2021-05-18 08:57:40 +02:00
# =====RECIPES=====
## VENV
### Create the venv
$(VENV)/bin/activate: setup.py setup.cfg
@ '$(PYTHON)' -m venv '$(VENV)'
2021-05-18 08:57:40 +02:00
@ '$(VENV)'/bin/pip install -e .[develop]
2021-05-18 08:57:40 +02:00
### Convenient alias for the venv
venv: $(VENV)/bin/activate
.PHONY: venv
2021-05-18 08:57:40 +02:00
## Formatting & linting
2021-05-18 09:04:41 +02:00
### Format the codebase using black
2021-05-18 08:57:40 +02:00
format: venv
2021-05-18 09:04:41 +02:00
@ '$(VENV)'/bin/black setup.py app
2021-05-18 08:57:40 +02:00
.PHONY: format
2021-05-18 09:04:41 +02:00
### Lint using black & flake8
2021-05-18 08:57:40 +02:00
lint: venv
2021-05-18 09:04:41 +02:00
@ '$(VENV)'/bin/flake8 setup.py app
@ '$(VENV)'/bin/black --check setup.py app
2021-05-18 08:57:40 +02:00
.PHONY: lint
## Testing
test: venv
2021-05-18 09:04:41 +02:00
@ '$(VENV)'/bin/pytest --cov=app --cov-fail-under='$(MIN_COV)' tests/
2021-05-18 08:57:40 +02:00
.PHONY: test
## Cleaning
# Remove the venv
clean:
@ rm -rf '$(VENV)'
2021-05-18 08:57:40 +02:00
.PHONY: clean
# Run the Flask server
# TODO
run: venv