Skip to content

Update pre-commit hooks & dependencies #1616

Update pre-commit hooks & dependencies

Update pre-commit hooks & dependencies #1616

Workflow file for this run

name: CI
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
workflow_dispatch: # to allow manual re-runs
jobs:
linting:
name: "Perform linting checks"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip poetry
poetry install --extras docs
- name: "Run pyupgrade"
run: |
poetry run pre-commit run pyupgrade --all-files
- name: "Code formating (black)"
run: |
poetry run pre-commit run black --all-files
- name: "Code formating (flake8)"
run: |
poetry run pre-commit run flake8 --all-files
- name: "Order of imports (isort)"
run: |
poetry run pre-commit run isort --all-files
# - name: "Docstring formating (docformatter)"
# run: |
# poetry run pre-commit run docformatter --all-files
- name: "Potential security issues (bandit)"
run: |
poetry run pre-commit run bandit --all-files
- name: "Documentation build (sphinx)"
run: |
poetry run sphinx-build docs/ generated_docs
- name: "Typing checks (mypy)"
run: |
poetry run pre-commit run mypy --all-files
tests:
name: "Python ${{ matrix.python-version}} on ${{ matrix.os }}"
needs: linting
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8"]
os: [ubuntu-latest, macos-latest, windows-latest]
# Exclude example, in case needed again in the future:
# exclude:
# - python-version: pypy3.8
# os: macos-latest
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip poetry
poetry install --extras docs
- name: "Run tests"
run: |
poetry run pytest --cov miio --cov-report xml
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v3"
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}