-
Notifications
You must be signed in to change notification settings - Fork 2
✨ ⬆️ add support for mindee-lite gem #240
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2d17c21
:sparkles: :arrow_up: add support for mindee-lite gem
sebastianMindee 79cec0e
fix version
sebastianMindee 36577bf
fix typo in pr action
sebastianMindee c5cde90
add explicit 'logger' dependency
sebastianMindee 7eefee9
fix syntax
sebastianMindee 5acc3a1
apply suggestions
sebastianMindee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # | ||
| # Run integration tests. | ||
| # | ||
| name: Integration Tests (Lite) | ||
|
|
||
| on: | ||
| workflow_call: | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }} | ||
| WORKFLOW_ID: ${{ secrets.WORKFLOW_ID_SE_TESTS }} | ||
| MINDEE_V2_API_KEY: ${{ secrets.MINDEE_V2_SE_TESTS_API_KEY }} | ||
| MINDEE_V2_FINDOC_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }} | ||
| MINDEE_V2_SE_TESTS_BLANK_PDF_URL: ${{ secrets.MINDEE_V2_SE_TESTS_BLANK_PDF_URL }} | ||
| MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }} | ||
| MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID }} | ||
| MINDEE_V2_SE_TESTS_CROP_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_CROP_MODEL_ID }} | ||
| MINDEE_V2_SE_TESTS_OCR_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_OCR_MODEL_ID }} | ||
| MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID }} | ||
| MINDEE_LOG_LEVEL: DEBUG | ||
| MINDEE_GEM_NAME: mindee-lite | ||
|
|
||
| jobs: | ||
| integration-tests: | ||
| name: Run Integration Tests | ||
| timeout-minutes: 30 | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| max-parallel: 3 | ||
| matrix: | ||
| os: | ||
| - "ubuntu-24.04" | ||
| - "macos-latest" | ||
| ruby: | ||
| - "4.0" | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: set up Ruby ${{ matrix.ruby }} | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: ${{ matrix.ruby }} | ||
| bundler-cache: true | ||
|
|
||
| - name: Run Rspec for integration tests | ||
| run: | | ||
| bundle exec rake integration | ||
2 changes: 1 addition & 1 deletion
2
.github/workflows/_test-integrations.yml → .github/workflows/_test-integration.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # | ||
| # Run lite unit tests. | ||
| # | ||
| name: Unit Tests (Lite) | ||
|
sebastianMindee marked this conversation as resolved.
Outdated
|
||
|
|
||
| on: | ||
| workflow_call: | ||
|
|
||
| env: | ||
| MINDEE_GEM_NAME: mindee-lite | ||
|
|
||
| jobs: | ||
| tests: | ||
| name: Run Unit Tests | ||
| timeout-minutes: 30 | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: | ||
| - "ubuntu-24.04" | ||
| - "macos-latest" | ||
| ruby: | ||
| - "3.2" | ||
| - "4.0" | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: set up Ruby ${{ matrix.ruby }} | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: ${{ matrix.ruby }} | ||
| bundler-cache: true | ||
|
|
||
| - name: Run Rspec | ||
| env: | ||
| MINDEE_LOG_LEVEL: DEBUG | ||
| run: | | ||
| bundle exec rake spec | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| module Mindee | ||
| # Centralized check for optional heavy dependencies | ||
| module Dependency | ||
| def self.check_heavy_dependencies | ||
|
sebastianMindee marked this conversation as resolved.
Outdated
|
||
| require 'origami' | ||
| require 'mini_magick' | ||
| require 'pdf-reader' | ||
| true | ||
| rescue LoadError | ||
| false | ||
| end | ||
|
|
||
| @heavy_available = check_heavy_dependencies | ||
|
sebastianMindee marked this conversation as resolved.
Outdated
|
||
|
|
||
| def self.heavy_available? | ||
|
sebastianMindee marked this conversation as resolved.
Outdated
|
||
| check_heavy_dependencies | ||
| end | ||
|
|
||
| def self.require_heavy! | ||
|
sebastianMindee marked this conversation as resolved.
Outdated
|
||
| raise LoadError, MINDEE_LITE_LOAD_ERROR unless heavy_available? | ||
|
sebastianMindee marked this conversation as resolved.
Outdated
|
||
| end | ||
|
|
||
| MINDEE_LITE_LOAD_ERROR = 'Attempted to load Mindee PDF/Image tools without required dependencies. ' \ | ||
|
sebastianMindee marked this conversation as resolved.
Outdated
|
||
| "If you need to process local files, please replace the 'mindee-lite' gem " \ | ||
| "with the standard 'mindee' gem in your Gemfile." | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| Mindee::Dependency.require_heavy! | ||
| require 'origami' | ||
| require_relative 'pdf_tools' | ||
|
|
||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.