A fast, helpful, and open-source document parser
improve tarball releases + coverage
Logan Markewich0bba42dc1933
diff --git a/.github/workflows/release-crates.yml b/.github/workflows/release-crates.ymlindex 8f07157..00f32b5 100644--- a/.github/workflows/release-crates.yml+++ b/.github/workflows/release-crates.yml@@ -74,21 +74,33 @@ jobs:build-binaries:needs: validatestrategy:+ fail-fast: falsematrix:include:- target: x86_64-unknown-linux-gnu- os: ubuntu-latest+ os: ubuntu-22.04artifact: lit-linux-x64+ pdfium-dylib: libpdfium.so- target: aarch64-unknown-linux-gnu- os: ubuntu-latest+ os: ubuntu-22.04-armartifact: lit-linux-arm64- use-cross: true+ pdfium-dylib: libpdfium.so- target: aarch64-apple-darwinos: macos-latestartifact: lit-darwin-arm64+ pdfium-dylib: libpdfium.dylib- target: x86_64-apple-darwinos: macos-26-intelartifact: lit-darwin-x64+ pdfium-dylib: libpdfium.dylib+ - target: x86_64-pc-windows-msvc+ os: windows-latest+ artifact: lit-windows-x64+ pdfium-dylib: pdfium.dll+ - target: aarch64-pc-windows-msvc+ os: windows-11-arm+ artifact: lit-windows-arm64+ pdfium-dylib: pdfium.dllruns-on: ${{ matrix.os }}@@ -99,23 +111,21 @@ jobs:with:targets: ${{ matrix.target }}- - name: Install system dependencies (Linux native)- if: runner.os == 'Linux' && !matrix.use-cross+ - name: Install system dependencies (Linux)+ if: runner.os == 'Linux'run: |sudo apt-get updatesudo apt-get install -y libtesseract-dev libleptonica-dev- - name: Install cross-compilation tools (Linux ARM64)- if: matrix.use-cross- run: |- sudo apt-get update- sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu- echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV-- name: Install system dependencies (macOS)if: runner.os == 'macOS'run: brew install tesseract leptonica+ - name: Force Ninja generator (Windows)+ if: runner.os == 'Windows'+ run: echo "CMAKE_GENERATOR=Ninja" >> $GITHUB_ENV+ shell: bash+- uses: actions/cache@v4with:path: |@@ -123,30 +133,53 @@ jobs:~/.cargo/git~/.cache/pdfium-rs~/Library/Caches/pdfium-rs+ ${{ runner.os == 'Windows' && format('{0}\pdfium-rs', env.LOCALAPPDATA) || '' }}targetkey: ${{ runner.os }}-${{ matrix.target }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}- name: Build+ run: cargo build --release --target ${{ matrix.target }} -p liteparse++ - name: Stage binary and pdfium (Unix)+ if: runner.os != 'Windows'+ shell: bashrun: |- if [ "${{ matrix.use-cross }}" = "true" ]; then- # Cross-compile without tesseract (C cross-deps are hard)- cargo build --release --target ${{ matrix.target }} --no-default-features -p liteparse- else- cargo build --release --target ${{ matrix.target }} -p liteparse- fi+ mkdir -p staging/${{ matrix.artifact }}+ cp target/${{ matrix.target }}/release/lit staging/${{ matrix.artifact }}/lit+ chmod +x staging/${{ matrix.artifact }}/lit+ bash packages/node/scripts/copy-pdfium.sh staging/${{ matrix.artifact }}++ - name: Stage binary and pdfium (Windows)+ if: runner.os == 'Windows'+ shell: pwsh+ run: |+ New-Item -ItemType Directory -Force -Path "staging/${{ matrix.artifact }}" | Out-Null+ Copy-Item "target/${{ matrix.target }}/release/lit.exe" -Destination "staging/${{ matrix.artifact }}/lit.exe"+ $cacheBase = "$env:LOCALAPPDATA\pdfium-rs"+ if (-not (Test-Path $cacheBase)) {+ $cacheBase = "$env:USERPROFILE\.cache\pdfium-rs"+ }+ $dll = Get-ChildItem -Path $cacheBase -Recurse -Filter "pdfium.dll" | Select-Object -First 1+ if ($dll) {+ Copy-Item $dll.FullName -Destination "staging/${{ matrix.artifact }}/pdfium.dll"+ Write-Host "Copied $($dll.FullName) -> staging/${{ matrix.artifact }}/pdfium.dll"+ } else {+ Write-Error "Could not find pdfium.dll in cache"+ exit 1+ }- - name: Package binary+ - name: Package tarball+ shell: bashrun: |mkdir -p dist- cp target/${{ matrix.target }}/release/lit dist/${{ matrix.artifact }}- chmod +x dist/${{ matrix.artifact }}- tar -czf dist/${{ matrix.artifact }}.tar.gz -C dist ${{ matrix.artifact }}+ tar -czf dist/${{ matrix.artifact }}.tar.gz -C staging ${{ matrix.artifact }}- name: Upload artifactuses: actions/upload-artifact@v4with:name: ${{ matrix.artifact }}path: dist/${{ matrix.artifact }}.tar.gz+ if-no-files-found: errorgithub-release:needs: [build-binaries, publish-crates]