Skip to content

chore(deps): update dependency pytest-homeassistant-custom-component to v0.13.299 #770

chore(deps): update dependency pytest-homeassistant-custom-component to v0.13.299

chore(deps): update dependency pytest-homeassistant-custom-component to v0.13.299 #770

Workflow file for this run

name: Tests
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
permissions:
contents: read
env:
PYTHON_VERSION: "3.13"
jobs:
# Run all linting, formatting, and static analysis checks via pre-commit
lint-and-scan:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
runs-on: ubuntu-latest
name: Linting and Formatting
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: ${{ env.PYTHON_VERSION }}
activate-environment: true
enable-cache: true
- name: Install dependencies
run: uv sync --all-extras
- name: Run Ruff linting
run: uv run ruff check --fix custom_components tests
- name: Run Ruff formatting
run: uv run ruff format custom_components tests
# Check with Home Assistant's hassfest
hassfest:
permissions:
contents: read
runs-on: ubuntu-latest
name: Hassfest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Run hassfest
uses: home-assistant/actions/hassfest@6778c32c6da322382854bd824e30fd4a4f3c20e5 # master
# Validate HACS compliance
hacs:
runs-on: ubuntu-latest
name: HACS
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: HACS validation
uses: hacs/action@6f81caf1dd4cc0f615444dba4d4a3ceaa22db99c # main
with:
category: integration
# Test the integration
pytest:
permissions:
contents: read
runs-on: ubuntu-latest
name: Run Tests
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit
- name: Check out code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up uv
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
with:
python-version: ${{ env.PYTHON_VERSION }}
activate-environment: true
enable-cache: true
- name: Install dependencies
run: |
# Install dependencies with all extras
uv sync --all-extras
# Verify installation
uv pip list
- name: Verify Python environment
run: |
uv run python --version
uv run python -c "import sys; print('Python executable:', sys.executable)"
uv run python -c "from homeassistant.const import __version__; print('Home Assistant version:', __version__)"
- name: Create Home Assistant config directory
run: mkdir -p /tmp/homeassistant
- name: Run tests with coverage
env:
# Set Python path to include the workspace
PYTHONPATH: ${{ github.workspace }}
# Ensure UTF-8 encoding for tests
PYTHONIOENCODING: utf-8
# Set timezone to avoid any timezone-related test issues
TZ: UTC
# Disable Home Assistant analytics
HA_DISABLE_ANALYTICS: true
# Set Home Assistant configuration directory
HOMEASSISTANT_CONFIG_DIR: /tmp/homeassistant
# Ensure proper locale
LC_ALL: C.UTF-8
LANG: C.UTF-8
run: |
# Run tests using uv environment
uv run python -m pytest tests/ \
--cov=custom_components.autopi \
--cov-report=term-missing \
--cov-report=xml \
--cov-report=html \
--cov-fail-under=10 \
--tb=short \
-v
# Coverage reports are generated locally (see htmlcov/ directory)
# Uncomment below to upload to Codecov (requires CODECOV_TOKEN secret)
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
# All checks must pass
all-checks-pass:
runs-on: ubuntu-latest
name: All Checks Pass
if: success() # Only run this job if all dependencies succeed
needs:
- lint-and-scan
- pytest
- hassfest
- hacs
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
with:
egress-policy: audit
- name: All checks passed
run: echo "✅ All checks passed!"