Skip to content

docs(#307): re-crop dependency UI screenshot without HA sidebar #750

docs(#307): re-crop dependency UI screenshot without HA sidebar

docs(#307): re-crop dependency UI screenshot without HA sidebar #750

Workflow file for this run

name: Tests
on:
push:
branches: [develop, main]
pull_request:
branches: [develop, main]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio pytest-cov freezegun homeassistant
- name: Set up importable package structure
run: |
# Create custom_components structure outside the checkout
# so pytest doesn't try to collect __init__.py from repo root
mkdir -p /tmp/ha-config/custom_components
cp -r $GITHUB_WORKSPACE /tmp/ha-config/custom_components/solar_energy_management
- name: Run tests with coverage
working-directory: /tmp/ha-config
env:
PYTHONPATH: /tmp/ha-config
run: |
python -m pytest custom_components/solar_energy_management/tests/ \
--cov=custom_components.solar_energy_management \
--cov-report=term-missing \
--cov-report=xml:$GITHUB_WORKSPACE/coverage.xml \
-v --tb=short
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-py${{ matrix.python-version }}
path: coverage.xml
- name: Coverage summary
if: always()
working-directory: /tmp/ha-config
env:
PYTHONPATH: /tmp/ha-config
run: |
python -m pytest custom_components/solar_energy_management/tests/ \
--cov=custom_components.solar_energy_management \
--cov-report=term \
-q --no-header 2>&1 | tail -30 || true
card-test:
# Dashboard-card JS unit tests (no browser): guards the load-device
# configure modal pre-fill + control mapping (#219), which Python CI
# can't see since it's frontend rendering.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Run card unit tests
working-directory: dashboard/card
run: node --test