From db453994c9386aeff33d9ea43519994a615da83a Mon Sep 17 00:00:00 2001 From: ZeliardM Date: Mon, 8 Dec 2025 14:02:18 -0500 Subject: [PATCH 1/2] Update GitHub Workflows and Actions --- .github/actions/setup/action.yaml | 27 +++++++------- .github/workflows/ci.yml | 53 ++++++++++++++++----------- .github/workflows/codeql-analysis.yml | 16 +++++--- .github/workflows/publish.yml | 35 +++++++++++------- .github/workflows/stale.yml | 13 ++++--- 5 files changed, 83 insertions(+), 61 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 490adaef0..b075d4514 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -1,49 +1,50 @@ --- name: Setup Environment description: Install uv, configure the system python, and the package dependencies - inputs: uv-install-options: default: "" uv-version: - default: 0.4.16 + default: 0.9.16 python-version: required: true cache-pre-commit: default: false cache-version: default: "v0.1" - runs: using: composite steps: - - name: Install uv - uses: astral-sh/setup-uv@v3 + - name: Setup uv + id: setup-uv + uses: astral-sh/setup-uv@v7 with: enable-cache: true - - name: "Setup python" - uses: "actions/setup-python@v5" + - name: Setup Python id: setup-python + uses: actions/setup-python@v6 with: - python-version: "${{ inputs.python-version }}" + python-version: ${{ inputs.python-version }} allow-prereleases: true - - name: "Install project" + - name: Install Project Dependencies + id: install-project-dependencies shell: bash run: | uv sync ${{ inputs.uv-install-options }} - - name: Read pre-commit version - if: inputs.cache-pre-commit == 'true' + - name: Read pre-commit Version id: pre-commit-version + if: inputs.cache-pre-commit == 'true' shell: bash run: >- 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' - name: Pre-commit cache + uses: actions/cache@v4 with: 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') }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index abe016518..75fd60f94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,4 @@ +--- name: CI on: @@ -12,48 +13,49 @@ on: - 'feat/**' - 'fix/**' - 'janitor/**' - workflow_dispatch: # to allow manual re-runs + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true env: - UV_VERSION: 0.4.16 + UV_VERSION: 0.9.16 jobs: - linting: - name: "Perform linting checks" + lint: + name: Perform Lint Checks runs-on: ubuntu-latest - strategy: matrix: - python-version: ["3.13"] - + python-version: [3.13] steps: - - name: "Checkout source files" - uses: "actions/checkout@v4" - - name: Setup environment + - name: Checkout Source Files + id: checkout + uses: actions/checkout@v6 + + - name: Setup Environment + id: 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" + uv-install-options: --all-extras - - name: "Run pre-commit checks" + - name: Run pre-commit Checks + id: run-pre-commit + shell: bash run: | uv run pre-commit run --all-files --verbose - tests: name: Python ${{ matrix.python-version}} on ${{ matrix.os }}${{ fromJSON('[" (extras)", ""]')[matrix.extras == ''] }} - needs: linting + needs: lint runs-on: ${{ matrix.os }} - strategy: matrix: - python-version: ["3.11", "3.12", "3.13"] + python-version: [3.11, 3.12, 3.13] os: [ubuntu-latest, macos-latest, windows-latest] extras: [false, true] exclude: @@ -61,19 +63,26 @@ jobs: extras: true - os: windows-latest extras: true - steps: - - uses: "actions/checkout@v4" - - name: Setup environment + - name: Checkout Source Files + id: checkout + uses: actions/checkout@v6 + + - name: Setup Environment + id: 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)" + + - name: Run PyTests with Code Coverage + id: run-pytests-with-code-coverage + shell: bash run: | 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 + uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 016ff0c30..b9e1479cf 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,4 +1,5 @@ -name: "CodeQL checks" +--- +name: CodeQL Checks on: push: @@ -31,16 +32,19 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'python' ] + language: [python] steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout Source Files + id: checkout + uses: actions/checkout@v6 - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + id: init-codeql + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + id: perform-codeql-analysis + uses: github/codeql-action/analyze@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9c1837f0c..92a9b319d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,33 +1,40 @@ -name: Publish packages +--- +name: Publish Packages + on: release: types: [published] env: - UV_VERSION: 0.4.16 - PYTHON_VERSION: 3.12 + UV_VERSION: 0.9.16 + PYTHON_VERSION: 3.13 jobs: build-n-publish: - name: Build release packages + name: Build Release Packages runs-on: ubuntu-latest - permissions: # for trusted publishing + permissions: id-token: write - steps: - - name: Checkout source files - uses: actions/checkout@v4 + - name: Checkout Source Files + id: checkout + uses: actions/checkout@v6 - - name: Install uv - uses: astral-sh/setup-uv@v3 + - name: Setup uv + id: setup-uv + uses: astral-sh/setup-uv@v7 - - name: Setup python - uses: actions/setup-python@v4 + - name: Setup Python + id: setup-python + uses: actions/setup-python@v6 with: 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 - - name: Publish release on pypi + - name: Publish Release on PyPI + id: publish-release-on-pypi uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 294b4e1f8..087777a94 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,6 +1,6 @@ +--- name: Stale -# yamllint disable-line rule:truthy on: schedule: - cron: "0 0 * * *" @@ -11,8 +11,9 @@ jobs: if: github.repository_owner == 'python-kasa' runs-on: ubuntu-latest steps: - - name: Stale issues and prs - uses: actions/stale@v9.0.0 + - name: Stale Issues and PRs Policy + id: stale-issues-and-prs-policy + uses: actions/stale@v10 with: repo-token: ${{ github.token }} days-before-stale: 90 @@ -43,9 +44,9 @@ jobs: Thank you for your contributions. - - - name: Needs-more-information and waiting-for-reporter stale issues policy - uses: actions/stale@v9.0.0 + - name: needs-more-information and waiting-for-reporter Stale Issues Policy + id: needs-more-information-and-waiting-for-reporter-stale-issues-policy + uses: actions/stale@v10 with: repo-token: ${{ github.token }} only-labels: "needs-more-information,waiting-for-reporter" From 5e53ce5f8912ff68070b70369bd1e305029859c8 Mon Sep 17 00:00:00 2001 From: ZeliardM Date: Mon, 8 Dec 2025 14:12:27 -0500 Subject: [PATCH 2/2] Fixes for Copilot Comments --- .github/workflows/ci.yml | 1 + .github/workflows/stale.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75fd60f94..6fea377e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,6 +83,7 @@ jobs: uv run pytest -n auto --cov kasa --cov-report xml - name: Upload Code Coverage to Codecov + id: upload-code-coverage-to-codecov uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 087777a94..cafa2ce92 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -45,7 +45,7 @@ jobs: Thank you for your contributions. - name: needs-more-information and waiting-for-reporter Stale Issues Policy - id: needs-more-information-and-waiting-for-reporter-stale-issues-policy + id: specific-stale-issues-policy uses: actions/stale@v10 with: repo-token: ${{ github.token }}