Skip to content

Add XML command "SetFanSpeed" #2632

Add XML command "SetFanSpeed"

Add XML command "SetFanSpeed" #2632

Workflow file for this run

name: CI
run-name: "${{ github.event_name == 'workflow_dispatch' && format('CI: {0}', github.ref_name) || '' }}"
on:
push:
branches:
- dev
pull_request:
release:
types: [published]
workflow_dispatch:
env:
ADDITIONAL_PYTHON_VERSIONS: "['3.12']"
concurrency:
group: ${{ github.workflow }}-${{ (github.event_name == 'release' && github.run_id) || github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
info:
name: Collect information & prepare
outputs:
default_python_version: ${{ steps.info.outputs.default_python_version }}
python_versions: ${{ steps.info.outputs.python_versions }}
runs-on: ubuntu-latest
steps:
- name: ‡️ Check out code from GitHub
uses: actions/[email protected]
- name: Collect information
id: info
run: |
default_python_version=$(cat .python-version)
echo "default python version: ${default_python_version}"
echo "default_python_version=${default_python_version}" >> $GITHUB_OUTPUT
# Check if ADDITIONAL_PYTHON_VERSIONS contains default_python_version. If not add it
if [[ ! ${ADDITIONAL_PYTHON_VERSIONS} == *"${default_python_version}"* ]]; then
ADDITIONAL_PYTHON_VERSIONS="[${ADDITIONAL_PYTHON_VERSIONS:1:-1}, '${default_python_version}']"
fi
echo "python_versions: ${ADDITIONAL_PYTHON_VERSIONS}"
echo "python_versions=${ADDITIONAL_PYTHON_VERSIONS}" >> $GITHUB_OUTPUT
- name: πŸ— Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Generate requirements.txt
run: |
uv export --no-hashes --no-dev --group test --no-emit-project > requirements.txt
- name: Upload requirements.txt
uses: actions/upload-artifact@v4
with:
name: requirements.txt
path: requirements.txt
code-quality:
runs-on: "ubuntu-latest"
name: Check code quality
steps:
- name: ‡️ Checkout repository
uses: actions/checkout@v4
- name: πŸ— Install uv and Python
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
cache-local-path: ${{ env.UV_CACHE_DIR }}
- 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: uv run --frozen mypy deebot_client/
- name: Pylint review
run: uv run --frozen pylint deebot_client/**/*.py
- name: Verify no getLogger usages
run: scripts/check_getLogger.sh
build-test-native:
name: ${{ matrix.platform.name }} ${{ matrix.platform.target }} ${{ matrix.python-version }}
runs-on: ${{ matrix.platform.runner }}
needs:
- info
- code-quality
strategy:
fail-fast: false
matrix:
include:
- name: Linux
manylinux: manylinux_2_34
- name: Macos
pytest_args: -m "not docker"
platform:
- name: Linux
runner: ubuntu-latest
target: x86_64
- name: Linux
runner: ubuntu-24.04-arm
target: aarch64
- name: Windows
runner: windows-latest
target: x64
- name: Macos
runner: macos-13
target: x86_64
- name: Macos
runner: macos-14
target: aarch64
python-version: ${{ fromJSON(needs.info.outputs.python_versions) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ (matrix.platform.name == 'Windows') && matrix.platform.target || '' }}
- name: πŸ— Set package version
if: ${{ matrix.platform.name != 'Windows' && github.event_name == 'release' }}
run: |
sed -i.bak "s/^version = \".*\"/version = \"${{ github.event.release.tag_name }}\"/" pyproject.toml && rm pyproject.toml.bak
- name: πŸ— Set package version (Windows)
if: ${{ matrix.platform.name == 'Windows' && github.event_name == 'release' }}
run: |
(Get-Content pyproject.toml) -replace 'version = ".*"', 'version = "${{ github.event.release.tag_name }}"' | Set-Content pyproject.toml
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --strip --out dist -i python${{ matrix.python-version }}
sccache: "false"
manylinux: ${{ matrix.manylinux }}
before-script-linux: python3 -m ensurepip
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.platform.name }}-${{ matrix.platform.target }}-${{ matrix.python-version }}
path: dist
- name: πŸ— Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Download requirements.txt
uses: actions/download-artifact@v4
with:
name: requirements.txt
- name: Prepare env and install wheel
shell: bash
run: |
# Remove sources otherwise pytest will complain about missing rust files
rm -rf deebot_client
uv venv -p ${{ matrix.python-version }}
uv pip install -r requirements.txt
uv pip install --force-reinstall dist/deebot_client-*.whl
- name: Run pytest
if: ${{ matrix.platform.name != 'Windows' }}
id: pytest
run: |
source .venv/bin/activate
site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
echo "site-packages: ${site_packages}"
pytest tests --cov=${site_packages}/deebot_client --cov-report=xml --junitxml=junit.xml -o junit_family=legacy -v ${{ matrix.pytest_args || ''}}
- name: Run pytest (windows)
if: ${{ matrix.platform.name == 'Windows' }}
id: pytest_windows
run: |
.venv/Scripts/activate
$sitePackages = python -c "import site; print(site.getsitepackages()[0])"
Write-Output "site-packages: $sitePackages"
pytest tests --cov="$sitePackages/deebot_client" --cov-report=xml --junitxml=junit.xml -o junit_family=legacy -v -m "not docker"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
PYTHON: ${{ matrix.python-version }}
TARGET: ${{ matrix.platform.target }}
PLATFORM: ${{ matrix.platform.name }}
with:
fail_ci_if_error: true
name: ${{ matrix.platform.name }} ${{ matrix.platform.target }} ${{ matrix.python-version }}
env_vars: PLATFORM,TARGET,PYTHON
- name: Upload test results to Codecov
if: ${{ !cancelled() && ((matrix.platform.name == 'Windows' && steps.pytest_windows.outcome) || steps.pytest.outcome) == 'success' }}
uses: codecov/test-results-action@v1
with:
# fail_ci_if_error: true
verbose: true
build-test-musl:
name: Musllinux ${{ matrix.platform.target }} ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs:
- info
- code-quality
strategy:
fail-fast: false
matrix:
platform:
- target: x86_64
docker_arch: amd64
# - target: aarch64
# docker_arch: arm64
python-version: ${{ fromJSON(needs.info.outputs.python_versions) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: πŸ— Set package version
if: ${{ github.event_name == 'release' }}
run: |
sed -i "s/^version = \".*\"/version = \"${{ github.event.release.tag_name }}\"/" pyproject.toml
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.platform.target }}
args: --release --strip --out dist -i python${{ matrix.python-version }}
sccache: "false"
manylinux: musllinux_1_2
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-musllinux-${{ matrix.platform.target }}-${{ matrix.python-version }}
path: dist
- name: Download requirements.txt
uses: actions/download-artifact@v4
with:
name: requirements.txt
- name: Install Qemu
uses: docker/setup-qemu-action@v3
- name: Install Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image
uses: docker/build-push-action@v6
with:
context: .
file: ci/Dockerfile.alpine
platforms: linux/${{ matrix.platform.docker_arch }}
push: false
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
tags: deebot_client:${{ matrix.platform.target }}-${{ matrix.python-version }}
- name: Pytest in docker
id: pytest
run: |
docker run --rm -v ${{ github.workspace }}:/github/workspace --platform linux/${{ matrix.platform.docker_arch }} deebot_client:${{ matrix.platform.target }}-${{ matrix.python-version }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
PYTHON: ${{ matrix.python-version }}
TARGET: ${{ matrix.platform.target }}
PLATFORM: Musllinux
with:
fail_ci_if_error: true
name: Musllinux ${{ matrix.platform.target }} ${{ matrix.python-version }}
env_vars: PLATFORM,TARGET,PYTHON
- name: Upload test results to Codecov
if: ${{ !cancelled() && steps.pytest.outcome == 'success' }}
uses: codecov/test-results-action@v1
with:
fail_ci_if_error: true
benchmarks:
runs-on: "ubuntu-latest"
name: Run benchmarks
if: ${{ github.event_name != 'release' }}
needs:
- build-test-native
- build-test-musl
- sdist
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: ${{ needs.info.outputs.default_python_version }}
- name: Download requirements.txt
uses: actions/download-artifact@v4
with:
name: requirements.txt
- name: πŸ— Install the project
run: |
uv pip install -e . --system -r requirements.txt
- name: Run benchmarks
uses: CodSpeedHQ/action@main
with:
run: pytest tests/ --codspeed
token: ${{ secrets.CODSPEED_TOKEN }}
sdist:
name: Create source distribution
runs-on: ubuntu-latest
needs: code-quality
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
if: ${{ github.event_name == 'release' }}
run: |
sed -i "s/^version = \".*\"/version = \"${{ github.event.release.tag_name }}\"/" pyproject.toml
- name: πŸ“¦ Build source package
run: uv build --sdist
- name: Upload sdist
uses: actions/upload-artifact@v4
with:
name: wheels-sdist
path: dist
release:
name: Releasing to PyPi
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
needs:
- build-test-native
- build-test-musl
- sdist
environment:
name: release
url: https://pypi.org/p/deebot-client
permissions:
contents: write
id-token: write
steps:
- name: ‡️ Check out code from GitHub
uses: actions/[email protected]
- name: ⬇️ Download wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: true
- name: πŸš€ Publish to PyPi
uses: pypa/[email protected]
with:
verbose: true
print-hash: true
- name: ✍️ Sign published artifacts
uses: sigstore/[email protected]
with:
inputs: ./dist/*.tar.gz ./dist/*.whl
release-signing-artifacts: true