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@v6 - name: Set up Python uses: actions/setup-python@v6 with: python-version: "3.12" - name: Install dependencies run: | pip install --quiet --upgrade pip pip install --quiet voluptuous requests pycryptodome - name: Validate 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']}, ha>={m['homeassistant']}") 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 base = "custom_components/solar_of_things" for label, path in [ ("strings.json", f"{base}/strings.json"), ("translations/en.json", f"{base}/translations/en.json"), ]: obj = json.load(open(path)) if "config" not in obj: print(f"{label} missing required '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 completed (failures tolerated without full HA fixtures)" else echo "No tests directory — skipping" fi