Add docstrings; prepare release 0.1.2 #113
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
| --- | |
| name: CI | |
| on: | |
| push: | |
| branches-ignore: | |
| - 'temp/**' | |
| - 'gh-pages/**' | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| cache-suffix: "py${{ matrix.python-version }}-${{ github.sha }}" | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Create virtual environment | |
| run: uv venv --python ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| if [ "${{ matrix.python-version }}" == "3.13" ]; then | |
| # Sync everything EXCEPT the 'numpy' extra that currently has problems on github | |
| uv sync --extra rabbitmq --extra redis --dev --extra mosquitto --extra nats | |
| else | |
| # Install everything for older versions | |
| uv sync --all-extras | |
| fi | |
| - name: Run tests | |
| run: make test | |
| env: | |
| PYTHONASYNCIODEBUG: "1" | |
| PYTEST_ADDOPTS: "-vvv --log-level=DEBUG" | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v5 | |
| if: matrix.python-version == '3.12' | |
| with: | |
| flags: unittests | |
| name: codecov-umbrella | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Create virtual environment | |
| run: uv venv --python 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Run linting | |
| run: make lint | |
| integration_test_python_queues: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Create virtual environment | |
| run: uv venv --python 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Run tests | |
| run: uv run python -m pytest tests/test_integration.py -k python -vvv -s | |
| integration_test_rabbitmq: | |
| runs-on: ubuntu-latest | |
| services: | |
| rabbitmq: | |
| image: rabbitmq:4-management | |
| ports: | |
| - 5672:5672 | |
| - 15672:15672 | |
| env: | |
| RABBITMQ_DEFAULT_USER: guest | |
| RABBITMQ_DEFAULT_PASS: guest | |
| options: >- | |
| --health-cmd "rabbitmq-diagnostics -q ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Create virtual environment | |
| run: uv venv --python 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Setup RabbitMQ virtual host | |
| run: | | |
| echo "Creating virtual host /test and granting user permissions..." | |
| docker exec ${{ job.services.rabbitmq.id }} rabbitmqctl add_vhost /test | |
| docker exec ${{ job.services.rabbitmq.id }} rabbitmqctl set_permissions -p /test guest ".*" ".*" ".*" | |
| - name: Run tests | |
| run: uv run python -m pytest tests/test_integration.py -k rabbitmq -vvv -s | |
| env: | |
| RABBITMQ_HOST: localhost | |
| RABBITMQ_PORT: 5672 | |
| RABBITMQ_USER: guest | |
| RABBITMQ_PASS: guest | |
| RABBITMQ_VHOST: /test | |
| integration_test_redis: | |
| runs-on: ubuntu-latest | |
| services: | |
| redis: | |
| image: redis:6.2.6-alpine | |
| ports: | |
| - 6379:6379 | |
| - 16379:16379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Create virtual environment | |
| run: uv venv --python 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Run tests | |
| run: uv run python -m pytest tests/test_integration.py -k redis -vvv -s | |
| env: | |
| REDIS_HOST: localhost | |
| REDIS_PORT: 6379 | |
| integration_test_mosquitto: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run Mosquitto | |
| run: | | |
| docker run -d -p 1883:1883 --name mos eclipse-mosquitto:latest \ | |
| /usr/sbin/mosquitto -c /mosquitto-no-auth.conf | |
| - name: Log Mosquitto container | |
| run: | | |
| sleep 3 | |
| echo "=== Container logs ===" | |
| docker logs mos | |
| echo "=== Config file ===" | |
| docker exec mos cat /mosquitto-no-auth.conf | |
| echo "=== Processes ===" | |
| docker exec mos ps aux | |
| echo "=== Network ===" | |
| docker exec mos netstat -tlnp || docker exec mosquitto ss -tlnp | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Create virtual environment | |
| run: uv venv --python 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Smoke test MQTT | |
| run: | | |
| # Wait for the port to be open | |
| timeout 30s sh -c 'until nc -z localhost 1883; do sleep 1; done' | |
| uv run python -c " | |
| import paho.mqtt.client as mqtt | |
| import sys | |
| client = mqtt.Client() | |
| try: | |
| client.connect('127.0.0.1', 1883, 10) | |
| print('MQTT Handshake Successful') | |
| sys.exit(0) | |
| except Exception as e: | |
| print(f'Failed to connect: {e}') | |
| sys.exit(1) | |
| " | |
| - name: Run tests | |
| run: uv run python -m pytest tests/test_integration.py -k mosquitto -vvv -s | |
| env: | |
| MQTT_HOST: 127.0.0.1 | |
| integration_test_nats: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run NATS server | |
| run: | | |
| docker run -d -p 4222:4222 --name nats nats:2-alpine -js | |
| - name: Log NATS container | |
| run: | | |
| sleep 3 | |
| echo "=== Container logs ===" | |
| docker logs nats | |
| echo "=== Config file ===" | |
| docker exec nats cat /etc/nats/nats-server.conf | |
| echo "=== Processes ===" | |
| docker exec nats ps aux | |
| echo "=== Network ===" | |
| docker exec nats netstat -tlnp || docker exec nats ss -tlnp | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Set up Python 3.12 | |
| run: uv python install 3.12 | |
| - name: Create virtual environment | |
| run: uv venv --python 3.12 | |
| - name: Install dependencies | |
| run: uv sync --all-extras | |
| - name: Smoke test NATS | |
| run: | | |
| # Wait for the port to be open | |
| timeout 30s sh -c 'until nc -z localhost 4222; do sleep 1; done' | |
| uv run python -c " | |
| import nats | |
| import sys | |
| import asyncio | |
| async def smoke_test(): | |
| try: | |
| nats.connect() | |
| print('NATS connected Successfully') | |
| sys.exit(0) | |
| except Exception as e: | |
| print(f'Failed to connect: {e}') | |
| sys.exit(1) | |
| asyncio.run(smoke_test()) | |
| " | |
| - name: Run tests | |
| run: uv run python -m pytest tests/test_integration.py -k nats -vvv -s | |
| env: | |
| NATS_HOST: localhost |