Update GitHub Workflows and Actions (#1622)

This PR is to update the GitHub Workflows and Actions to resolve
residual warnings and errors and using the latest versions available.
This commit is contained in:
ZeliardM
2026-02-21 16:09:57 -05:00
committed by GitHub
parent ade64c64af
commit 494db73fa8
5 changed files with 84 additions and 61 deletions

View File

@@ -1,49 +1,50 @@
--- ---
name: Setup Environment name: Setup Environment
description: Install uv, configure the system python, and the package dependencies description: Install uv, configure the system python, and the package dependencies
inputs: inputs:
uv-install-options: uv-install-options:
default: "" default: ""
uv-version: uv-version:
default: 0.4.16 default: 0.9.16
python-version: python-version:
required: true required: true
cache-pre-commit: cache-pre-commit:
default: false default: false
cache-version: cache-version:
default: "v0.1" default: "v0.1"
runs: runs:
using: composite using: composite
steps: steps:
- name: Install uv - name: Setup uv
uses: astral-sh/setup-uv@v3 id: setup-uv
uses: astral-sh/setup-uv@v7
with: with:
enable-cache: true enable-cache: true
- name: "Setup python" - name: Setup Python
uses: "actions/setup-python@v5"
id: setup-python id: setup-python
uses: actions/setup-python@v6
with: with:
python-version: "${{ inputs.python-version }}" python-version: ${{ inputs.python-version }}
allow-prereleases: true allow-prereleases: true
- name: "Install project" - name: Install Project Dependencies
id: install-project-dependencies
shell: bash shell: bash
run: | run: |
uv sync ${{ inputs.uv-install-options }} uv sync ${{ inputs.uv-install-options }}
- name: Read pre-commit version - name: Read pre-commit Version
if: inputs.cache-pre-commit == 'true'
id: pre-commit-version id: pre-commit-version
if: inputs.cache-pre-commit == 'true'
shell: bash shell: bash
run: >- run: >-
echo "pre-commit-version=$(uv run pre-commit -V | awk '{print $2}')" >> $GITHUB_OUTPUT echo "pre-commit-version=$(uv run pre-commit -V | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/cache@v4 - name: pre-commit Cache
id: pre-commit-cache
if: inputs.cache-pre-commit == 'true' if: inputs.cache-pre-commit == 'true'
name: Pre-commit cache uses: actions/cache@v4
with: with:
path: ~/.cache/pre-commit/ path: ~/.cache/pre-commit/
key: cache-${{ inputs.cache-version }}-${{ runner.os }}-${{ runner.arch }}-pre-commit-${{ steps.pre-commit-version.outputs.pre-commit-version }}-python-${{ inputs.python-version }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }} key: cache-${{ inputs.cache-version }}-${{ runner.os }}-${{ runner.arch }}-pre-commit-${{ steps.pre-commit-version.outputs.pre-commit-version }}-python-${{ inputs.python-version }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }}

View File

@@ -1,3 +1,4 @@
---
name: CI name: CI
on: on:
@@ -12,48 +13,49 @@ on:
- 'feat/**' - 'feat/**'
- 'fix/**' - 'fix/**'
- 'janitor/**' - 'janitor/**'
workflow_dispatch: # to allow manual re-runs workflow_dispatch:
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true cancel-in-progress: true
env: env:
UV_VERSION: 0.4.16 UV_VERSION: 0.9.16
jobs: jobs:
linting: lint:
name: "Perform linting checks" name: Perform Lint Checks
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ["3.13"] python-version: [3.13]
steps: steps:
- name: "Checkout source files" - name: Checkout Source Files
uses: "actions/checkout@v4" id: checkout
- name: Setup environment uses: actions/checkout@v6
- name: Setup Environment
id: setup-environment
uses: ./.github/actions/setup uses: ./.github/actions/setup
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
cache-pre-commit: true cache-pre-commit: true
uv-version: ${{ env.UV_VERSION }} uv-version: ${{ env.UV_VERSION }}
uv-install-options: "--all-extras" uv-install-options: --all-extras
- name: "Run pre-commit checks" - name: Run pre-commit Checks
id: run-pre-commit
shell: bash
run: | run: |
uv run pre-commit run --all-files --verbose uv run pre-commit run --all-files --verbose
tests: tests:
name: Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} name: Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }}
needs: linting needs: lint
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
python-version: ["3.11", "3.12", "3.13"] python-version: [3.11, 3.12, 3.13]
os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest, macos-latest, windows-latest]
extras: [false, true] extras: [false, true]
exclude: exclude:
@@ -61,19 +63,27 @@ jobs:
extras: true extras: true
- os: windows-latest - os: windows-latest
extras: true extras: true
steps: steps:
- uses: "actions/checkout@v4" - name: Checkout Source Files
- name: Setup environment id: checkout
uses: actions/checkout@v6
- name: Setup Environment
id: setup-environment
uses: ./.github/actions/setup uses: ./.github/actions/setup
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
uv-version: ${{ env.UV_VERSION }} uv-version: ${{ env.UV_VERSION }}
uv-install-options: ${{ matrix.extras == true && '--all-extras' || '' }} uv-install-options: ${{ matrix.extras == true && '--all-extras' || '' }}
- name: "Run tests (with coverage)"
- name: Run PyTests with Code Coverage
id: run-pytests-with-code-coverage
shell: bash
run: | run: |
uv run pytest -n auto --cov kasa --cov-report xml uv run pytest -n auto --cov kasa --cov-report xml
- name: "Upload coverage to Codecov"
uses: "codecov/codecov-action@v4" - name: Upload Code Coverage to Codecov
id: upload-code-coverage-to-codecov
uses: codecov/codecov-action@v5
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}

