Skip to content

Commit

Permalink
Merge branch 'dev' into xml_set_fanspeed
Browse files Browse the repository at this point in the history
  • Loading branch information
flubshi committed Jan 21, 2025
2 parents 315307a + 94ecd72 commit e4dc31d
Show file tree
Hide file tree
Showing 194 changed files with 5,978 additions and 561 deletions.
17 changes: 10 additions & 7 deletions .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
"python.analysis.autoImportCompletions": true,
"python.analysis.autoSearchPaths": false,
"python.analysis.extraPaths": ["/home/vscode/.local/lib/python3.12/"],
"python.analysis.typeCheckingMode": "basic",
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.defaultInterpreterPath": "/workspaces/client.py/.venv/bin/python",
"python.languageServer": "Pylance",
"python.pythonPath": "/usr/local/python/bin/python",
"python.pythonPath": "/workspaces/client.py/.venv/bin/python",
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"terminal.integrated.defaultProfile.linux": "zsh",
Expand All @@ -46,14 +44,19 @@
},
// Add the IDs of extensions you want installed when the container is created.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/rust:1": {}
},
"image": "mcr.microsoft.com/devcontainers/python:3",
"image": "mcr.microsoft.com/devcontainers/base:debian",
"name": "Deebot client",
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postStartCommand": "pip install -r requirements-dev.txt && pre-commit install && pip install -e .",
"postCreateCommand": "scripts/setup.sh",
"postStartCommand": "uv sync --group dev",
"remoteEnv": {
"PATH": "/home/vscode/.local/bin:/home/vscode/.cargo/bin:/workspaces/client.py/.venv/bin:${containerEnv:PATH}"
},
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"runArgs": ["-e", "GIT_EDITOR=code --wait"]
Expand Down
17 changes: 0 additions & 17 deletions .github/dependabot.yml

This file was deleted.

31 changes: 31 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"commitMessagePrefix": "⬆️",
"configMigration": true,
"dependencyDashboard": true,
"labels": ["dependencies", "no-stale"],
"lockFileMaintenance": {
"enabled": true
},
"packageRules": [
{
"addLabels": ["python"],
"matchManagers": ["pep621"]
},
{
"matchDepTypes": ["dev"],
"matchManagers": ["pep621"],
"rangeStrategy": "pin"
},
{
"addLabels": ["github_actions"],
"matchManagers": ["github-actions"],
"rangeStrategy": "pin"
},
{
"addLabels": ["rust"],
"matchManagers": ["cargo"]
}
],
"rebaseWhen": "behind-base-branch"
}
113 changes: 86 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,44 @@ name: CI
on:
push:
branches:
- main
- dev
pull_request:

env:
DEFAULT_PYTHON: "3.12"
UV_CACHE_DIR: /tmp/.uv-cache

jobs:
code-quality:
runs-on: "ubuntu-latest"
name: Check code quality
steps:
- uses: "actions/checkout@v4"
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/[email protected]
- name: ⤵️ Checkout repository
uses: actions/checkout@v4

- name: 🏗 Install uv and Python
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "pip"
cache-dependency-path: "requirements*"
- name: Install dependencies
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: ${{ env.UV_CACHE_DIR }}

- name: Install additional OS dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-test.txt
sudo apt-get update
sudo apt-get -y install \
pkg-config \
liblzma-dev
- name: 🏗 Install the project
run: uv sync --locked --group lint

# Following steps cannot run by pre-commit.ci as repo = local
- name: Run mypy
run: mypy deebot_client/
run: uv run --frozen mypy deebot_client/

- name: Pylint review
run: pylint deebot_client/
run: uv run --frozen pylint deebot_client/**/*.py

- name: Verify no getLogger usages
run: scripts/check_getLogger.sh

Expand All @@ -40,24 +49,74 @@ jobs:
name: Run tests
strategy:
matrix:
python-version: ["3.12"]
python-version:
- "3.12"
- "3.13"
steps:
- uses: "actions/checkout@v4"
- name: Set up Python ${{ matrix.python-version }}
id: python
uses: actions/[email protected]
- name: ⤵️ Checkout repository
uses: actions/checkout@v4

