2021-09-23 16:25:41 +00:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-07-04 07:14:01 +00:00
|
|
|
branches: ["master", "patch"]
|
2021-09-23 16:25:41 +00:00
|
|
|
pull_request:
|
2024-07-04 07:14:01 +00:00
|
|
|
branches: ["master", "patch"]
|
2021-09-23 16:25:41 +00:00
|
|
|
workflow_dispatch: # to allow manual re-runs
|
|
|
|
|
2024-04-13 17:56:55 +00:00
|
|
|
env:
|
2024-09-27 09:27:53 +00:00
|
|
|
UV_VERSION: 0.4.16
|
2021-09-23 16:25:41 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
linting:
|
|
|
|
name: "Perform linting checks"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-10-29 23:22:30 +00:00
|
|
|
python-version: ["3.12"]
|
2021-09-23 16:25:41 +00:00
|
|
|
|
|
|
|
steps:
|
2024-09-27 09:27:53 +00:00
|
|
|
- name: "Checkout source files"
|
|
|
|
uses: "actions/checkout@v4"
|
2024-04-13 17:56:55 +00:00
|
|
|
- name: Setup environment
|
|
|
|
uses: ./.github/actions/setup
|
2021-09-23 16:25:41 +00:00
|
|
|
with:
|
2024-04-13 17:56:55 +00:00
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
cache-pre-commit: true
|
2024-09-06 14:48:43 +00:00
|
|
|
uv-version: ${{ env.UV_VERSION }}
|
|
|
|
uv-install-options: "--all-extras"
|
2024-09-27 09:27:53 +00:00
|
|
|
|
|
|
|
- name: "Run pre-commit checks"
|
2021-09-23 16:25:41 +00:00
|
|
|
run: |
|
2024-09-27 09:27:53 +00:00
|
|
|
uv run pre-commit run --all-files --verbose
|
2024-01-23 10:14:59 +00:00
|
|
|
|
2021-09-23 16:25:41 +00:00
|
|
|
|
|
|
|
tests:
|
2023-06-30 00:43:01 +00:00
|
|
|
name: Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }}
|
2021-09-23 16:25:41 +00:00
|
|
|
needs: linting
|
|
|
|
runs-on: ${{ matrix.os }}
|
2024-02-27 14:58:06 +00:00
|
|
|
continue-on-error: ${{ startsWith(matrix.python-version, 'pypy') }}
|
2021-09-23 16:25:41 +00:00
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-08-06 19:03:35 +00:00
|
|
|
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9", "pypy-3.10"]
|
2021-09-23 16:25:41 +00:00
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2023-06-30 00:43:01 +00:00
|
|
|
extras: [false, true]
|
|
|
|
exclude:
|
|
|
|
- os: macos-latest
|
|
|
|
extras: true
|
|
|
|
- os: windows-latest
|
|
|
|
extras: true
|
|
|
|
- os: ubuntu-latest
|
2024-04-16 18:21:20 +00:00
|
|
|
python-version: "pypy-3.9"
|
2023-06-30 00:43:01 +00:00
|
|
|
extras: true
|
2023-10-29 23:22:30 +00:00
|
|
|
- os: ubuntu-latest
|
|
|
|
python-version: "pypy-3.10"
|
|
|
|
extras: true
|
2023-06-30 00:43:01 +00:00
|
|
|
- os: ubuntu-latest
|
|
|
|
python-version: "3.9"
|
|
|
|
extras: true
|
|
|
|
- os: ubuntu-latest
|
|
|
|
python-version: "3.10"
|
|
|
|
extras: true
|
2024-09-27 09:27:53 +00:00
|
|
|
# Exclude pypy on windows due to significant performance issues
|
|
|
|
# running pytest requires ~12 min instead of 2 min on other platforms
|
|
|
|
- os: windows-latest
|
|
|
|
python-version: "pypy-3.9"
|
|
|
|
- os: windows-latest
|
|
|
|
python-version: "pypy-3.10"
|
|
|
|
|
2021-09-23 16:25:41 +00:00
|
|
|
|
|
|
|
steps:
|
2024-03-06 15:23:31 +00:00
|
|
|
- uses: "actions/checkout@v4"
|
2024-04-13 17:56:55 +00:00
|
|
|
- name: Setup environment
|
|
|
|
uses: ./.github/actions/setup
|
2021-09-23 16:25:41 +00:00
|
|
|
with:
|
2024-04-13 17:56:55 +00:00
|
|
|
python-version: ${{ matrix.python-version }}
|
2024-09-06 14:48:43 +00:00
|
|
|
uv-version: ${{ env.UV_VERSION }}
|
|
|
|
uv-install-options: ${{ matrix.extras == true && '--all-extras' || '' }}
|
2024-03-06 15:23:31 +00:00
|
|
|
- name: "Run tests (no coverage)"
|
|
|
|
if: ${{ startsWith(matrix.python-version, 'pypy') }}
|
|
|
|
run: |
|
2024-09-27 09:27:53 +00:00
|
|
|
uv run pytest -n auto
|
2024-03-06 15:23:31 +00:00
|
|
|
- name: "Run tests (with coverage)"
|
|
|
|
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
|
2021-09-23 16:25:41 +00:00
|
|
|
run: |
|
2024-09-27 09:27:53 +00:00
|
|
|
uv run pytest -n auto --cov kasa --cov-report xml
|
2021-09-23 16:25:41 +00:00
|
|
|
- name: "Upload coverage to Codecov"
|
2024-04-25 12:02:17 +00:00
|
|
|
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
|
2024-04-16 18:21:20 +00:00
|
|
|
uses: "codecov/codecov-action@v4"
|
2021-09-23 16:25:41 +00:00
|
|
|
with:
|
2022-10-17 16:08:26 +00:00
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|