View File

@@ -1,4 +1,5 @@
name: "CodeQL checks" ---
name: CodeQL Checks
on: on:
push: push:
@@ -31,16 +32,19 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
language: [ 'python' ] language: [python]
steps: steps:
- name: Checkout repository - name: Checkout Source Files
uses: actions/checkout@v3 id: checkout
uses: actions/checkout@v6
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v2 id: init-codeql
uses: github/codeql-action/init@v4
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2 id: perform-codeql-analysis
uses: github/codeql-action/analyze@v4

View File

@@ -1,33 +1,40 @@
name: Publish packages ---
name: Publish Packages
on: on:
release: release:
types: [published] types: [published]
env: env:
UV_VERSION: 0.4.16 UV_VERSION: 0.9.16
PYTHON_VERSION: 3.12 PYTHON_VERSION: 3.13
jobs: jobs:
build-n-publish: build-n-publish:
name: Build release packages name: Build Release Packages
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: # for trusted publishing permissions:
id-token: write id-token: write
steps: steps:
- name: Checkout source files - name: Checkout Source Files
uses: actions/checkout@v4 id: checkout
uses: actions/checkout@v6
- name: Install uv - name: Setup uv
uses: astral-sh/setup-uv@v3 id: setup-uv
uses: astral-sh/setup-uv@v7
- name: Setup python - name: Setup Python
uses: actions/setup-python@v4 id: setup-python
uses: actions/setup-python@v6
with: with:
python-version: ${{ env.PYTHON_VERSION }} python-version: ${{ env.PYTHON_VERSION }}
- name: Build a binary wheel and a source tarball - name: Build Packages
id: build-packages
shell: bash
run: uv build run: uv build
- name: Publish release on pypi - name: Publish Release on PyPI
id: publish-release-on-pypi
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1

View File

@@ -1,6 +1,6 @@
---
name: Stale name: Stale
# yamllint disable-line rule:truthy
on: on:
schedule: schedule:
- cron: "0 0 * * *" - cron: "0 0 * * *"
@@ -11,8 +11,9 @@ jobs:
if: github.repository_owner == 'python-kasa' if: github.repository_owner == 'python-kasa'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Stale issues and prs - name: Stale Issues and PRs Policy
uses: actions/stale@v9.0.0 id: stale-issues-and-prs-policy
uses: actions/stale@v10
with: with:
repo-token: ${{ github.token }} repo-token: ${{ github.token }}
days-before-stale: 90 days-before-stale: 90
@@ -43,9 +44,9 @@ jobs:
Thank you for your contributions. Thank you for your contributions.
- name: needs-more-information and waiting-for-reporter Stale Issues Policy
- name: Needs-more-information and waiting-for-reporter stale issues policy id: specific-stale-issues-policy
uses: actions/stale@v9.0.0 uses: actions/stale@v10
with: with:
repo-token: ${{ github.token }} repo-token: ${{ github.token }}
only-labels: "needs-more-information,waiting-for-reporter" only-labels: "needs-more-information,waiting-for-reporter"