Fix type checking #307
Workflow file for this run
This file contains 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: | |
- '*' | |
tags-ignore: | |
- 'v*' | |
pull_request: | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- uses: pre-commit/[email protected] | |
tests: | |
name: Run tests (${{ matrix.ha-version }}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- ha-version: '2023.7' | |
latest: true | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: pip | |
cache-dependency-path: tests/requirements_${{ matrix.ha-version }}.txt | |
- name: Install dependencies | |
run: | | |
pip install -r tests/requirements_${{ matrix.ha-version }}.txt | |
# https://github.com/python/mypy/issues/8545 | |
- name: Fix homeassistant type checking | |
run: | | |
python -c 'from pathlib import Path; import homeassistant; (Path(homeassistant.__file__).parent / Path("py.typed")).touch()' | |
- name: Type checking | |
run: mypy . | |
- name: Test with pytest | |
run: pytest --cov-report xml --cov | |
- name: Upload coverage report | |
uses: codecov/codecov-action@v2 | |
if: ${{ matrix.latest == true }} | |
validate: | |
name: Validate for HACS | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
- name: HACS validation | |
uses: hacs/action@main | |
with: | |
category: integration |