generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
59 lines (47 loc) · 1.43 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.ONESHELL:
PYTHON_SOURCE_FILES = ./tests operations_engineering_join_github.py ./app
# Default values for variables (can be overridden by passing arguments to `make`)
RELEASE_NAME ?= default-release-name
APP_SECRET_KEY ?= default-app-secret-key
API_KEY ?= default-api-key
HOST_NAME?= default-host-suffix
IMAGE ?= default-image
REGISTRY ?= default-registry
help:
@echo "Available commands:"
@echo "make venv - venv the environment"
@echo "make test - Run tests"
@echo "make local - Run application locally"
@echo "make lint - Run Lint tools"
@echo "make report - Open the Code Coverage report"
venv: requirements.txt
python3 -m venv venv
venv/bin/pip3 install --upgrade pip
venv/bin/pip3 install -r requirements.txt
# Run MegaLinter
lint:
npx mega-linter-runner -e 'SHOW_ELAPSED_TIME=true'
format: venv
venv/bin/pip3 install black
venv/bin/black $(PYTHON_SOURCE_FILES)
test: venv
venv/bin/pip3 install pytest
venv/bin/pip3 install coverage
venv/bin/coverage run -m pytest tests/ -v
report:
venv/bin/coverage html && open htmlcov/index.html
clean-test:
rm -fr venv
rm -fr .venv
rm -fr .tox/
rm -fr .pytest_cache
rm -fr .mypy_cache
rm -fr .coverage
rm -fr htmlcov/
local: venv
venv/bin/python3 -m app.run
# Assumes you've already built the image locally
docker-up:
docker-compose -f docker-compose.yaml up -d
all:
.PHONY: venv lint test format local clean-test report all