feat: Add support for shared subscriptions (#18) #44
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: Tests | |
| on: | |
| pull_request: | |
| push: | |
| branches: [master] | |
| permissions: | |
| contents: read | |
| jobs: | |
| tests: | |
| name: Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| services: | |
| artemis: | |
| image: apache/activemq-artemis:latest-alpine | |
| env: | |
| ANONYMOUS_LOGIN: "true" | |
| ports: | |
| - 1883:1883 | |
| options: >- | |
| --security-opt no-new-privileges:true | |
| mosquitto: | |
| image: eclipse-mosquitto:2 | |
| ports: | |
| - 1884:1883 | |
| options: >- | |
| --security-opt no-new-privileges:true | |
| hivemq: | |
| image: hivemq/hivemq-ce@sha256:7ae39e84654a41ced6e946dd84f131d508bc2b862ec96265b7f23d241db214da # latest | |
| ports: | |
| - 1886:1883 | |
| options: >- | |
| --security-opt no-new-privileges:true | |
| nanomq: | |
| image: emqx/nanomq@sha256:cf010e7b78981b051cdb833921207991daaf46dccce1ab12dd8d7ec433147161 # latest | |
| ports: | |
| - 1887:1883 | |
| options: >- | |
| --security-opt no-new-privileges:true | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup mosquitto config | |
| run: | | |
| mkdir -p docker | |
| cat > docker/mosquitto.conf <<EOF | |
| listener 1883 | |
| allow_anonymous true | |
| EOF | |
| - name: Copy mosquitto config | |
| run: | | |
| MOSQUITTO_ID=$(docker ps -q --filter "ancestor=eclipse-mosquitto:2") | |
| echo "Mosquitto container: $MOSQUITTO_ID" | |
| docker cp docker/mosquitto.conf $MOSQUITTO_ID:/mosquitto/config/mosquitto.conf | |
| docker exec $MOSQUITTO_ID chmod 644 /mosquitto/config/mosquitto.conf | |
| - name: Wait for brokers | |
| run: | | |
| echo "Waiting for brokers to be ready..." | |
| sleep 15 | |
| # Test connections to brokers | |
| for port in 1883 1884 1886 1887; do | |
| nc -zv localhost $port || echo "Port $port not responding" | |
| done | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| persist-credentials: false | |
| - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: uv sync --group dev | |
| - run: uv run pytest -vv --cov=src/zmqtt --cov-report=xml | |
| - uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5 | |
| with: | |
| files: coverage.xml | |
| tests-macos: | |
| name: Python ${{ matrix.python-version }} (macOS) | |
| runs-on: macos-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.14"] | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| persist-credentials: false | |
| - name: Install and start mosquitto | |
| run: | | |
| brew install mosquitto | |
| printf 'listener 1884\nallow_anonymous true\n' > /tmp/mosquitto.conf | |
| $(brew --prefix)/sbin/mosquitto -c /tmp/mosquitto.conf -d | |
| sleep 2 | |
| - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: uv sync --group dev | |
| - run: uv run pytest -vv --cov=src/zmqtt --cov-report=xml --ignore=tests/test_brokers/test_artemis.py --ignore=tests/test_brokers/test_hivemq.py --ignore=tests/test_brokers/test_nanomq.py | |
| - uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5 | |
| with: | |
| files: coverage.xml | |
| tests-windows: | |
| name: Python ${{ matrix.python-version }} (Windows) | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.14"] | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| persist-credentials: false | |
| - name: Install and start mosquitto | |
| shell: pwsh | |
| run: | | |
| winget install -e --id EclipseFoundation.Mosquitto --accept-source-agreements --accept-package-agreements --silent | |
| Set-Content -Path "$env:TEMP\mosquitto.conf" -Value "listener 1884`r`nallow_anonymous true" | |
| Start-Process -FilePath "C:\Program Files\mosquitto\mosquitto.exe" -ArgumentList "-c $env:TEMP\mosquitto.conf" -WindowStyle Hidden | |
| Start-Sleep -Seconds 3 | |
| - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - run: uv sync --group dev | |
| - run: uv run pytest -vv --cov=src/zmqtt --cov-report=xml --ignore=tests/test_brokers/test_artemis.py --ignore=tests/test_brokers/test_hivemq.py --ignore=tests/test_brokers/test_nanomq.py | |
| - uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5 | |
| with: | |
| files: coverage.xml | |
| check: | |
| name: All tests passed | |
| if: always() | |
| needs: [tests, tests-macos, tests-windows] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} |