mq-bridge 0.3.2

An asynchronous message bridging library connecting Kafka, MQTT, AMQP, NATS, MongoDB, HTTP, and more.
Documentation
name: Python

on:
  push:
    branches: [main]
    paths:
      - ".github/workflows/python.yml"
      - "python/mq-bridge-py/**"
      - "Cargo.toml"
      - "Cargo.lock"
      - "src/**"
  pull_request:
    branches: [main, dev]
    paths:
      - ".github/workflows/python.yml"
      - "python/mq-bridge-py/**"
      - "Cargo.toml"
      - "Cargo.lock"
      - "src/**"
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Python package smoke test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: "3.11"

      - name: Set up uv
        uses: astral-sh/setup-uv@v5

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable

      - name: Cache cargo registry
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-

      - name: Sync Python dev environment
        working-directory: python/mq-bridge-py
        run: uv sync --group dev --no-install-project

      - name: Build extension into the uv environment
        working-directory: python/mq-bridge-py
        run: uv run maturin develop

      - name: Run Python tests
        working-directory: python/mq-bridge-py
        run: uv run pytest -q

      - name: Smoke test import
        working-directory: python/mq-bridge-py
        run: uv run python -c "from mq_bridge import Message, Publisher, Route; print(Message, Publisher, Route)"

      - name: Run no-default feature regression tests
        run: |
          cargo test -p mq-bridge-py --no-default-features --features http,rustls-ring test_config_schema_is_always_available
          cargo test -p mq-bridge-py --no-default-features --features http,rustls-ring test_module_init_installs_rustls_provider

      - name: Rebuild extension with lean no-default feature set
        working-directory: python/mq-bridge-py
        run: uv run maturin develop --no-default-features -F http -F rustls-ring -F pyo3/extension-module

      - name: Run lean no-default public API tests
        working-directory: python/mq-bridge-py
        run: uv run pytest -q tests/test_public_api.py tests/test_config_types.py