Skip to content

A fast, helpful, and open-source document parser

chore: further adjustments

Clelia (Astra) Bertelli5f50a39da37b
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 33ea9ef..31449d2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -39,7 +39,7 @@ jobs:
build-and-test:
strategy:
matrix:
- os: [ubuntu-latest, macos-latest]
+ os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
@@ -54,6 +54,23 @@ jobs:
if: runner.os == 'macOS'
run: brew install tesseract leptonica
+ - name: Install system dependencies (Windows)
+ if: runner.os == 'Windows'
+ shell: pwsh
+ run: |
+ $vcpkg = $env:VCPKG_INSTALLATION_ROOT
+ & "$vcpkg\vcpkg" install tesseract:x64-windows
+
+ - name: Set vcpkg env vars (Windows)
+ if: runner.os == 'Windows'
+ shell: pwsh
+ run: |
+ $vcpkg = $env:VCPKG_INSTALLATION_ROOT
+ echo "VCPKG_ROOT=$vcpkg" >> $env:GITHUB_ENV
+ echo "VCPKG_DEFAULT_TRIPLET=x64-windows" >> $env:GITHUB_ENV
+ echo "TESSERACT_INCLUDE_PATH=$vcpkg\installed\x64-windows\include" >> $env:GITHUB_ENV
+ echo "TESSERACT_LIB_PATH=$vcpkg\installed\x64-windows\lib" >> $env:GITHUB_ENV
+
- uses: actions/cache@v4
with:
path: |
diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml
deleted file mode 100644
index 90a66b4..0000000
--- a/.github/workflows/rust-ci.yml
+++ /dev/null
@@ -1,112 +0,0 @@
-name: Rust CI
-
-on:
- pull_request:
- paths:
- - crates/**/*.rs
- - crates/**/Cargo.toml
- - Cargo.toml
-env:
- CARGO_TERM_COLOR: always
-
-jobs:
- clippy:
- name: Clippy
- runs-on: ubuntu-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Install Rust toolchain
- uses: dtolnay/rust-toolchain@stable
- with:
- components: clippy
-
- - name: Cache cargo registry
- uses: actions/cache@v4
- with:
- path: |
- ~/.cargo/registry
- ~/.cargo/git
- target
- key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
-
- - name: Run clippy
- run: make lint-strict
-
- format:
- name: Format
- runs-on: ubuntu-latest
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Install Rust toolchain
- uses: dtolnay/rust-toolchain@stable
- with:
- components: rustfmt
-
- - name: Check formatting
- run: make format-check
-
- test:
- name: Test on ${{ matrix.os }}
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [ubuntu-latest, windows-latest, macos-latest]
- rust: [stable]
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Install Rust toolchain
- uses: dtolnay/rust-toolchain@master
- with:
- toolchain: ${{ matrix.rust }}
-
- - name: Cache cargo registry
- uses: actions/cache@v4
- with:
- path: |
- ~/.cargo/registry
- ~/.cargo/git
- target
- key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
- restore-keys: |
- ${{ runner.os }}-cargo-
-
- - name: Run tests
- run: make test
-
- build:
- name: Build on ${{ matrix.os }}
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [ubuntu-latest, windows-latest, macos-latest]
- rust: [stable]
-
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Install Rust toolchain
- uses: dtolnay/rust-toolchain@master
- with:
- toolchain: ${{ matrix.rust }}
-
- - name: Cache cargo registry
- uses: actions/cache@v4
- with:
- path: |
- ~/.cargo/registry
- ~/.cargo/git
- target
- key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
- restore-keys: |
- ${{ runner.os }}-cargo-
-
- - name: Run build
- run: make build
diff --git a/crates/pdfium/src/bitmap.rs b/crates/pdfium/src/bitmap.rs
index 429457d..1f96bd3 100644
--- a/crates/pdfium/src/bitmap.rs
+++ b/crates/pdfium/src/bitmap.rs
@@ -49,7 +49,15 @@ impl Bitmap {
/// Fill a rectangle with an ARGB color (0xAARRGGBB).
pub fn fill_rect(&self, left: i32, top: i32, width: i32, height: i32, color: u64) {
unsafe {
- pdfium_sys::FPDFBitmap_FillRect(self.handle, left, top, width, height, color);
+ pdfium_sys::FPDFBitmap_FillRect(
+ self.handle,
+ left,
+ top,
+ width,
+ height,
+ // necessary for windows -> expected `u32`, found `u64`
+ color.try_into().unwrap(),
+ );
}
}