-
Notifications
You must be signed in to change notification settings - Fork 2
Py314 #356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Py314 #356
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,9 @@ | |
| name: Latest commit | ||
|
|
||
| env: | ||
| CACHE_VERSION: 5 | ||
| DEFAULT_PYTHON: "3.13" | ||
| PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit | ||
| CACHE_VERSION: 1 | ||
| DEFAULT_PYTHON: "3.14" | ||
| PRE_COMMIT_HOME: ~/.cache/pre-commit | ||
| VENV: venv | ||
|
|
||
| on: | ||
|
|
@@ -32,30 +32,26 @@ jobs: | |
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ env.DEFAULT_PYTHON }} | ||
| - name: Fetch HA pyproject | ||
| id: core-version | ||
| run: wget -O ha_pyproject.toml "https://raw.githubusercontent.com/home-assistant/core/refs/heads/dev/pyproject.toml" | ||
| - name: Compute cache key | ||
| id: set-key | ||
| run: echo "cache-key=${{ runner.os }}-venv-cache-${{ env.CACHE_VERSION }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('pyproject.toml', 'requirements_commit.txt', 'requirements_test.txt', '.pre-commit-config.yaml') }}" >> "$GITHUB_OUTPUT" | ||
| run: echo "cache-key=${{ runner.os }}-${{ env.CACHE_VERSION }}-${{ hashFiles('pyproject.toml', 'requirements_test.txt', '.pre-commit-config.yaml') }}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| # Prepare default python version environment | ||
| prepare: | ||
| runs-on: ubuntu-latest | ||
| needs: cache | ||
| name: Prepare | ||
| steps: | ||
| - name: Check out committed code | ||
| uses: actions/checkout@v5 | ||
| - name: Set up Python ${{ needs.cache.outputs.python-version }} | ||
| id: python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| - name: Create or reuse cache | ||
| - name: Prepare code checkout and python/pre-commit setup | ||
| id: cache-reuse | ||
| uses: ./.github/actions/restore-venv | ||
| uses: plugwise/gh-actions/prepare-python-and-code@v1 | ||
| with: | ||
| cache-key: ${{ needs.cache.outputs.cache-key }} | ||
| fail-on-miss: false # First time create cache (if not already exists) | ||
| python-version: ${{ steps.python.outputs.python-version }} | ||
| fail-on-miss: false # First time create cache (if not already exists) | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| venv-dir: ${{ env.VENV }} | ||
| precommit-home: ${{ env.PRE_COMMIT_HOME }} | ||
|
|
||
|
|
@@ -70,33 +66,28 @@ jobs: | |
| uses: actions/checkout@v5 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up Python ${{ needs.cache.outputs.python-version }} | ||
| id: python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| - name: Create or reuse cache | ||
| - name: Restore cached environment | ||
| id: cache-reuse | ||
| uses: ./.github/actions/restore-venv | ||
| uses: plugwise/gh-actions/restore-venv@v1 | ||
| with: | ||
| cache-key: ${{ needs.cache.outputs.cache-key }} | ||
| python-version: ${{ steps.python.outputs.python-version }} | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| venv-dir: ${{ env.VENV }} | ||
| precommit-home: ${{ env.PRE_COMMIT_HOME }} | ||
| - name: Ruff (check) | ||
| - name: Ruff (with fix) | ||
| run: | | ||
| . venv/bin/activate | ||
| . venv-${{ needs.cache.outputs.python-version }}/bin/activate | ||
| ruff check plugwise_usb/ tests/ | ||
| - name: If needed, commit ruff changes to the pull request | ||
| if: failure() | ||
| run: | | ||
| . venv/bin/activate | ||
| . venv-${{ needs.cache.outputs.python-version }}/bin/activate | ||
| ruff format plugwise_usb/ tests/ | ||
| git config --global user.name 'autoruff' | ||
| git config --global user.email '[email protected]' | ||
| git remote set-url origin https://x-access-token:${{ secrets.PAT_CT_PYPLUSB }}@github.com/$GITHUB_REPOSITORY | ||
| git checkout $GITHUB_HEAD_REF | ||
| git commit -am "fixup: ${GITHUB_REF##*/} Python code reformatted using Ruff" | ||
| git commit -am "fixup: ${GITHUB_REF##*/} Python code fixed using Ruff" | ||
| git push origin ${GITHUB_REF##*/} | ||
|
|
||
| commitcheck: | ||
|
|
@@ -111,31 +102,26 @@ jobs: | |
| steps: | ||
| - name: Check out committed code | ||
| uses: actions/checkout@v5 | ||
| - name: Set up Python ${{ needs.cache.outputs.python-version }} | ||
| id: python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| - name: Create or reuse cache | ||
| - name: Restore cached environment | ||
| id: cache-reuse | ||
| uses: ./.github/actions/restore-venv | ||
| uses: plugwise/gh-actions/restore-venv@v1 | ||
| with: | ||
| cache-key: ${{ needs.cache.outputs.cache-key }} | ||
| python-version: ${{ steps.python.outputs.python-version }} | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| venv-dir: ${{ env.VENV }} | ||
| precommit-home: ${{ env.PRE_COMMIT_HOME }} | ||
| - name: Verify commit | ||
| run: | | ||
| . venv/bin/activate | ||
| . venv-${{ needs.cache.outputs.python-version }}/bin/activate | ||
| pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual pylint | ||
| # - name: Biome lint | ||
| # run: | | ||
| # . venv/bin/activate | ||
| # mkdir -p ./tmp && curl -sL "https://github.com/biomejs/biome/releases/download/%40biomejs%2Fbiome%402.0.0/biome-linux-x64" -o ./tmp/biome && chmod +x ./tmp/biome | ||
| # . venv-${{ needs.cache.outputs.python-version }}/bin/activate | ||
| # mkdir -p ./tmp && curl -sL "https://github.com/biomejs/biome/releases/latest/download/biome-linux-x64" -o ./tmp/biome && chmod +x ./tmp/biome | ||
| # pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual biome | ||
| - name: Lint markdown files | ||
| run: | | ||
| . venv/bin/activate | ||
| . venv-${{ needs.cache.outputs.python-version }}/bin/activate | ||
| pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual markdownlint | ||
|
|
||
| pytest: | ||
|
|
@@ -147,7 +133,7 @@ jobs: | |
| - commitcheck | ||
| strategy: | ||
| matrix: | ||
| python-version: ["3.13"] | ||
| python-version: ["3.14", "3.13"] | ||
| steps: | ||
| - name: Check out committed code | ||
| uses: actions/checkout@v5 | ||
|
|
@@ -156,18 +142,18 @@ jobs: | |
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Create or reuse cache | ||
| - name: Restore cached environment | ||
| id: cache-reuse | ||
| uses: ./.github/actions/restore-venv | ||
| uses: plugwise/gh-actions/restore-venv@v1 | ||
| with: | ||
| cache-key: ${{ needs.cache.outputs.cache-key }}-pytest-matrix-${{ matrix.python-version }} | ||
| fail-on-miss: false # First time create cache (if not already exists) | ||
| fail-on-miss: false # First time create cache (if not already exists) | ||
| cache-key: ${{ needs.cache.outputs.cache-key }} | ||
| python-version: ${{ steps.python.outputs.python-version }} # Force to installed python minor | ||
| venv-dir: ${{ env.VENV }} | ||
| precommit-home: ${{ env.PRE_COMMIT_HOME }} | ||
| - name: Run all tests | ||
| run: | | ||
| . venv/bin/activate | ||
| . venv-${{ steps.python.outputs.python-version }}/bin/activate | ||
| pytest --log-level info tests/*.py --cov='.' | ||
| - name: Upload coverage artifact | ||
| uses: actions/upload-artifact@v4 | ||
|
|
@@ -190,23 +176,18 @@ jobs: | |
| uses: actions/checkout@v5 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Set up Python ${{ needs.cache.outputs.python-version }} | ||
| id: python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| - name: Create or reuse cache | ||
| - name: Restore cached environment | ||
| id: cache-reuse | ||
| uses: ./.github/actions/restore-venv | ||
| uses: plugwise/gh-actions/restore-venv@v1 | ||
| with: | ||
| cache-key: ${{ needs.cache.outputs.cache-key }} | ||
| python-version: ${{ steps.python.outputs.python-version }} | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| venv-dir: ${{ env.VENV }} | ||
| precommit-home: ${{ env.PRE_COMMIT_HOME }} | ||
| - name: Run mypy | ||
| run: | | ||
| . venv/bin/activate | ||
| uv pip list | grep -i mypy | ||
| . venv-${{ needs.cache.outputs.python-version }}/bin/activate | ||
| pip list | grep -i mypy | ||
| mypy plugwise_usb/ | ||
|
|
||
| # Check shellscripts | ||
|
|
@@ -240,17 +221,12 @@ jobs: | |
| steps: | ||
| - name: Check out committed code | ||
| uses: actions/checkout@v5 | ||
| - name: Set up Python ${{ needs.cache.outputs.python-version }} | ||
| id: python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| - name: Create or reuse cache | ||
| - name: Restore cached environment | ||
| id: cache-reuse | ||
| uses: ./.github/actions/restore-venv | ||
| uses: plugwise/gh-actions/restore-venv@v1 | ||
| with: | ||
| cache-key: ${{ needs.cache.outputs.cache-key }} | ||
| python-version: ${{ steps.python.outputs.python-version }} | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| venv-dir: ${{ env.VENV }} | ||
| precommit-home: ${{ env.PRE_COMMIT_HOME }} | ||
| - name: Download all coverage artifacts | ||
|
|
@@ -261,7 +237,7 @@ jobs: | |
| path: ${{ github.workspace }}/artifacts | ||
| - name: Combine coverage results | ||
| run: | | ||
| . venv/bin/activate | ||
| . venv-${{ needs.cache.outputs.python-version }}/bin/activate | ||
| coverage combine artifacts/.coverage* | ||
| #coverage report --fail-under=80 ## plugwise is at 94, set to 80 for plugwise_usb | ||
| echo "***" | ||
|
|
@@ -333,21 +309,16 @@ jobs: | |
| steps: | ||
| - name: Check out committed code | ||
| uses: actions/checkout@v5 | ||
| - name: Set up Python ${{ needs.cache.outputs.python-version }} | ||
| id: python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| - name: Create or reuse cache | ||
| - name: Restore cached environment | ||
| id: cache-reuse | ||
| uses: ./.github/actions/restore-venv | ||
| uses: plugwise/gh-actions/restore-venv@v1 | ||
| with: | ||
| cache-key: ${{ needs.cache.outputs.cache-key }} | ||
| python-version: ${{ steps.python.outputs.python-version }} | ||
| python-version: ${{ needs.cache.outputs.python-version }} | ||
| venv-dir: ${{ env.VENV }} | ||
| precommit-home: ${{ env.PRE_COMMIT_HOME }} | ||
| - name: Run complexity report (click to view details) | ||
| run: | | ||
| . venv/bin/activate | ||
| . venv-${{ needs.cache.outputs.python-version }}/bin/activate | ||
| echo "Showing complexity higher or equal to 'C'" | ||
| radon cc plugwise/ tests/ -s -nc --no-assert | ||
| radon cc plugwise_usb/ tests/ -s -nc --no-assert | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.