irpc 1.0.0

A streaming rpc system based on quic
Documentation
name: tests

on:
  push:
    branches:
      # This helps fill the caches properly, caches are not shared between PRs.
      - main
  pull_request:
    branches:
      - main

concurrency:
  group: tests-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

env:
  MSRV: "1.91"
  RUST_BACKTRACE: 1
  RUSTFLAGS: -Dwarnings

# Default to read-only; jobs that need more grant it explicitly.
permissions:
  contents: read

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
        with:
          toolchain: stable
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
      - uses: taiki-e/install-action@a4d3f3f761dcd95cce1b72cb61cb6d1963438177 # v2.87.30
        with:
          tool: cargo-make
      - name: cargo clippy
        run: cargo clippy --locked --workspace --all-targets --all-features
      - name: cargo test --doc
        # Once, on one platform: the other test runs skip doctests.
        run: cargo test --locked --workspace --all-features --doc
      - run: cargo make format-check
      - name: Assert lockfile unchanged
        # cargo make takes no --locked; assert the lockfile instead.
        run: git diff --exit-code Cargo.lock

  test:
    runs-on: ${{ matrix.target.os }}
    strategy:
      fail-fast: false
      matrix:
        target:
          - os: "ubuntu-latest"
            toolchain: "x86_64-unknown-linux-gnu"
            name: "Linux GNU"
          - os: "macOS-latest"
            toolchain: "x86_64-apple-darwin"
            name: "macOS"
          - os: "windows-latest"
            toolchain: "x86_64-pc-windows-msvc"
            name: "Windows MSVC"
          - os: "windows-latest"
            toolchain: "x86_64-pc-windows-gnu"
            name: "Windows GNU"
        channel:
          - "stable"
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
        with:
          toolchain: ${{ matrix.channel }}
          targets: ${{ matrix.target.toolchain }}
      - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
      - name: cargo test (workspace, all features)
        run: cargo test --locked --workspace --all-features --bins --tests --examples
      - name: cargo test (workspace, default features)
        run: cargo test --locked --workspace --bins --tests --examples
      - name: cargo test (workspace, no default features)
        run: cargo test --locked --workspace --no-default-features --bins --tests --examples
      - name: cargo check (irpc, no default features)
        run: cargo check --locked --no-default-features --bins --tests --examples
      - name: cargo check (irpc, feature derive)
        run: cargo check --locked --no-default-features --features derive --bins --tests --examples
      - name: cargo check (irpc, feature rpc)
        run: cargo check --locked --no-default-features --features rpc --bins --tests --examples
      - name: cargo check (irpc, feature tracing-subscriber-03)
        run: cargo check --locked --no-default-features --features tracing-subscriber-03 --bins --tests --examples
      - name: cargo check (irpc-opentelemetry)
        run: cargo check --locked -p irpc-opentelemetry --bins --tests --examples

  test-release:
    runs-on: ${{ matrix.target.os }}
    strategy:
      fail-fast: false
      matrix:
        target:
          - os: "ubuntu-latest"
            toolchain: "x86_64-unknown-linux-gnu"
            name: "Linux GNU"
          - os: "macOS-latest"
            toolchain: "x86_64-apple-darwin"
            name: "macOS"
          - os: "windows-latest"
            toolchain: "x86_64-pc-windows-msvc"
            name: "Windows MSVC"
          - os: "windows-latest"
            toolchain: "x86_64-pc-windows-gnu"
            name: "Windows GNU"
        channel:
          - "stable"
          - "beta"
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
        with:
          toolchain: ${{ matrix.channel }}
          targets: ${{ matrix.target.toolchain }}
      - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
      - name: cargo test
        run: cargo test --release --locked --workspace --all-features --bins --tests --examples

  check_docs:
    timeout-minutes: 30
    name: Checking docs
    runs-on: ubuntu-latest
    env:
      RUSTC_WRAPPER: "sccache"
      SCCACHE_GHA_ENABLED: "on"
      RUSTDOCFLAGS: -Dwarnings
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
        with:
          toolchain: nightly
      - uses: dtolnay/install@982daea0f5d846abc3c83e01a6a1d73c040047c1 # cargo-docs-rs
      - name: Install sccache
        uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11

      - name: irpc
        run: cargo docs-rs --locked -p irpc
      - name: irpc-opentelemetry
        run: cargo docs-rs --locked -p irpc-opentelemetry

  wasm_build:
    name: Build wasm32
    runs-on: ubuntu-latest
    env:
      RUSTFLAGS: '--cfg getrandom_backend="wasm_js"'
    steps:
      - name: Checkout sources
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - name: Install stable toolchain
        uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
        with:
          toolchain: stable
      - name: Add wasm target
        run: rustup target add wasm32-unknown-unknown
      - name: Install wasm-tools
        uses: bytecodealliance/actions/wasm-tools/setup@9152e710e9f7182e4c29ad218e4f335a7b203613 # v1.1.3
      - name: wasm32 build
        run: cargo build --locked --target wasm32-unknown-unknown --all
      # If the Wasm file contains any 'import "env"' declarations, then
      # some non-Wasm-compatible code made it into the final code.
      - name: Ensure no 'import "env"' in wasm
        run: |
          ! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/irpc.wasm | grep 'import "env"'

  # Checks correct runtime deps and features are requested by not including dev-dependencies.
  check-deps:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
      - name: cargo check
        run: cargo check --locked --workspace --all-features --lib --bins

  minimal-crates:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
        with:
          toolchain: nightly
      - uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
      - name: cargo check
        run: |
          rm -f Cargo.lock
          cargo +nightly check -Z minimal-versions -Z min-publish-age \
            --config 'registry.global-min-publish-age="3 days"' \
            -p irpc -p irpc-derive --all-features --lib --bins

  cargo-deny:
    timeout-minutes: 30
    name: cargo deny
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2.1.1
        with:
          arguments: --workspace --all-features
          command: check
          command-arguments: "-Dwarnings"

  check_semver:
    runs-on: ubuntu-latest
    env:
      RUSTC_WRAPPER: "sccache"
      SCCACHE_GHA_ENABLED: "on"
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
          fetch-depth: 0
      - name: Install sccache
        uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11

      - name: Setup Environment (PR)
        if: ${{ github.event_name == 'pull_request' }}
        shell: bash
        run: |
          echo "HEAD_COMMIT_SHA=$(git rev-parse "origin/$GITHUB_BASE_REF")" >> "$GITHUB_ENV"
      - name: Setup Environment (Push)
        if: ${{ github.event_name == 'push' || github.event_name == 'merge_group' }}
        shell: bash
        run: |
          echo "HEAD_COMMIT_SHA=$(git rev-parse origin/main)" >> "$GITHUB_ENV"
      - name: Check semver
        # uses: obi1kenobi/cargo-semver-checks-action@v2
        uses: n0-computer/cargo-semver-checks-action@b49de9133f8849bb51cae32c6bdeb19a5c37e61f # feat-baseline
        with:
          package: irpc
          baseline-rev: ${{ env.HEAD_COMMIT_SHA }}
          use-cache: false

  check_external_types:
    timeout-minutes: 30
    name: Check external types in public API
    runs-on: ubuntu-latest
    env:
      RUSTC_WRAPPER: "sccache"
      SCCACHE_GHA_ENABLED: "on"
      # The tool drives an internal rustdoc invocation that only emits JSON
      # for the analyzer, so the workflow-wide `-Dwarnings` would just turn
      # unrelated rustdoc lints (e.g. `private-intra-doc-links`) into hard
      # failures here. Clear it for this job.
      RUSTDOCFLAGS: ""
      # Pin to the nightly that the pinned `cargo-check-external-types`
      # release was last tested against. Update both together.
      CARGO_CHECK_EXTERNAL_TYPES_VERSION: "0.5.0"
      TOOLCHAIN: "nightly-2026-03-20"
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
        with:
          toolchain: ${{ env.TOOLCHAIN }}
      - name: Install sccache
        uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11

      - name: Install cargo-check-external-types
        uses: taiki-e/install-action@a4d3f3f761dcd95cce1b72cb61cb6d1963438177 # v2.87.30
        with:
          tool: |
            cargo-make
            cargo-check-external-types@${{ env.CARGO_CHECK_EXTERNAL_TYPES_VERSION }}

      - name: Check external types
        run: cargo make check-external-types
      - name: Lockfile must not have moved
        # cargo make takes no --locked; assert the lockfile instead.
        run: git diff --exit-code Cargo.lock