mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-01-08 22:07:06 +00:00
108 lines
3.3 KiB
YAML
108 lines
3.3 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: ["master", "patch"]
|
|
pull_request:
|
|
branches: ["master", "patch"]
|
|
workflow_dispatch: # to allow manual re-runs
|
|
|
|
env:
|
|
UV_VERSION: 0.4.5
|
|
|
|
jobs:
|
|
linting:
|
|
name: "Perform linting checks"
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.12"]
|
|
|
|
steps:
|
|
- uses: "actions/checkout@v4"
|
|
- name: Setup environment
|
|
uses: ./.github/actions/setup
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
cache-pre-commit: true
|
|
uv-version: ${{ env.UV_VERSION }}
|
|
uv-install-options: "--all-extras"
|
|
- name: "Check supported device md files are up to date"
|
|
run: |
|
|
uv run pre-commit run generate-supported --all-files
|
|
- name: "Linting and code formating (ruff)"
|
|
run: |
|
|
uv run pre-commit run ruff --all-files
|
|
- name: "Typing checks (mypy)"
|
|
run: |
|
|
source .venv/bin/activate
|
|
pre-commit run mypy --all-files
|
|
- name: "Run trailing-whitespace"
|
|
run: |
|
|
uv run pre-commit run trailing-whitespace --all-files
|
|
- name: "Run end-of-file-fixer"
|
|
run: |
|
|
uv run pre-commit run end-of-file-fixer --all-files
|
|
- name: "Run check-docstring-first"
|
|
run: |
|
|
uv run pre-commit run check-docstring-first --all-files
|
|
- name: "Run debug-statements"
|
|
run: |
|
|
uv run pre-commit run debug-statements --all-files
|
|
- name: "Run check-ast"
|
|
run: |
|
|
uv run pre-commit run check-ast --all-files
|
|
|
|
|
|
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.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9", "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.9"
|
|
extras: true
|
|
- os: ubuntu-latest
|
|
python-version: "pypy-3.10"
|
|
extras: true
|
|
- os: ubuntu-latest
|
|
python-version: "3.9"
|
|
extras: true
|
|
- os: ubuntu-latest
|
|
python-version: "3.10"
|
|
extras: true
|
|
|
|
steps:
|
|
- uses: "actions/checkout@v4"
|
|
- name: Setup environment
|
|
uses: ./.github/actions/setup
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
uv-version: ${{ env.UV_VERSION }}
|
|
uv-install-options: ${{ matrix.extras == true && '--all-extras' || '' }}
|
|
- name: "Run tests (no coverage)"
|
|
if: ${{ startsWith(matrix.python-version, 'pypy') }}
|
|
run: |
|
|
uv run pytest
|
|
- name: "Run tests (with coverage)"
|
|
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
|
|
run: |
|
|
uv run pytest --cov kasa --cov-report xml
|
|
- name: "Upload coverage to Codecov"
|
|
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
|
|
uses: "codecov/codecov-action@v4"
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|