leptris 1.6.13

Rust bindings for libleptris — fast XML 1.0 parsing, XPath 1.0, SAX
Documentation
name: CI

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

concurrency:
  group: ci-${{ github.head_ref || github.ref_name }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  test:
    name: cargo test (${{ matrix.os }})
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
    steps:
      - uses: actions/checkout@v4
      - name: Checkout engine repository
        uses: actions/checkout@v4
        with:
          repository: leptris/leptris
          ref: main
          path: engine
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt
      - name: Install utf8proc
        shell: bash
        run: |
          if [ "$RUNNER_OS" = "macOS" ]; then
            brew install utf8proc
          else
            sudo apt-get update
            sudo apt-get install -y libutf8proc-dev
          fi
      - name: Build libleptris shared library
        shell: bash
        run: |
          cmake -B engine/build-shared -S engine \
            -DCMAKE_BUILD_TYPE=Release \
            -DLEPTRIS_BUILD_SHARED=ON -DLEPTRIS_BUILD_STATIC=OFF \
            -DBUILD_TESTING=OFF -DLEPTRIS_BUILD_CLI=OFF \
            -DLEPTRIS_BUILD_BENCHMARKS=OFF \
            -DLEPTRIS_ENABLE_UTF8PROC=ON
          cmake --build engine/build-shared --config Release
          LIB=$(find engine/build-shared -type f -o -type l 2>/dev/null | grep -iE '(lib)?leptris\.(dylib|so)$' | head -1)
          if [ -z "$LIB" ]; then
            echo "ERROR: libleptris shared library not found"
            exit 1
          fi
          LIBDIR=$(cd "$(dirname "$LIB")" && pwd)
          echo "LEPTRIS_LIB_PATH=$LIBDIR" >> "$GITHUB_ENV"
          echo "Built: $LIB"
      - name: cargo build
        run: cargo build --workspace --verbose
      - name: cargo test
        run: cargo test --workspace --verbose
      - name: cargo fmt
        if: matrix.os == 'ubuntu-latest'
        run: cargo fmt --all --check

  wasm-node:
    name: wasm-pack test (node)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Checkout engine repository
        uses: actions/checkout@v4
        with:
          repository: leptris/leptris
          ref: main
          path: engine
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: wasm32-unknown-unknown
      - uses: jetli/wasm-pack-action@v0.4.0
        with:
          version: latest
      - name: wasm-pack test (node; engine compiled in via cc)
        shell: bash
        run: |
          # #1900: the wasm feature compiles the engine INTO the crate
          # (wasm/shim/ is the freestanding libc); LEPTRIS_SRC_PATH
          # points at the checked-out engine tree.
          LEPTRIS_SRC_PATH="$PWD/engine" wasm-pack test --node -- --features wasm

  wasm-browser:
    name: wasm-pack test (headless chrome)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Checkout engine repository
        uses: actions/checkout@v4
        with:
          repository: leptris/leptris
          ref: main
          path: engine
      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: wasm32-unknown-unknown
      - uses: jetli/wasm-pack-action@v0.4.0
        with:
          version: latest
      - uses: nanasess/setup-chromedriver@v2
      - name: wasm-pack test (headless chrome — the #1900 browser leg)
        shell: bash
        run: |
          LEPTRIS_SRC_PATH="$PWD/engine" wasm-pack test --headless --chrome -- --features wasm