Validate Home Assistant Configuration / YAML Lint (push) Successful in 8s
Validate Home Assistant Configuration / Home Assistant Config Check (push) Failing after 19s
Validate Home Assistant Configuration / Validate Entity IDs (push) Failing after 17s
Validate Home Assistant Configuration / Validate Device IDs (push) Failing after 17s
Validate Home Assistant Configuration / YAML Lint (pull_request) Successful in 8s
Validate Home Assistant Configuration / Home Assistant Config Check (pull_request) Failing after 20s
Validate Home Assistant Configuration / Validate Entity IDs (pull_request) Failing after 18s
Validate Home Assistant Configuration / Validate Device IDs (pull_request) Failing after 16s
141 lines
3.8 KiB
YAML
141 lines
3.8 KiB
YAML
name: Validate Home Assistant Configuration
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
paths:
|
|
- 'config/**'
|
|
- 'utils/validation/**'
|
|
- '.gitea/workflows/validate.yml'
|
|
pull_request:
|
|
paths:
|
|
- 'config/**'
|
|
- 'utils/validation/**'
|
|
|
|
jobs:
|
|
yamllint:
|
|
name: YAML Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Install yamllint
|
|
run: pip install yamllint>=1.35.0
|
|
|
|
- name: Run yamllint
|
|
run: yamllint config/
|
|
|
|
ha-config-check:
|
|
name: Home Assistant Config Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Generate secrets.yaml
|
|
env:
|
|
DB_USER: ${{ secrets.DB_USER }}
|
|
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
|
POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }}
|
|
POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }}
|
|
DB_NAME: ${{ secrets.DB_NAME }}
|
|
run: |
|
|
python3 << 'EOF'
|
|
import os
|
|
from urllib.parse import quote_plus
|
|
|
|
# URL-encode password for PostgreSQL connection string
|
|
db_user = os.environ['DB_USER']
|
|
db_password = quote_plus(os.environ['DB_PASSWORD'])
|
|
db_host = os.environ['POSTGRES_HOST']
|
|
db_port = os.environ['POSTGRES_PORT']
|
|
db_name = os.environ['DB_NAME']
|
|
|
|
# Generate secrets.yaml
|
|
secrets_content = f"""# Auto-generated secrets.yaml for CI validation
|
|
recorder_db: "postgresql://{db_user}:{db_password}@{db_host}:{db_port}/{db_name}"
|
|
"""
|
|
|
|
with open('config/secrets.yaml', 'w') as f:
|
|
f.write(secrets_content)
|
|
|
|
print("✓ Generated secrets.yaml")
|
|
EOF
|
|
|
|
- name: Debug - List config files
|
|
run: |
|
|
echo "Current directory: $(pwd)"
|
|
echo "Config directory contents:"
|
|
ls -la config/
|
|
|
|
- name: Validate HA Config with Docker
|
|
run: |
|
|
docker run --rm \
|
|
-v "$(pwd)/config":/config \
|
|
-w /config \
|
|
homeassistant/home-assistant:latest \
|
|
python -m homeassistant --script check_config --config /config
|
|
|
|
validate-entities:
|
|
name: Validate Entity IDs
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -e .
|
|
|
|
- name: Run entity validation
|
|
env:
|
|
POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }}
|
|
POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }}
|
|
DB_NAME: ${{ secrets.DB_NAME }}
|
|
DB_READONLY_USER: ${{ secrets.DB_READONLY_USER }}
|
|
DB_READONLY_PASSWORD: ${{ secrets.DB_READONLY_PASSWORD }}
|
|
run: |
|
|
python utils/validation/validate_entities.py config/
|
|
|
|
validate-devices:
|
|
name: Validate Device IDs
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.12'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install -e .
|
|
|
|
- name: Run device validation
|
|
env:
|
|
HA_HOST: ${{ secrets.HA_HOST }}
|
|
HA_TOKEN: ${{ secrets.HA_TOKEN }}
|
|
run: |
|
|
python utils/validation/validate_devices.py config/
|