| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- name: Validate
- on:
- push:
- branches: [main]
- pull_request:
- branches: [main]
- permissions:
- contents: read
- jobs:
- lint:
- name: Lint & validate integration
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - name: Set up Python
- uses: actions/setup-python@v5
- with:
- python-version: "3.12"
- - name: Install dependencies
- run: |
- pip install --quiet --upgrade pip
- pip install --quiet voluptuous requests pycryptodome
- - name: Validate custom_components/solar_of_things/manifest.json
- run: |
- python3 - <<'PY'
- import json, sys
- m = json.load(open("custom_components/solar_of_things/manifest.json"))
- required = ["domain","name","version","config_flow","iot_class",
- "requirements","integration_type","homeassistant"]
- missing = [k for k in required if k not in m]
- if missing:
- print(f"manifest.json missing keys: {missing}")
- sys.exit(1)
- print(f"manifest.json OK (version={m['version']}, type={m['integration_type']})")
- PY
- - name: Validate hacs.json
- run: |
- python3 - <<'PY'
- import json, sys
- h = json.load(open("hacs.json"))
- required = ["name", "homeassistant"]
- missing = [k for k in required if k not in h]
- if missing:
- print(f"hacs.json missing keys: {missing}")
- sys.exit(1)
- print(f"hacs.json OK (name={h['name']}, homeassistant={h['homeassistant']})")
- PY
- - name: Validate strings / translations sync
- run: |
- python3 - <<'PY'
- import json, sys
- s = json.load(open("custom_components/solar_of_things/strings.json"))
- t = json.load(open("custom_components/solar_of_things/translations/en.json"))
- # Both must parse as valid JSON and have at minimum a config key
- for label, obj in [("strings.json", s), ("translations/en.json", t)]:
- if "config" not in obj:
- print(f"{label} missing 'config' key")
- sys.exit(1)
- print(f"{label} OK")
- PY
- - name: Check Python syntax
- run: |
- cd custom_components/solar_of_things
- python3 -m py_compile \
- __init__.py api.py config_flow.py const.py \
- sensor.py number.py select.py switch.py
- echo "Python syntax OK"
- - name: Run unit tests (if present)
- run: |
- pip install --quiet pytest pytest-asyncio || true
- if [ -d tests ]; then
- python3 -m pytest tests/ -v --tb=short \
- || echo "Tests done (failures allowed on CI without full HA fixtures)"
- else
- echo "No tests directory — skipping"
- fi
|