-
Notifications
You must be signed in to change notification settings - Fork 17
fix: tests not working on CI #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,9 @@ jobs: | |
| - os: macos-latest | ||
| tesseract-install: brew install tesseract | ||
| - os: windows-latest | ||
| tesseract-install: winget install --id=UB-Mannheim.TesseractOCR -e --accept-package-agreements --accept-source-agreements | ||
| tesseract-install: | | ||
| winget install --id=UB-Mannheim.TesseractOCR -e --accept-package-agreements --accept-source-agreements | ||
| echo "C:\Program Files\Tesseract-OCR" >> $env:GITHUB_PATH | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
@@ -38,6 +40,10 @@ jobs: | |
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Install additional dependencies | ||
| if: matrix.os == 'ubuntu-latest' | ||
| run: sudo apt-get update && sudo apt-get install -y pkg-config libdbus-1-dev libssl-dev libclang-dev libxcb1-dev libxrandr-dev libpipewire-0.3-dev libwayland-dev libegl-dev | ||
|
|
||
|
Comment on lines
+43
to
+46
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some crates (e.g. libxcap, wayshot, pipewire) link against system libraries unavailable in a clean Ubuntu runner. |
||
| - name: Install Tesseract | ||
| run: ${{ matrix.tesseract-install }} | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,8 +69,18 @@ impl OcrEngine { | |
| image: &DynamicImage, | ||
| ) -> Result<(String, String, Option<f64>)> { | ||
| match &self.provider { | ||
| #[cfg(target_os = "macos")] | ||
| OcrProvider::MacOS => Ok(perform_ocr_apple(image, &self.options.languages)), | ||
| OcrProvider::MacOS => { | ||
| #[cfg(target_os = "macos")] | ||
| { | ||
| Ok(perform_ocr_apple(image, &self.options.languages)) | ||
| } | ||
| #[cfg(not(target_os = "macos"))] | ||
| { | ||
| Err(anyhow::anyhow!( | ||
| "macOS OCR is not available on this platform" | ||
| )) | ||
| } | ||
| } | ||
|
Comment on lines
-72
to
+83
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original implementation conditionally compiled the match arm, which caused missing-variant errors on non-macOS builds. |
||
| OcrProvider::Windows => { | ||
| #[cfg(target_os = "windows")] | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, tesseract.exe was installed but not on the PATH, causing command-not-found errors in tests.
The new multi-line run step ensures both installation and path exposure are handled consistently on Windows runners.