rustcdc 0.1.2

Embeddable Rust CDC library focused on correctness-first capture primitives
Documentation
name: ci

on:
  workflow_dispatch:
  push:
    branches:
      - main
  pull_request:

permissions:
  contents: read

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

jobs:
  msrv:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: 1.88.0
      - uses: Swatinem/rust-cache@v2
      - name: cargo check --no-default-features (msrv)
        run: cargo check --no-default-features
      - name: cargo check --features default (msrv)
        run: cargo check --features default
      - name: cargo test --lib --features default (msrv)
        run: cargo test --lib --features default

  check:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        rust: [stable, nightly]
        profile:
          - { name: no-default-features, args: "--no-default-features" }
          - { name: default-features, args: "--features default" }
          - { name: all-features, args: "--all-features" }
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@v2
      - name: cargo check (${{ matrix.profile.name }})
        run: cargo check ${{ matrix.profile.args }}
      - name: cargo test --lib (${{ matrix.profile.name }})
        run: cargo test --lib ${{ matrix.profile.args }}
      - name: cargo build --example suite (stable ubuntu)
        if: matrix.os == 'ubuntu-latest' && matrix.rust == 'stable'
        run: |
          cargo build --example pg_to_stdout --features postgres
          cargo build --example postgres_to_otel --features postgres,metrics
          cargo build --example sqlserver_to_otel --features sqlserver,metrics
          cargo build --example regex_filter_transform
          cargo build --example uppercase_transform

  quality:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
        rust: [stable, nightly]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
          components: rustfmt, clippy
      - uses: Swatinem/rust-cache@v2
      - name: cargo fmt --check
        run: cargo fmt --check
      - name: cargo clippy --all-targets --all-features -- -D warnings
        run: cargo clippy --all-targets --all-features -- -D warnings
      - name: cargo doc --all-features --no-deps
        run: cargo doc --all-features --no-deps
        env:
          RUSTDOCFLAGS: "-D warnings"

  transport-security:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --lib --features postgres,tls
        run: cargo test --lib --features postgres,tls
      - name: cargo test --lib --features mysql,tls
        run: cargo test --lib --features mysql,tls
      - name: cargo test --lib --features sqlserver,tls
        run: cargo test --lib --features sqlserver,tls

  docs-link-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: markdown link check
        run: bash scripts/ci-doc-links.sh

  benchmark-regression-gate:
    runs-on: ubuntu-latest
    env:
      BENCHMARK_BASELINE_COMMIT: ${{ github.sha }}
      BENCHMARK_BASELINE_ARTIFACT: BENCHMARK_REPORT.md
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@v2
      - name: benchmark regression gate (criterion)
        run: bash scripts/ci-benchmark-gate.sh
      - name: upload benchmark regression artifacts
        uses: actions/upload-artifact@v4
        with:
          name: benchmark-regression-evidence
          path: |
            target/benchmark-ci-gate*.txt
            target/benchmark-ci-env.txt
            target/criterion
            BENCHMARK_REPORT.md

  latency-evidence:
    runs-on: ubuntu-latest
    env:
      CDC_RS_RUN_DOCKER_TESTS: "1"
      LATENCY_GATE_DEFAULT_P95_MS: "500"
      LATENCY_GATE_DEFAULT_P99_MS: "1000"
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@v2
      - name: connector-backed latency evidence gate (p95/p99)
        run: bash scripts/ci-latency-gate.sh
      - name: upload latency evidence artifacts
        uses: actions/upload-artifact@v4
        with:
          name: latency-evidence
          path: |
            target/latency-evidence.txt
            target/latency-gate.txt
            target/postgres-latency-evidence.json
            target/postgres-latency-evidence.md
            target/mysql-latency-evidence.json
            target/mysql-latency-evidence.md
            target/sqlserver-latency-evidence.json
            target/sqlserver-latency-evidence.md

  integration-postgres-runtime:
    runs-on: ubuntu-latest
    env:
      CDC_RS_RUN_DOCKER_TESTS: "1"
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --test runtime_postgres --features postgres
        run: cargo test --test runtime_postgres --features postgres

  integration-postgres:
    runs-on: ubuntu-latest
    env:
      CDC_RS_RUN_DOCKER_TESTS: "1"
    strategy:
      fail-fast: false
      matrix:
        rust: [stable, nightly]
        suite:
          - runtime_postgres
          - postgres_version_matrix
          - postgres_snapshot_integration
          - postgres_stream_integration
          - postgres_handoff_integration
          - checkpoint_file_integration
          - runtime_postgres_process_crash_integration
          - parallel_snapshot_stress_integration
          - otel_metrics_integration
          - otel_tracing_integration
          - snapshot_resumable_integration
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --test ${{ matrix.suite }}
        if: matrix.suite != 'runtime_postgres_process_crash_integration' && matrix.suite != 'otel_metrics_integration' && matrix.suite != 'otel_tracing_integration'
        run: cargo test --test ${{ matrix.suite }} --features postgres
      - name: cargo test --test ${{ matrix.suite }} (metrics)
        if: matrix.suite == 'otel_metrics_integration' || matrix.suite == 'otel_tracing_integration'
        run: cargo test --test ${{ matrix.suite }} --features postgres,metrics
      - name: cargo test --test runtime_postgres_process_crash_integration (with bins)
        if: matrix.suite == 'runtime_postgres_process_crash_integration'
        run: cargo test --test runtime_postgres_process_crash_integration --features postgres --bins

  integration-postgres-encryption:
    runs-on: ubuntu-latest
    env:
      CDC_RS_RUN_DOCKER_TESTS: "1"
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --test runtime_postgres_process_crash_integration --features postgres,encryption --bins
        run: cargo test --test runtime_postgres_process_crash_integration --features postgres,encryption --bins

  integration-reliability:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        suite:
          - data_loss_detection
          - deterministic_replay_failure_fixtures
          - deterministic_replay_golden_fixtures
          - runtime_health_states
          - fault_injection_soak_matrix
          - wasm_runtime_integration
          - wasm_conformance_contract
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --test ${{ matrix.suite }} --features postgres,test-harnesses
        run: cargo test --test ${{ matrix.suite }} --features postgres,test-harnesses

  integration-mysql:
    runs-on: ubuntu-latest
    env:
      CDC_RS_RUN_DOCKER_TESTS: "1"
      CDC_RS_ALLOW_INSECURE_TEST_TRANSPORT: "1"
    strategy:
      fail-fast: false
      matrix:
        rust: [stable, nightly]
        suite:
          - mysql_version_matrix
          - mysql_connection_integration
          - mysql_snapshot_integration
          - mysql_stream_integration
          - mysql_handoff_integration
          - runtime_mysql_process_crash_integration
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --test ${{ matrix.suite }}
        if: matrix.suite != 'runtime_mysql_process_crash_integration'
        run: cargo test --test ${{ matrix.suite }} --features mysql,insecure-test-overrides
      - name: cargo test --test runtime_mysql_process_crash_integration (with bins)
        if: matrix.suite == 'runtime_mysql_process_crash_integration'
        run: cargo test --test runtime_mysql_process_crash_integration --features mysql,insecure-test-overrides --bins

  integration-mysql-encryption:
    runs-on: ubuntu-latest
    env:
      CDC_RS_RUN_DOCKER_TESTS: "1"
      CDC_RS_ALLOW_INSECURE_TEST_TRANSPORT: "1"
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --test runtime_mysql_process_crash_integration --features mysql,encryption --bins
        run: cargo test --test runtime_mysql_process_crash_integration --features mysql,encryption,insecure-test-overrides --bins

  integration-mariadb:
    runs-on: ubuntu-latest
    env:
      CDC_RS_RUN_DOCKER_TESTS: "1"
      CDC_RS_ALLOW_INSECURE_TEST_TRANSPORT: "1"
    strategy:
      fail-fast: false
      matrix:
        rust: [stable, nightly]
        suite:
          - mariadb_connection_integration
          - mariadb_e2e_integration
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --test ${{ matrix.suite }}
        run: cargo test --test ${{ matrix.suite }} --features mysql,insecure-test-overrides

  integration-sqlserver:
    runs-on: ubuntu-latest
    env:
      CDC_RS_RUN_DOCKER_TESTS: "1"
      CDC_RS_ALLOW_INSECURE_TEST_TRANSPORT: "1"
    strategy:
      fail-fast: false
      matrix:
        rust: [stable, nightly]
        suite:
          - sqlserver_version_matrix
          - sqlserver_snapshot_integration
          - sqlserver_stream_integration
          - sqlserver_handoff_integration
          - runtime_sqlserver_process_crash_integration
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --test ${{ matrix.suite }}
        if: matrix.suite != 'runtime_sqlserver_process_crash_integration'
        run: cargo test --test ${{ matrix.suite }} --features sqlserver,insecure-test-overrides
      - name: cargo test --test runtime_sqlserver_process_crash_integration (with bins)
        if: matrix.suite == 'runtime_sqlserver_process_crash_integration'
        run: cargo test --test runtime_sqlserver_process_crash_integration --features sqlserver,insecure-test-overrides --bins

  integration-sqlserver-encryption:
    runs-on: ubuntu-latest
    env:
      CDC_RS_RUN_DOCKER_TESTS: "1"
      CDC_RS_ALLOW_INSECURE_TEST_TRANSPORT: "1"
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
      - uses: Swatinem/rust-cache@v2
      - name: cargo test --test runtime_sqlserver_process_crash_integration --features sqlserver,encryption,insecure-test-overrides --bins
        run: cargo test --test runtime_sqlserver_process_crash_integration --features sqlserver,encryption,insecure-test-overrides --bins