- name: 🏗 Install uv and Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: ${{ env.UV_CACHE_DIR }}
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "requirements*"
- name: Install dependencies

- name: Install additional OS dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-test.txt
sudo apt-get update
sudo apt-get -y install \
pkg-config \
liblzma-dev
- name: 🏗 Install the project
run: uv sync --locked --group test

- name: Run pytest
run: pytest --cov=./ --cov-report=xml
run: uv run --frozen pytest tests --cov=./ --cov-report=xml --junitxml=junit.xml -o junit_family=legacy

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
fail_ci_if_error: true

- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true

benchmarks:
runs-on: "ubuntu-latest"
name: Run benchmarks
steps:
- name: ⤵️ Checkout repository
uses: actions/checkout@v4

- name: 🏗 Install uv
uses: astral-sh/setup-uv@v5

- name: 🏗 Setup Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Install additional OS dependencies
run: |
sudo apt-get update
sudo apt-get -y install \
pkg-config \
liblzma-dev
- name: 🏗 Install the project
run: |
uv export --group benchmark > requirements.txt
uv pip install -e . --system -r requirements.txt
- name: Run benchmarks
uses: CodSpeedHQ/action@main
with:
run: pytest tests/ --codspeed
token: ${{ secrets.CODSPEED_TOKEN }}
1 change: 0 additions & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ name: "CodeQL"
on:
push:
branches:
- main
- dev
pull_request:
schedule:
Expand Down
82 changes: 64 additions & 18 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,73 @@ on:
types: [published]

jobs:
deploy:
wheels:
name: Build wheels
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
strategy:
matrix:
python-version:
- "3.12"
- "3.13"
linux-compatibility:
- "manylinux_2_34"
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/[email protected]
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]
- name: 🏗 Set up uv and Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
python-version: "3.12"

- name: Install dependencies
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install additional OS dependencies
run: |
python -m pip install --upgrade pip
pip install -q build
sudo apt-get update
sudo apt-get -y install \
pkg-config \
liblzma-dev
- name: 🏗 Set package version
run: |
sed -i "s/^version = \".*\"/version = \"${{ github.event.release.tag_name }}\"/" pyproject.toml
- name: 📦 Build package
run: python -m build
run: uv build --wheel --config-settings build-args='--compatibility ${{ matrix.linux-compatibility }}'
- name: ⬆️ Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.python-version }}-${{ matrix.linux-compatibility }}
path: dist

- name: 📤 Publish package
uses: pypa/gh-action-pypi-publish@release/v1
release:
name: Releasing to PyPi
runs-on: ubuntu-latest
needs: ["wheels"]
environment:
name: release
url: https://pypi.org/manage/project/deebot-client/
permissions:
contents: write
id-token: write
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]
- name: 🏗 Set up uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: 🏗 Set package version
run: |
sed -i "s/^version = \".*\"/version = \"${{ github.event.release.tag_name }}\"/" pyproject.toml
- name: 📦 Build source package
run: uv build --sdist
- name: ⬇️ Download wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: 🚀 Publish to PyPi
run: uv publish
- name: ✍️ Sign published artifacts
uses: sigstore/[email protected]
with:
inputs: ./dist/*.tar.gz ./dist/*.whl
release-signing-artifacts: true
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release Drafter
on:
push:
branches:
- main
- dev

jobs:
update_release_draft:
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ nosetests.xml
.*_cache

test.py
.env

/target

# rust so
*.cpython*.so

.codspeed
10 changes: 6 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ ci:
- verifyNoGetLogger

default_language_version:
python: python3.12
python: python3.13

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.3
rev: v0.9.2
hooks:
- id: ruff
args:
- --fix
- --unsafe-fixes
- id: ruff-format
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
rev: v3.19.1
hooks:
- id: pyupgrade
args:
Expand All @@ -36,8 +36,9 @@ repos:
exclude_types:
- csv
- json
exclude: ^uv.lock$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-executables-have-shebangs
- id: check-merge-conflict
Expand All @@ -54,6 +55,7 @@ repos:
- [email protected]
exclude_types:
- python
exclude: ^uv.lock$
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
Expand Down
Loading

0 comments on commit e4dc31d

Please sign in to comment.