-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (97 loc) · 4.39 KB
/
Copy pathMakefile
File metadata and controls
120 lines (97 loc) · 4.39 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
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Makefile for Schema Development Environment
.PHONY: all help up down shell validate release test repo.init infra.deps infra.coverage infra.clean fmt lint check typecheck build
# Default to showing help
all: help
# =============================================================================
# Container Lifecycle Management
# =============================================================================
up:
@echo "--- Starting development environment in the background ---"
@docker compose up -d builder
down:
@echo "--- Stopping development environment ---"
@docker compose down -v
shell:
@echo "--- Opening a shell into the running builder container ---"
@docker compose exec builder bash
build:
@echo "--- Building Docker images ---"
@docker compose build
# =============================================================================
# Main Development Tasks
# =============================================================================
validate:
@echo "--- Validating all schemas against the meta-schema ---"
@docker compose exec builder python tools/compiler.py validate
release:
@echo "--- Building and signing release schemas ---"
@docker compose exec builder python tools/compiler.py release
@tools/release.sh project.yaml
@git add project.yaml
test:
@echo "--- Running pytest for the compiler infrastructure ---"
@docker compose exec builder python -m pytest --cov=tools.compiler --cov-report=term-missing tests/
fmt:
@echo "--- Formatting Python code with Black and Isort ---"
@docker compose exec builder python -m black .
@docker compose exec builder python -m isort .
lint:
@echo "--- Linting Python code with Ruff ---"
@docker compose exec builder python -m ruff check .
@echo "--- Linting YAML files with yamllint ---"
@docker compose exec builder python -m yamllint .
typecheck:
@echo "--- Running static type checking with MyPy ---"
@docker compose exec builder python -m mypy .
check: fmt lint typecheck
@echo "--- Running all code quality checks (format, lint, typecheck) ---"
# =============================================================================
# Repository Setup
# =============================================================================
repo.init:
@echo "--- Initializing repository hooks ---"
@sh tools/init-hooks.sh
# =============================================================================
# Infrastructure & Maintenance Tasks
# =============================================================================
infra.deps:
@echo "--- Initializing Python dependencies into ./p_venv cache ---"
@docker compose run --rm setup
infra.coverage:
@echo "--- Generating HTML coverage report ---"
@docker compose exec builder python -m pytest --cov=tools.compiler --cov-report=html
@echo "HTML coverage report generated in ./htmlcov/index.html"
infra.clean:
@echo "--- Cleaning up all generated files and caches ---"
@docker compose down -v --remove-orphans
@rm -rf ./p_venv
@rm -f ./requirements.txt
@rm -rf ./htmlcov
# =============================================================================
# Help
# =============================================================================
help:
@echo "Usage: make [target]"
@echo ""
@echo "Container Lifecycle:"
@echo " up Start the development container in the background."
@echo " down Stop and remove the development container."
@echo " shell Open an interactive shell into the running container."
@echo " build Build Docker images."
@echo ""
@echo "Main Tasks:"
@echo " validate Run fast, offline validation of all schemas."
@echo " release Build, checksum, and sign all non-dev schemas (requires Vault)."
@echo " test Run pytest for the compiler infrastructure code."
@echo " fmt Format Python code with Black and Isort."
@echo " lint Lint Python code with Ruff and YAML files with yamllint."
@echo " typecheck Run static type checking with MyPy."
@echo " check Run all code quality checks (fmt, lint, typecheck)."
@echo ""
@echo "Repository Setup:"
@echo " repo.init Set up the Git hooks for this repository (pre-commit, commit-msg)."
@echo ""
@echo "Infrastructure & Maintenance:"
@echo " infra.deps (Re)generate requirements.txt and install dependencies into the cache."
@echo " infra.coverage Generate HTML coverage report."
@echo " infra.clean Remove all generated files, caches, and stopped containers."