python-kasa/.github/workflows/ci.yml

109 lines
3.2 KiB
YAML
Raw Normal View History

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@v2"
- uses: "actions/setup-python@v2"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies"
run: |
python -m pip install --upgrade pip poetry
2021-09-23 16:29:45 +00:00
poetry install
- name: "Linting and code formating (ruff)"
2022-02-20 23:56:18 +00:00
run: |
poetry run pre-commit run ruff --all-files
- name: "Typing checks (mypy)"
run: |
poetry run pre-commit run mypy --all-files
- name: "Run trailing-whitespace"
run: |
poetry run pre-commit run trailing-whitespace --all-files
- name: "Run end-of-file-fixer"
run: |
poetry run pre-commit run end-of-file-fixer --all-files
- name: "Run check-docstring-first"
run: |
poetry run pre-commit run check-docstring-first --all-files
- name: "Run debug-statements"
run: |
poetry run pre-commit run debug-statements --all-files
- name: "Run check-ast"
run: |
poetry run pre-commit run check-ast --all-files
- name: "Check README for supported models"
run: |
poetry run python -m devtools.check_readme_vs_fixtures
tests:
name: Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }}
needs: linting
runs-on: ${{ matrix.os }}
continue-on-error: ${{ startsWith(matrix.python-version, 'pypy') }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy-3.8", "pypy-3.10"]
os: [ubuntu-latest, macos-latest, windows-latest]
extras: [false, true]
exclude:
- os: macos-latest
extras: true
- os: windows-latest
extras: true
- os: ubuntu-latest
python-version: "pypy-3.8"
extras: true
- os: ubuntu-latest
python-version: "pypy-3.10"
extras: true
- os: ubuntu-latest
python-version: "3.8"
extras: true
- os: ubuntu-latest
python-version: "3.9"
extras: true
- os: ubuntu-latest
python-version: "3.10"
extras: true
steps:
- uses: "actions/checkout@v3"
- uses: "actions/setup-python@v4"
with:
python-version: "${{ matrix.python-version }}"
- name: "Install dependencies (no extras)"
if: matrix.extras == false
run: |
python -m pip install --upgrade pip poetry
poetry install
- name: "Install dependencies (with extras)"
if: matrix.extras == true
run: |
python -m pip install --upgrade pip poetry
poetry install --all-extras
- name: "Run tests"
run: |
poetry run pytest --cov kasa --cov-report xml
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v3"
with:
token: ${{ secrets.CODECOV_TOKEN }}