-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (53 loc) · 1.5 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
.ONESHELL:
SHELL := /bin/bash
GIT_REVISION = `git rev-parse HEAD`
DOCKER_IMAGE = "$(USER)/$(shell basename $(CURDIR))"
VERSION := $(shell python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["tool"]["poetry"]["version"])')
# .PHONY = install start start-database init-database reset-database format lint test
# clean up
.PHONY: clean
clean: clean-docker clean-pyc clean-test
clean-docker:
docker rmi $(DOCKER_IMAGE)
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
clean-test:
rm -f .coverage*
rm -fr .pytest_cache
rm -fr .mypy_cache
rm -fr .ruff_cache
# builds and installation
install:
poetry install
build-image:
docker build -f Dockerfile --no-cache -t $(DOCKER_IMAGE):$(VERSION) .
build-cached-image:
docker build -f Dockerfile -t $(DOCKER_IMAGE):$(VERSION) .
# bootstrap
start:
poetry run uvicorn aster.api:create_app --factory
start-database:
docker compose -f docker-compose.yml -f docker-compose.dev.yml --env-file .env up db
init-database:
poetry run python -m aster database init
reset-database:
poetry run python -m aster database reset
# git hooks
pre-commit:
poetry run pre-commit run --all-files
pre-commit-autoupdate:
poetry run pre-commit autoupdate
# code style
format:
poetry run black
lint:
poetry run ruff
# test
test:
poetry run pytest
coverage:
poetry run coverage run -m pytest
coverage-report:
poetry run coverage combine && poetry run coverage report -m