-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (67 loc) · 3.25 KB
/
Makefile
File metadata and controls
94 lines (67 loc) · 3.25 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
.DEFAULT_GOAL := help
MANIFEST := custom_components/hitachi_yutaki/manifest.json
VERSION := $(shell python3 -c "import json;print(json.load(open('$(MANIFEST)'))['version'])")
# —— Setup ——————————————————————————————————————————————
.PHONY: install
install: ## Install all dependencies (dev included)
uv sync --group dev
.PHONY: setup
setup: ## Full project setup (deps + pre-commit hooks + system libs)
./scripts/setup
.PHONY: upgrade-deps
upgrade-deps: ## Upgrade all deps (HA version follows pytest-homeassistant-custom-component)
uv lock --upgrade
uv sync --group dev
# —— Quality ————————————————————————————————————————————
.PHONY: lint
lint: ## Run ruff linter with auto-fix
uv run ruff check custom_components tests --fix
.PHONY: format
format: ## Run ruff formatter
uv run ruff format custom_components tests
.PHONY: check
check: lint format ## Run all code quality checks (lint + format)
.PHONY: pre-commit
pre-commit: ## Run all pre-commit hooks on the entire codebase
uv run pre-commit run --all-files
# —— Testing ————————————————————————————————————————————
.PHONY: test
test: ## Run all tests
uv run pytest
.PHONY: test-domain
test-domain: ## Run domain layer tests only (pure Python, no HA)
uv run pytest tests/domain/
.PHONY: test-verbose
test-verbose: ## Run all tests with verbose output
uv run pytest -v
.PHONY: test-coverage
test-coverage: ## Run tests with coverage report
uv run pytest --cov=custom_components/hitachi_yutaki --cov-report=term-missing
# —— Home Assistant ————————————————————————————————————
.PHONY: ha-run
ha-run: ## Start a local HA dev instance with debug config
./scripts/develop
.PHONY: ha-upgrade
ha-upgrade: ## Temporary HA upgrade (reset by make install)
./scripts/upgrade
.PHONY: ha-dev-branch
ha-dev-branch: ## Temporary HA dev branch (reset by make install)
./scripts/dev-branch
.PHONY: ha-version
ha-version: ## Temporary HA specific version (reset by make install)
./scripts/specific-version
# —— Release ———————————————————————————————————————————
.PHONY: bump
bump: ## Bump version — usage: make bump [PART=patch|minor|major|beta] (default: patch)
@python3 scripts/bump_version.py $(PART)
.PHONY: version
version: ## Show current version
@echo $(VERSION)
# —— Diagnostics ———————————————————————————————————————
.PHONY: scan
scan: ## Scan Modbus gateway registers (use SCAN_ARGS for options, redirect stdout for file output)
uv run python scripts/scan_gateway.py $(SCAN_ARGS)
# —— Help ——————————————————————————————————————————————
.PHONY: help
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-16s\033[0m %s\n", $$1, $$2}'