harmorp 0.1.2

Enhanced Nazief-Adriani Indonesian stemmer: iterative ECS, nasal-assimilation restoration, phonotactic guards, FST dictionary, zero-alloc hot path
Documentation
name: CI

on:
  push:
    branches: [main]
    tags: ["v*"]
  pull_request:
    branches: [main]

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  test:
    name: Test (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]

    steps:
      - uses: actions/checkout@v4

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

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

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

      - name: Clippy (deny warnings)
        run: cargo clippy -- -D warnings

      - name: Run tests
        run: cargo test

      - name: Run diagnostic tests
        run: cargo test --ignored -- --nocapture 2>&1 || true

  bench-check:
    name: Benchmark compile check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Cache cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ubuntu-cargo-bench-${{ hashFiles('**/Cargo.lock') }}
      - name: Check benchmarks compile
        run: cargo bench --no-run

  guard:
    name: Proprietary reference guard
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Check for proprietary references
        run: |
          if grep -rn "KBBI\|kbbi" src/ tests/ benches/ examples/ README.md Cargo.toml 2>/dev/null | grep -v "^Binary"; then
            echo "ERROR: Found proprietary references in public repo"
            exit 1
          fi
          echo "OK: No proprietary references found"
      - name: Check for old package name
        run: |
          if grep -rn "harmorph_stemmer" src/ tests/ benches/ examples/ README.md 2>/dev/null; then
            echo "ERROR: Found old package name references"
            exit 1
          fi
          echo "OK: Package name is clean"
      - name: Verify package name in Cargo.toml
        run: |
          NAME=$(grep '^name' Cargo.toml | head -1 | sed 's/.*= *"\(.*\)"/\1/')
          if [ "$NAME" != "harmorp" ]; then
            echo "ERROR: Package name is '$NAME', expected 'harmorp'"
            exit 1
          fi
          echo "OK: Package name is harmorp"

  publish:
    name: Publish to crates.io
    runs-on: ubuntu-latest
    needs: [test, guard]
    if: startsWith(github.ref, 'refs/tags/v')
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
      - name: Cache cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ubuntu-cargo-publish-${{ hashFiles('**/Cargo.lock') }}
      - name: Publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: cargo publish --token "$CARGO_REGISTRY_TOKEN"