A fast, helpful, and open-source document parser
more musl tests
Logan Markewichab614683c154
diff --git a/.github/workflows/ci-node.yml b/.github/workflows/ci-node.ymlindex 55e6e88..932a692 100644--- a/.github/workflows/ci-node.yml+++ b/.github/workflows/ci-node.yml@@ -38,6 +38,12 @@ jobs:node-arch: linux-arm64-gnupdfium-dylib: libpdfium.so+ - os: ubuntu-latest+ target: x86_64-unknown-linux-musl+ node-arch: linux-x64-musl+ pdfium-dylib: libpdfium.so+ use-container: true+- os: windows-latesttarget: x86_64-pc-windows-msvcnode-arch: win32-x64-msvc@@ -57,8 +63,8 @@ jobs:with:targets: ${{ matrix.target }}- - name: Install system dependencies (Linux)- if: runner.os == 'Linux'+ - name: Install system dependencies (Linux glibc)+ if: runner.os == 'Linux' && !matrix.use-containerrun: |sudo apt-get updatesudo apt-get install -y libtesseract-dev libleptonica-dev@@ -83,10 +89,28 @@ jobs:run: npm install --ignore-scripts- name: Build native module+ if: ${{ !matrix.use-container }}working-directory: packages/nodeshell: bashrun: npx napi build --cargo-cwd ../../crates/liteparse-napi --platform --release --js false --dts native.d.ts --target ${{ matrix.target }} .+ - name: Build native module (musl container)+ if: ${{ matrix.use-container }}+ run: |+ docker run --rm \+ -v "$GITHUB_WORKSPACE":/work \+ -v "$HOME/.cargo/registry":/root/.cargo/registry \+ -v "$HOME/.cargo/git":/root/.cargo/git \+ -v "$HOME/.cache/pdfium-rs":/root/.cache/pdfium-rs \+ -w /work/packages/node \+ node:20-alpine \+ sh -c '+ apk add --no-cache build-base cmake git curl pkgconf tesseract-ocr-dev leptonica-dev perl+ curl --proto "=https" --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable -t x86_64-unknown-linux-musl+ source /root/.cargo/env+ npx napi build --cargo-cwd ../../crates/liteparse-napi --platform --release --js false --dts native.d.ts --target x86_64-unknown-linux-musl .+ '+- name: Copy pdfium dylib (Unix)if: runner.os != 'Windows'working-directory: packages/node@@ -133,6 +157,9 @@ jobs:node-arch: darwin-arm64- os: ubuntu-latestnode-arch: linux-x64-gnu+ - os: ubuntu-latest+ node-arch: linux-x64-musl+ use-container: true- os: windows-latestnode-arch: win32-x64-msvcruns-on: ${{ matrix.os }}@@ -160,6 +187,7 @@ jobs:run: npx tsc- name: Smoke test+ if: ${{ !matrix.use-container }}working-directory: packages/noderun: |node -e "@@ -169,3 +197,18 @@ jobs:console.log('Native module loaded successfully');});"++ - name: Smoke test (musl container)+ if: ${{ matrix.use-container }}+ run: |+ docker run --rm \+ -v "$GITHUB_WORKSPACE":/work \+ -w /work/packages/node \+ node:20-alpine \+ node -e "+ import('./dist/lib.js').then(async ({ LiteParse }) => {+ const p = new LiteParse({ ocrEnabled: false, quiet: true });+ console.log('Config:', JSON.stringify(p.getConfig()));+ console.log('Native module loaded successfully');+ });+ "diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.ymlindex 263a37f..0bada1f 100644--- a/.github/workflows/ci-python.yml+++ b/.github/workflows/ci-python.yml@@ -32,6 +32,10 @@ jobs:- os: ubuntu-24.04-armtarget: aarch64-unknown-linux-gnu+ - os: ubuntu-latest+ target: x86_64-unknown-linux-musl+ musl: true+- os: windows-latesttarget: x86_64-pc-windows-msvc@@ -50,7 +54,7 @@ jobs:targets: ${{ matrix.target }}- name: Install system dependencies (Linux)- if: runner.os == 'Linux'+ if: runner.os == 'Linux' && !matrix.muslrun: |sudo apt-get updatesudo apt-get install -y libtesseract-dev libleptonica-dev@@ -74,7 +78,8 @@ jobs:targetkey: ${{ runner.os }}-${{ matrix.target }}-cargo-python-${{ hashFiles('**/Cargo.lock') }}- - name: Build wheels+ - name: Build wheels (glibc)+ if: ${{ !matrix.musl }}uses: PyO3/maturin-action@v1with:target: ${{ matrix.target }}@@ -90,6 +95,17 @@ jobs:apk add tesseract-ocr-dev leptonica-dev openssl-dev pkgconf || truefi+ - name: Build wheels (musl)+ if: ${{ matrix.musl }}+ uses: PyO3/maturin-action@v1+ with:+ target: ${{ matrix.target }}+ args: --release --out dist --find-interpreter+ manylinux: musllinux_1_2+ working-directory: packages/python+ before-script-linux: |+ apk add --no-cache tesseract-ocr-dev leptonica-dev openssl-dev pkgconf build-base cmake perl+- name: Copy pdfium dylib into wheel (Unix)if: runner.os != 'Windows'working-directory: packages/python@@ -191,6 +207,9 @@ jobs:target: aarch64-apple-darwin- os: ubuntu-latesttarget: x86_64-unknown-linux-gnu+ - os: ubuntu-latest+ target: x86_64-unknown-linux-musl+ use-container: true- os: windows-latesttarget: x86_64-pc-windows-msvcruns-on: ${{ matrix.os }}@@ -210,9 +229,11 @@ jobs:path: dist- name: Install wheel+ if: ${{ !matrix.use-container }}run: pip install --no-index --find-links dist liteparse- name: Smoke test+ if: ${{ !matrix.use-container }}run: |python -c "from liteparse import LiteParse, ParseResult, ParsedPage, TextItem, ScreenshotResult@@ -222,6 +243,7 @@ jobs:"- name: Parse test+ if: ${{ !matrix.use-container }}run: |python -c "from liteparse import LiteParse@@ -237,6 +259,7 @@ jobs:"- name: Bytes parse test+ if: ${{ !matrix.use-container }}run: |python -c "from liteparse import LiteParse@@ -250,6 +273,7 @@ jobs:"- name: Screenshot test+ if: ${{ !matrix.use-container }}run: |python -c "from liteparse import LiteParse@@ -263,7 +287,37 @@ jobs:"- name: CLI test+ if: ${{ !matrix.use-container }}run: |lit --versionlit parse demo/docs/apple-10k-2024.pdf --no-ocr --max-pages 1 -q | head -5echo "CLI test passed"++ - name: Test in musl container+ if: ${{ matrix.use-container }}+ run: |+ docker run --rm \+ -v "$GITHUB_WORKSPACE":/work \+ -w /work \+ python:3.12-alpine \+ sh -c '+ pip install --no-index --find-links dist liteparse+ python -c "+ from liteparse import LiteParse, ParseResult, ParsedPage, TextItem, ScreenshotResult+ parser = LiteParse(ocr_enabled=False, quiet=True)+ print(repr(parser))+ print(\"LiteParse loaded successfully\")+ "+ python -c "+ from liteparse import LiteParse+ parser = LiteParse(ocr_enabled=False, quiet=True, max_pages=2)+ result = parser.parse(\"demo/docs/apple-10k-2024.pdf\")+ assert result.num_pages == 2, f\"Expected 2 pages, got {result.num_pages}\"+ assert len(result.text) > 0, \"Expected non-empty text\"+ print(f\"Parsed {result.num_pages} pages, {len(result.text)} chars\")+ print(\"Parse test passed\")+ "+ lit --version+ lit parse demo/docs/apple-10k-2024.pdf --no-ocr --max-pages 1 -q | head -5+ echo "CLI test passed"+ '