name: CI on: push: branches: [main] pull_request: branches: [main] env: CARGO_TERM_COLOR: always SKIP_INTEGRATION_TESTS: yes jobs: fmt: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: rustup toolchain install stable --profile minimal --component rustfmt - run: cargo fmt --all -- --check clippy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install system dependencies run: | sudo apt-get update sudo apt-get install -y libtesseract-dev libleptonica-dev - uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git ~/.cache/pdfium-rs target key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }} - run: rustup toolchain install stable --profile minimal --component clippy - run: cargo clippy --all-targets build-and-test: strategy: matrix: os: [ubuntu-latest, macos-latest, macos-26-intel, windows-latest, windows-11-arm] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 - name: Install system dependencies (Linux) if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y libtesseract-dev libleptonica-dev - name: Install system dependencies (macOS) if: runner.os == 'macOS' run: brew install tesseract leptonica - uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git ~/.cache/pdfium-rs ~/Library/Caches/pdfium-rs ${{ runner.os == 'Windows' && format('{0}\pdfium-rs', env.LOCALAPPDATA) || '' }} target key: ${{ matrix.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} - name: Force Ninja generator (Windows) if: runner.os == 'Windows' run: echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV shell: bash - run: cargo build --workspace --all-targets --exclude liteparse-python --exclude liteparse-napi - run: cargo test --workspace --exclude liteparse-python --exclude liteparse-napi - name: CLI smoke test if: runner.os != 'Windows' run: | ./target/debug/lit --version ./target/debug/lit parse demo/docs/apple-10k-2024.pdf --no-ocr --max-pages 1 -q | head -5 - name: OCR smoke test (runtime tessdata download) shell: bash run: | # Wipe any tessdata that tesseract-rs/build.rs downloaded during # `cargo build`, so the parse exercises the runtime first-use # download path (the code path that npm/pip prebuilt users hit). rm -rf "$HOME/Library/Application Support/tesseract-rs" \ "$HOME/.tesseract-rs" \ "${APPDATA:-}/tesseract-rs" 2>/dev/null || true LIT=./target/debug/lit [ -f "$LIT.exe" ] && LIT="$LIT.exe" "$LIT" parse demo/docs/long_tiny_text.pdf --max-pages 1 -q -o ocr-out.txt # If OCR ran, page 1 has substantial text beyond just the # "--- Page 1 ---" header (~16 bytes). A tessdata-load failure # surfaces as systemic OCR failure and an empty/tiny output. size=$(wc -c < ocr-out.txt) echo "OCR output size: $size bytes" test "$size" -gt 200 # Test that docker builds build-docker-image: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build the base Docker image run: docker build . - name: Build the full Docker image run: docker build . -f full.Dockerfile