cindermark 0.2.0

High-performance incremental Markdown parser with UTF-16 offsets, built for native text editors on Apple platforms
Documentation
name: CI

# Linux-only by design: the core crate is platform-independent, and Linux
# runners are free for public repos. Apple artifacts are built by the
# manual-dispatch release workflow instead (macOS runners cost money).
# push is limited to main so PR branches don't run CI twice
# (the pull_request trigger already covers them).
on:
  push:
    branches: [main]
  pull_request:

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: fmt + clippy + test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

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

      - name: Cache cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}

      - name: rustfmt
        run: cargo fmt --check

      # Lint and test BOTH configurations: the default pure-Rust build (what
      # `cargo add cindermark` gives — three dependencies, no UniFFI) and the
      # full `ffi` + `bindgen` build (the Swift/Apple path). This guarantees a
      # change that compiles in one configuration but not the other is caught.
      - name: clippy (default / pure Rust)
        run: cargo clippy --all-targets -- -D warnings

      - name: clippy (ffi + bindgen)
        run: cargo clippy --all-targets --features bindgen -- -D warnings

      - name: tests (default / pure Rust)
        run: cargo test

      - name: tests (ffi)
        run: cargo test --features ffi

      - name: benches compile
        run: cargo bench --no-run

      - name: Swift bindings drift check
        run: |
          cargo run --features bindgen --bin uniffi-bindgen generate src/cindermark.udl \
            --language swift --no-format --out-dir /tmp/bindings-check
          diff -u swift/Sources/Cindermark/CindermarkFFI.swift /tmp/bindings-check/CindermarkFFI.swift \
            || { echo "::error::Committed Swift bindings are stale. Regenerate with uniffi-bindgen (see CONTRIBUTING.md)."; exit 1; }