Repository navigation
Expand file tree
/
Copy pathmakefile
More file actions
62 lines (46 loc) · 2.01 KB
/
Copy pathmakefile
File metadata and controls
62 lines (46 loc) · 2.01 KB
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
DC_EXEC = docker compose exec backend
.PHONY: install test test-cov show-cov lint format migrate makemigrations run shell check schema-validate ci help ci-cov
help:
@echo "Targets disponíveis:"
@echo " install Instala dependências no container"
@echo " lint Verifica ruff check + ruff format (sem alterar)"
@echo " format Corrige com ruff --fix e formata com ruff format"
@echo " test Roda pytest -v com coverage"
@echo " test-cov Gera relatório HTML de coverage"
@echo " show-cov Abre o relatório de coverage no navegador"
@echo " migrate Aplica migrations pendentes"
@echo " makemigrations Gera migrations para mudanças nos models"
@echo " run Sobe o servidor de desenvolvimento"
@echo " shell Abre o Django shell interativo"
@echo " check Roda python manage.py check"
@echo " schema-validate Valida schema OpenAPI (CI gate)"
@echo " ci Roda lint + test + schema-validate (gate de PR)"
@echo " ci-cov Roda lint + test-cov + schema-validate + show-cov (gate de PR com coverage)"
install:
$(DC_EXEC) pip install -r requirements.txt
lint:
$(DC_EXEC) ruff check .
$(DC_EXEC) ruff format --check .
format:
$(DC_EXEC) ruff check . --fix
$(DC_EXEC) ruff format .
test:
$(DC_EXEC) pytest -v
test-cov:
$(DC_EXEC) pytest --cov=. --cov-report=html
show-cov:
@python3 -c "import webbrowser, os; webbrowser.open('file://' + os.path.realpath('htmlcov/index.html'))" || python -c "import webbrowser, os; webbrowser.open('file://' + os.path.realpath('htmlcov/index.html'))"
migrate:
$(DC_EXEC) python manage.py migrate
makemigrations:
$(DC_EXEC) python manage.py makemigrations
run:
docker compose up -d
shell:
$(DC_EXEC) python manage.py shell
check:
$(DC_EXEC) python manage.py check
schema-validate:
docker exec -it shio_api python manage.py spectacular --validate --fail-on-warn --file /tmp/schema.yaml
ci: lint test schema-validate
ci-cov: lint test-cov schema-validate