Skip to content
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

[IDWA-OCR-97] Benchmark tests and action #100

Merged
merged 19 commits into from
May 22, 2024
34 changes: 34 additions & 0 deletions .github/workflows/ocr-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: OCR Poetry Benchmark Tests
on:
push:
branches:
- main
paths:
- .github/workflows/ocr-benchmarks.yml
- OCR/**
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
cd OCR/tests
python -m pip install --upgrade pip
pip install poetry
pip install pytest pytest-benchmark
poetry install --with dev
- name: Run tests
run: |
cd OCR/tests
poetry run pytest bench_test.py -v --benchmark-json output.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'pytest'
output-file-path: OCR/tests/output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
4 changes: 2 additions & 2 deletions .github/workflows/ocr-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: OCR Poetry Tests
name: OCR Poetry Unit Tests
on:
pull_request:
paths:
Expand All @@ -21,4 +21,4 @@ jobs:
pip install poetry
poetry install --with dev
- name: Run tests
run: poetry run pytest
run: poetry run pytest tests/ocr_test.py tests/segmentation_template_test.py
9 changes: 8 additions & 1 deletion OCR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ poetry shell
poetry install
```

Run tests
Run unit tests
```shell
poetry run pytest
```

Run benchmark tests
```shell
poetry run pytest bench_test.py -v
```

poetry run pytest bench_test.py -v

Run main, hoping to convert this to a cli at some point
```shell
poetry run main
Expand Down
Loading
Loading