Simplify pyproject.toml and fix test implementations #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| name: Lint with Ruff | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff | |
| - name: Lint with Ruff | |
| run: ruff check custom_components/ | |
| format: | |
| runs-on: ubuntu-latest | |
| name: Format Check with Ruff | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff | |
| - name: Check formatting | |
| run: ruff format --check custom_components/ | |
| type-check: | |
| runs-on: ubuntu-latest | |
| name: Type Check with mypy | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install mypy | |
| - name: Type check with mypy | |
| run: mypy custom_components/pecron --ignore-missing-imports | |
| manifest: | |
| runs-on: ubuntu-latest | |
| name: Validate Manifest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Validate manifest.json | |
| run: | | |
| python -c " | |
| import json | |
| with open('custom_components/pecron/manifest.json') as f: | |
| manifest = json.load(f) | |
| assert 'manifest_version' in manifest | |
| assert 'domain' in manifest | |
| assert 'name' in manifest | |
| assert 'codeowners' in manifest | |
| assert 'documentation' in manifest | |
| assert 'requirements' in manifest | |
| assert 'version' in manifest | |
| assert 'homeassistant' in manifest | |
| print('✓ manifest.json is valid') | |
| " | |
| tests: | |
| runs-on: ubuntu-latest | |
| name: Tests | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements-dev.txt | |
| - name: Run tests | |
| run: pytest --cov=custom_components/pecron --cov-report=xml | |
| - name: Upload coverage | |
| uses: codecov/codecov-action@v3 | |
| with: | |
| files: ./coverage.xml |