Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 38 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
# Default Python version for tooling jobs (lint, build, test-release)
DEFAULT_PYTHON_VERSION: "3.11"
# Matrix Python version that collects branch coverage and uploads to Codecov
COVERAGE_PYTHON_VERSION: "3.14"

jobs:
# Make sure commit messages follow the conventional commits convention:
# https://www.conventionalcommits.org
Expand All @@ -27,16 +33,17 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.11"
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
- uses: pre-commit/action@v3.0.1

test:
strategy:
fail-fast: false
matrix:
# Keep COVERAGE_PYTHON_VERSION in sync with this matrix
python-version:
- "3.11"
- "3.14"
- "3.11" # Minimum supported Python version
- "3.14" # Latest supported Python version (coverage)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
Expand All @@ -45,11 +52,14 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
- run: uv pip install pip
enable-cache: true
- name: Test with Pytest
run: uv run pytest --log-cli-level=DEBUG -vv -s --cov --cov-branch --cov-report=xml
run: >-
uv run pytest -n auto
${{ matrix.python-version == env.COVERAGE_PYTHON_VERSION && '--cov --cov-branch --cov-report=xml' || '' }}
shell: bash
- name: Upload results to Codecov
if: matrix.python-version == env.COVERAGE_PYTHON_VERSION
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -59,9 +69,10 @@ jobs:
strategy:
fail-fast: false
matrix:
# Keep COVERAGE_PYTHON_VERSION in sync with this matrix
python-version:
- "3.11"
- "3.14"
- "3.11" # Minimum supported Python version
- "3.14" # Latest supported Python version (coverage)
runs-on: ubuntu-latest
services:
emqx:
Expand All @@ -70,19 +81,23 @@ jobs:
- 1888:1883
options: >-
--health-cmd "/opt/emqx/bin/emqx ctl status"
--health-interval 5s
--health-interval 1s
--health-timeout 25s
--health-retries 5
--health-retries 25
steps:
- uses: actions/checkout@v6
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
activate-environment: true
enable-cache: true
- name: Test MQTT with Pytest
run: uv run pytest -m mqtt_broker --log-cli-level=DEBUG -vv -s --cov --cov-branch --cov-report=xml
run: >-
uv run pytest -m mqtt_broker
${{ matrix.python-version == env.COVERAGE_PYTHON_VERSION && '--cov --cov-branch --cov-report=xml' || '' }}
- name: Upload results to Codecov
if: matrix.python-version == env.COVERAGE_PYTHON_VERSION
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -97,8 +112,9 @@ jobs:
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: "3.11"
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
activate-environment: true
enable-cache: true
- name: Build package
run: uv build

Expand All @@ -111,32 +127,25 @@ jobs:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
enable-cache: true
- name: Setup Git for Semantic Release Testing
run: |
# Setup a temp branch to test
git checkout -B temp-main-branch
git merge ${{ github.event.pull_request.head.sha }} --no-edit
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Test Semantic Release (No-op)
id: test-release
uses: python-semantic-release/python-semantic-release@v10.5.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
changelog: true
# Use noop mode to test without making changes
no_operation_mode: true
- name: Test Semantic Release (Dry Run)
id: test-release-dry
uses: python-semantic-release/python-semantic-release@v10.5.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
changelog: true
# Use dry run mode to test without committing
commit: false
tag: false
push: false
vcs_release: false
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Keep version in sync with python-semantic-release action in the release job
run: >-
uv tool run --from python-semantic-release==10.5.3
semantic-release version --changelog --no-commit --no-tag --no-push --no-vcs-release
release:
runs-on: ubuntu-latest
needs:
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ dev = [
"syrupy>=4.9.1,<6",
"pdoc>=15.0.4,<17",
"pytest-cov>=7.0.0",
"pytest-xdist>=3.8.0",
"zmqtt>=0.2.0,<0.3.0",
"pytest-benchmark>=5.1.0",
]
Expand All @@ -87,7 +88,7 @@ build-backend = "hatchling.build"
[tool.semantic_release]
branch = "main"
version_toml = ["pyproject.toml:project.version"]
build_command = "pip install uv && uv lock --upgrade-package python-roborock && git add uv.lock && uv build"
build_command = "(command -v uv >/dev/null || pip install uv) && uv lock --upgrade-package python-roborock && git add uv.lock && uv build"
changelog_file = 'CHANGELOG.md'
commit = true

Expand Down
24 changes: 24 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading