Skip to content

[Sub] Add CI/CD Workflow with Automated Testing and Coverage Reporting #19

Description

@switch180

Parent Issue: #4 Zero Test Coverage

Objective

Set up GitHub Actions CI/CD workflow to run tests automatically on every push/PR with coverage reporting.

Workflow Requirements

Test Execution

  • Run on push to main branch
  • Run on all pull requests
  • Test against multiple Python versions (3.11, 3.12, 3.13)
  • Test against multiple HA versions (latest stable + beta)

Coverage Reporting

  • Generate coverage report with pytest-cov
  • Upload coverage to Codecov or similar
  • Fail if coverage drops below threshold (e.g., 80%)
  • Display coverage badge in README

Code Quality Checks

  • Run ruff linting
  • Run type checking (mypy/pyright)
  • Check code formatting
  • Validate manifest.json

Workflow Configuration

# .github/workflows/test.yml
name: Test

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: ["3.11", "3.12", "3.13"]
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          pip install -r requirements.txt
          pip install pytest pytest-cov pytest-homeassistant-custom-component
      - name: Run tests
        run: pytest --cov=custom_components.riverlink --cov-report=xml
      - name: Upload coverage
        uses: codecov/codecov-action@v4

Additional Workflows

Release Workflow

  • Automatic version tagging
  • Generate release notes from commits
  • Validate HACS compatibility

Lint Workflow

  • Run ruff on every PR
  • Auto-format suggestions

Success Criteria

  • All tests pass on CI
  • Coverage report generated and uploaded
  • Badge displays in README
  • Workflow runs on every PR
  • Fast execution (<5 minutes)

References

Priority

🟡 Medium - Automation infrastructure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions