-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (57 loc) · 2.23 KB
/
Makefile
File metadata and controls
76 lines (57 loc) · 2.23 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
PYTHON ?= python3
FRONTEND_DIR := frontend
.DEFAULT_GOAL := help
.PHONY: help setup deps deps-backend deps-frontend build-frontend build-frontend-less lint lint-backend lint-frontend lint-frontend-less test test-backend test-frontend develop
# Show available targets and their descriptions.
help:
@awk 'BEGIN {FS = ": *"} /^# [A-Za-z_.-]+/ {sub(/^# /, "", $$0); desc=$$0; next} /^[a-zA-Z0-9_.-]+:/{printf "%-18s %s\n", $$1, desc; desc=""}' $(MAKEFILE_LIST)
# Install backend and frontend dependencies.
setup: deps
# Install backend and frontend dependencies.
deps: deps-backend deps-frontend
# Install backend Python dependencies.
deps-backend:
$(PYTHON) -m pip install -r requirements.txt
# Install frontend Node dependencies.
deps-frontend:
cd $(FRONTEND_DIR) && npm ci
# Build all parts of the integration.
build: build-frontend
# Build the frontend bundle.
build-frontend: deps-frontend build-frontend-less
cd $(FRONTEND_DIR) && npm run build
# Compile LESS assets for the frontend.
build-frontend-less:
cd $(FRONTEND_DIR) && npm run build:less
# Run all linters.
lint: lint-backend lint-frontend
# Lint backend with Ruff.
lint-backend: deps-backend
$(PYTHON) -m ruff format . --check
$(PYTHON) -m ruff check .
# Lint frontend TypeScript and LeSS assets.
lint-frontend: deps-frontend
cd $(FRONTEND_DIR) && npm run lint
# Lint frontend TypeScript.
lint-frontend-ts: deps-frontend
cd $(FRONTEND_DIR) && npm run lint:ts
# Lint frontend LeSS with Stylelint.
lint-frontend-less: deps-frontend
cd $(FRONTEND_DIR) && npm run lint:less
# Run backend and frontend tests.
test: test-backend test-frontend
# Run backend pytest with coverage and junit output.
test-backend: deps-backend
$(PYTHON) -m pytest --cov=custom_components/maint --cov-report=xml --junitxml=junit.xml
$(PYTHON) -m coverage report
# Run frontend vitest with coverage and junit output.
test-frontend: deps-frontend
cd $(FRONTEND_DIR) && npm test -- --coverage
# Run Home Assistant locally for development.
launch: deps-backend build-frontend
@set -e; \
if [ ! -d "$(CURDIR)/config" ]; then \
mkdir -p "$(CURDIR)/config"; \
hass --config "$(CURDIR)/config" --script ensure_config; \
fi; \
PYTHONPATH="$$PYTHONPATH:$(CURDIR)/custom_components" hass --config "$(CURDIR)/config" --debug