Skip to content

Commit

Permalink
[IDWA-OCR-97] Benchmark tests and action (#100)
Browse files Browse the repository at this point in the history
* try benchmarks in gha

* try benchmarks in gha

* add ./

* add >

* add rel path to with option

* gh-pages branch and secret

* gh-pages branch and secret

* change path

* change path

* change path

* add auto-push

* make change for another test commit for graph

* point to local init fun and not global

* end of line

* lint

* on push main

* update readme

* change names to workflows

* point only to unit tests in workflow

---------

Co-authored-by: Derek Dombek <derek.a.dombek.com>
  • Loading branch information
derekadombek authored May 22, 2024
1 parent aab1037 commit 01fcdfb
Show file tree
Hide file tree
Showing 6 changed files with 546 additions and 409 deletions.
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

0 comments on commit 01fcdfb

Please sign in to comment.