sqlite-diff-rs 0.1.0

Build SQLite changeset and patchset binary formats programmatically, without SQLite
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always
  RUSTFLAGS: -D warnings

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v6

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

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

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

      - name: Build benchmarks (test mode)
        run: cargo test --benches --all-features --no-run

      - name: Run benchmarks in test mode
        run: cargo test --benches --all-features

  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

      - name: Install Rust nightly
        uses: dtolnay/rust-toolchain@nightly
        with:
          components: clippy, rustfmt

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

      - name: Check formatting
        run: cargo fmt --all -- --check

      - name: Clippy (main crate)
        run: cargo clippy --all-features --all-targets -- -D warnings

      - name: Clippy (workspace members)
        run: |
          cargo clippy --all-features -p sqlite-diff-rs \
            -p payload-size-bench -p apply-bench-report -p wal2json-integration-tests \
            -p pg-walstream-integration-tests -- -D warnings

      - name: Validate SVG files
        run: |
          sudo apt-get update && sudo apt-get install -y libxml2-utils
          find . -name "*.svg" -type f -not -path "./target/*" | while read -r svg; do
            echo "Validating $svg"
            xmllint --noout "$svg" || exit 1
          done

  docs:
    name: Documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

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

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

      - name: Build documentation
        run: cargo doc --no-deps --all-features
        env:
          RUSTDOCFLAGS: -D warnings

  # Minimal build without default features (no_std compatibility check)
  no-std:
    name: no_std build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

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

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

      - name: Build with no default features
        run: cargo build --no-default-features

  # Ensure Cargo.lock is up to date
  lockfile:
    name: Lockfile
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

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

      - name: Check Cargo.lock is up to date
        run: cargo update --locked

  # wal2json integration tests (requires Docker)
  wal2json-integration:
    name: wal2json Integration Tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

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

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

      - name: Run wal2json integration tests
        run: cargo test -p wal2json-integration-tests --test postgres_integration