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

69 lines
1.8 KiB
YAML
Raw Permalink Normal View History

name: CI
on:
push:
2024-07-04 07:14:01 +00:00
branches: ["master", "patch"]
pull_request:
2024-07-04 07:14:01 +00:00
branches: ["master", "patch"]
workflow_dispatch: # to allow manual re-runs
env:
UV_VERSION: 0.4.16
jobs:
linting:
name: "Perform linting checks"
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
steps:
- name: "Checkout source files"
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: "Run pre-commit checks"
run: |
uv run pre-commit run --all-files --verbose
tests:
name: Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }}
needs: linting
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
os: [ubuntu-latest, macos-latest, windows-latest]
extras: [false, true]
exclude:
- os: macos-latest
extras: true
- os: windows-latest
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 (with coverage)"
run: |
uv run pytest -n auto --cov kasa --cov-report xml
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v4"
with:
token: ${{ secrets.CODECOV_TOKEN }}