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

get CI rolling again #110

Open
wants to merge 14 commits into
base: fix-ci-versions
Choose a base branch
from
Open
27 changes: 13 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,32 @@ jobs:
working_directory: '~/repo'
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "requirements.test.txt" }}
- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install -r requirements.test.txt
pip install -r requirements.txt
sudo apt-get update -y
sudo apt-get install -y imagemagick
make models
pip install .
- restore_cache:
keys:
# ocrd-resources depends on the model files registered under ocrd_anybaseocr/ocrd-tool.json
- v2-models-{{ checksum "ocrd_anybaseocr/ocrd-tool.json" }}
- run:
name: download models
command: make models
- save_cache:
paths:
- ./venv
- ./ocrd-resources
# ocrd-resources depends on the model files registered under core/ocrd-tool json
# but let's assume these won't change without changing requirements.txt for now
key: v1-dependencies-{{ checksum "requirements.txt" }}-{{ checksum "requirements.test.txt" }}
- ~/.local/share/ocrd-resources
key: v2-models-{{ checksum "ocrd_anybaseocr/ocrd-tool.json" }}
- run:
name: run unit tests
command: . venv/bin/activate && make test
command: make test
- run:
name: run CLI tests
command: . venv/bin/activate && pip install . && make cli-test
command: make cli-test
- store_artifacts:
path: test-reports
destination: test-reports
Expand Down Expand Up @@ -68,7 +67,7 @@ workflows:
- test:
matrix:
parameters:
version: ['3.7', '3.8', '3.9', '3.10', '3.11']
version: ['3.8', '3.9', '3.10', '3.11']
- deploy-docker:
filters:
branches:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ocrd/core-cuda:v2.63.0 AS base
FROM ocrd/core-cuda-tf2:v2.70.0 AS base
ARG VCS_REF
ARG BUILD_DATE
LABEL \
Expand All @@ -7,14 +7,14 @@ LABEL \
org.label-schema.vcs-url="https://github.com/OCR-D/ocrd_anybaseocr" \
org.label-schema.build-date=$BUILD_DATE

WORKDIR /build
WORKDIR /build/ocrd_anybaseocr
COPY setup.py .
COPY ocrd_anybaseocr/ocrd-tool.json .
COPY ocrd_anybaseocr ./ocrd_anybaseocr
COPY requirements.txt .
COPY README.md .
RUN pip install . \
&& rm -rf /build
&& rm -rf /build/ocrd_anybaseocr

WORKDIR /data
VOLUME ["/data"]
12 changes: 5 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ ocrd_anybaseocr/pix2pixhd:
# Download sample model TODO Add other models here
.PHONY: models
models:
ocrd resmgr download --allow-uninstalled --location cwd ocrd-anybaseocr-dewarp '*'
ocrd resmgr download --allow-uninstalled --location cwd ocrd-anybaseocr-block-segmentation '*'
ocrd resmgr download --allow-uninstalled --location cwd ocrd-anybaseocr-layout-analysis '*'
ocrd resmgr download --allow-uninstalled --location cwd ocrd-anybaseocr-tiseg '*'
ocrd resmgr download ocrd-anybaseocr-dewarp '*'
ocrd resmgr download ocrd-anybaseocr-layout-analysis '*'

.PHONY: docker
docker:
Expand Down Expand Up @@ -106,7 +104,7 @@ test: assets-clean assets
# Run CLI tests
.PHONY: cli-test
cli-test: assets-clean assets
cli-test: test-binarize test-deskew test-crop test-tiseg test-textline test-layout-analysis test-dewarp
cli-test: test-binarize test-deskew test-crop test-textline test-layout-analysis test-dewarp

# Test binarization CLI
.PHONY: test-binarize
Expand Down Expand Up @@ -135,8 +133,8 @@ test-block-segmentation: test-tiseg

# Test textline segmentation CLI
.PHONY: test-textline
test-textline: test-tiseg
ocrd-anybaseocr-textline -m $(TESTDATA)/mets.xml -I TISEG-TEST -O TL-TEST
test-textline: test-crop
ocrd-anybaseocr-textline -m $(TESTDATA)/mets.xml -I CROP-TEST -O TL-TEST

# Test page dewarping CLI
.PHONY: test-dewarp
Expand Down
2 changes: 1 addition & 1 deletion ocrd_anybaseocr/cli/ocrd_anybaseocr_dewarp.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def setup(self):
sys.exit(1)
self.opt, self.model = prepare_options(
gpu_id=self.parameter['gpu_id'],
model_path=model_path,
model_path=model_path.absolute(),
resize_or_crop=self.parameter['resize_mode'],
loadSize=self.parameter['resize_height'],
fineSize=self.parameter['resize_width'],
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keras
keras < 3.0
keras-preprocessing
numpy >= 1.15.4
ocrd >= 2.31
Expand All @@ -10,7 +10,7 @@ scikit-image >= 0.17.2
scipy >= 1.4.1
setuptools >= 41.0.0
shapely
tensorflow
tensorflow < 2.16
torch>=1.1.0
torchvision >= 0.6.1
pix2pixhd # @ ./ocrd_anybaseocr/pix2pixhd
2 changes: 1 addition & 1 deletion tests/test_dewarp.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class AnyocrDewarperTest(TestCase):

def setUp(self):
self.model_path = Path(Path.cwd(), 'latest_net_G.pth')
self.model_path = 'latest_net_G.pth'
self.resolver = Resolver()
initLogging()

Expand Down
4 changes: 0 additions & 4 deletions tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@
from .base import main, CapturingTestCase as TestCase

from ocrd_anybaseocr.cli.ocrd_anybaseocr_binarize import cli as OcrdAnybaseocrBinarizer
from ocrd_anybaseocr.cli.ocrd_anybaseocr_block_segmentation import cli as OcrdAnybaseocrBlockSegmenter
from ocrd_anybaseocr.cli.ocrd_anybaseocr_cropping import cli as OcrdAnybaseocrCropper
from ocrd_anybaseocr.cli.ocrd_anybaseocr_deskew import cli as OcrdAnybaseocrDeskewer
from ocrd_anybaseocr.cli.ocrd_anybaseocr_dewarp import cli as OcrdAnybaseocrDewarper
from ocrd_anybaseocr.cli.ocrd_anybaseocr_layout_analysis import cli as OcrdAnybaseocrLayoutAnalyser
from ocrd_anybaseocr.cli.ocrd_anybaseocr_textline import cli as OcrdAnybaseocrTextline
from ocrd_anybaseocr.cli.ocrd_anybaseocr_tiseg import cli as OcrdAnybaseocrTiseg

CLIS = [
OcrdAnybaseocrBinarizer,
OcrdAnybaseocrBlockSegmenter,
OcrdAnybaseocrCropper,
OcrdAnybaseocrDeskewer,
OcrdAnybaseocrDewarper,
OcrdAnybaseocrLayoutAnalyser,
OcrdAnybaseocrTextline,
OcrdAnybaseocrTiseg
]

class SmokeTest(TestCase):
Expand Down