-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
98 lines (71 loc) · 2.07 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
PYTHON := python
.PHONY: docs
all: test
## General targets
install:
uv sync
install-dev:
uv sync --all-extras
adminapi:
uv run main.py adminapi -c configs/dev/adminapi.yaml
adminapi-dev:
set -a && source .env.local && set +a && make adminapi
dataapi:
uv run main.py dataapi -c configs/dev/dataapi.yaml
start-db:
docker-compose up -d
stop-db:
docker-compose down
docs:
uv run main.py generate-spec -o docs/gen/swagger.json
uvx \
--with 'mkdocs-material>=9.5.50' \
--with 'mkdocs-section-index>=0.3.9' \
--with 'neoteroi-mkdocs>=1.1.0' \
mkdocs serve -a localhost:8080
deploy-docs:
uv run main.py generate-spec -o docs/gen/swagger.json
uvx \
--with 'mkdocs-material>=9.5.50' \
--with 'mkdocs-section-index>=0.3.9' \
--with 'neoteroi-mkdocs>=1.1.0' \
mkdocs gh-deploy
build-docs:
uv run main.py generate-spec -o docs/gen/swagger.json
uvx \
--with 'mkdocs-material>=9.5.50' \
--with 'mkdocs-section-index>=0.3.9' \
--with 'neoteroi-mkdocs>=1.1.0' \
mkdocs build
## Testing
check:
uvx ruff format --config=pyproject.toml --check
uvx ruff check --config=pyproject.toml
# pytest is used to run unittest test cases
test: check
uv run pytest --config-file=pyproject.toml tests/env_test.py
uv run pytest --config-file=pyproject.toml tests/unit
test-all: check
uv run pytest --config-file=pyproject.toml tests
test-regression:
uv run tests.py regression-tests
mypy:
uvx mypy app --config-file pyproject.toml
uvx mypy tests --config-file pyproject.toml
coverage:
uvx coverage run -m unittest discover -s tests -p "*_test.py" -v
uvx coverage html
## Fix code
fix:
uvx ruff format --config=pyproject.toml
uvx ruff check --config=pyproject.toml --fix
fix-unsafe:
uvx ruff check --config=pyproject.toml --unsafe-fixes --fix
## Deploy
GIT_VERSION = `git rev-parse --short master`
image-build:
docker build . -t ghcr.io/hyperleda/hyperleda:$(GIT_VERSION)
docker tag ghcr.io/hyperleda/hyperleda:$(GIT_VERSION) ghcr.io/hyperleda/hyperleda:latest
image-push:
docker push ghcr.io/hyperleda/hyperleda:$(GIT_VERSION)
docker push ghcr.io/hyperleda/hyperleda:latest