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:
|
2024-11-18 18:46:36 +00:00
|
|
|
python-version: ["3.13"]
|
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 }}
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-11-18 18:46:36 +00:00
|
|
|
python-version: ["3.11", "3.12", "3.13"]
|
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
|
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 (with coverage)"
|
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-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 }}
|