Repository navigation
146 lines (135 loc) · 4.76 KB
/
Copy pathvalidate.yml
File metadata and controls
146 lines (135 loc) · 4.76 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: Validate
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
hassfest:
name: hassfest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: home-assistant/actions/hassfest@master
hacs:
name: HACS validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hacs/action@main
with:
category: integration
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install ruff
- run: ruff check custom_components/ tests/ scripts/
- run: ruff format --check custom_components/ tests/ scripts/
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install -r requirements_dev.txt
- run: pytest tests/ -v --tb=short
current-home-assistant:
name: Home Assistant 2026.10.4
# setup-python's 3.14.2 build is published for 24.04, not 26.04.
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.14.2"
# The test fixture package pins HA 2026.10.3 until its next release.
# Install its fixture dependencies first, then test the 2026.10.4 patch.
- run: pip install -r requirements_dev.txt "homeassistant==2026.10.3"
- run: pip install --no-deps --upgrade "homeassistant==2026.10.4"
- name: Confirm tested Home Assistant version
run: python -c "from homeassistant.const import __version__; assert __version__ == '2026.10.4', __version__"
- run: pytest tests/ -v --tb=short
minimum-home-assistant:
name: Minimum supported Home Assistant
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
# HA 2024.6's ACME stack imports ComparableX509, removed in josepy 2.
- run: pip install "homeassistant==2024.6.0" "josepy<2" "pytest>=8,<9" "pytest-socket>=0.7"
- run: PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 pytest tests/test_entity_contracts.py -q
no-bytecode:
name: No bytecode in repo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fail if __pycache__ or .pyc files are tracked by git
run: |
if git ls-files | grep -E '(__pycache__|\.pyc$|\.pyo$)'; then
echo "ERROR: Bytecode files are tracked by git."
echo "Fix: git rm -r --cached custom_components/ws_core/__pycache__"
exit 1
fi
echo "OK: No bytecode files tracked."
version-consistency:
name: Version consistency
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Check manifest == pyproject
run: |
python - <<'PY'
import json, pathlib, sys
root = pathlib.Path(".")
manifest = json.loads((root / "custom_components/ws_core/manifest.json").read_text())
v = manifest["version"]
pyproject = (root / "pyproject.toml").read_text()
const = (root / "custom_components/ws_core/const.py").read_text()
errors = []
if f'version = "{v}"' not in pyproject:
errors.append(f"pyproject.toml does not embed version {v!r}")
if f'_INTEGRATION_VERSION = "{v}"' not in const:
errors.append(f"const.py does not embed version {v!r}")
# diagnostics.py reads the version from manifest.json at runtime (it does
# not embed a literal), so there is nothing to grep there -- the runtime
# behaviour is covered by tests/test_integration.py::test_diagnostics_version.
if errors:
for e in errors:
print("ERROR:", e)
sys.exit(1)
print(f"OK: version {v!r} consistent across manifest.json, pyproject.toml and const.py")
PY
entity-validator:
name: Dashboard entity validator
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install pyyaml
- name: Validate dashboard entity references
run: python scripts/validate_dashboard_entities.py
docs:
name: Docs strict build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install mkdocs-material
- run: mkdocs build --strict