sqlite-diff-rs 0.2.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 -- -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


  # diesel E2E tests (standalone workspace, requires Docker for Pg and MySQL)
  diesel-e2e:
    name: Diesel E2E Tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6

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

      - name: Install system libraries
        run: |
          sudo apt-get update
          sudo apt-get install -y libpq-dev default-libmysqlclient-dev

      - name: Cache cargo registry and build
        uses: Swatinem/rust-cache@v2
        with:
          workspaces: integration-tests/diesel-e2e

      - name: Check formatting
        run: cargo fmt --manifest-path integration-tests/diesel-e2e/Cargo.toml --all -- --check

      - name: Clippy
        run: cargo clippy --manifest-path integration-tests/diesel-e2e/Cargo.toml --tests -- -D warnings

      - name: Run diesel E2E tests
        run: cargo test --manifest-path integration-tests/diesel-e2e/Cargo.toml --release -- --test-threads=1