ruststream 0.2.4

Async messaging framework for Rust: broker-agnostic traits, router, codecs, and a conformance harness for broker authors.
Documentation
name: CI

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

permissions:
  contents: read

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  changes:
    name: Detect changes
    runs-on: ubuntu-latest
    outputs:
      rust: ${{ steps.filter.outputs.rust }}
      dist: ${{ steps.filter.outputs.dist }}
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false

      - uses: dorny/paths-filter@v3
        id: filter
        with:
          filters: |
            rust:
              - 'src/**'
              - 'crates/**'
              - 'tests/**'
              - 'examples/**'
              - 'Cargo.toml'
              - 'Cargo.lock'
              - 'rust-toolchain.toml'
              - 'rustfmt.toml'
              - 'clippy.toml'
              - '.github/workflows/ci.yml'
            dist:
              - 'src/**'
              - 'crates/**'
              - 'Cargo.toml'
              - 'Cargo.lock'
              - '.github/workflows/ci.yml'

  rust:
    name: Rust ${{ matrix.toolchain }}
    needs: changes
    if: ${{ needs.changes.outputs.rust == 'true' }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        toolchain: [stable, "1.85"]
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.toolchain }}
          components: rustfmt, clippy

      - name: Cache cargo
        uses: Swatinem/rust-cache@v2

      - name: cargo fmt
        if: matrix.toolchain == 'stable'
        run: cargo fmt --all -- --check

      - name: cargo clippy
        if: matrix.toolchain == 'stable'
        run: cargo clippy --workspace --all-targets --all-features -- -D warnings

      - name: cargo check (no default features)
        run: cargo check --workspace --no-default-features

      - name: cargo check (all features)
        run: cargo check --workspace --all-targets --all-features

      - name: cargo test
        run: cargo test --workspace --all-features

  package:
    name: Package (publish dry-run)
    needs: changes
    if: ${{ needs.changes.outputs.dist == 'true' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false

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

      - name: Cache cargo
        uses: Swatinem/rust-cache@v2

      # Trial-build the published artifacts without uploading. Per-package (not `--workspace`) so the
      # dev-only `[patch.crates-io]` self-patch used by the `nats_*` examples is handled the same way
      # the real release does it; `--workspace` packaging trips over its checksum. ruststream verifies
      # against the published ruststream-macros from crates.io.
      - name: cargo publish dry-run (no upload)
        run: |
          cargo publish --dry-run -p ruststream-macros
          cargo publish --dry-run -p ruststream --all-features