Skip to content

Commit

Permalink
Merge pull request #45 from OCR-D/ci-cli
Browse files Browse the repository at this point in the history
CI: test-cli, drop sudo, default to python3/pip3
  • Loading branch information
kba authored Jun 25, 2019
2 parents dbf5dbb + 0da09dd commit 7b67a44
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ jobs:
docker:
- image: ubuntu:18.04
steps:
- run: apt-get update ; apt-get install -y make git
- checkout
- run: apt-get update ; apt-get install -y sudo make python3 python3-pip git
- run: make deps-ubuntu deps-test deps install repo/assets PIP=pip3
- run: make test PYTHON=python3

- run: make deps-ubuntu deps-test deps install repo/assets
- run: make test
- run: make test-cli
workflows:
version: 2
build:
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ COPY LICENSE .
RUN apt-get update && \
apt-get -y install --no-install-recommends \
ca-certificates \
sudo \
make \
git
COPY Makefile .
Expand Down
27 changes: 19 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export

SHELL = /bin/bash
PYTHON = python
PIP = pip
PYTHON = python3
PIP = pip3
LOG_LEVEL = INFO
PYTHONIOENCODING=utf8

Expand All @@ -19,11 +19,20 @@ help:
@echo " Targets"
@echo ""
@echo " deps-ubuntu Dependencies for deployment in an ubuntu/debian linux"
@echo " (lib*-dev merely for building tesserocr with pip)"
@echo " (tesseract-ocr: Ubuntu 18.04 now ships 4.0.0,"
@echo " but some beta, not the final release,"
@echo " on which tesserocr 2.4.0 depends;"
@echo " this downloads a tesseract build from git"
@echo " and installs it system-wide -"
@echo " intended for dockerfile and travis,"
@echo " not recommended for live systems!)"
@echo " deps Install python deps via pip"
@echo " deps-test Install testing python deps via pip"
@echo " install Install"
@echo " docker Build docker image"
@echo " test Run test"
@echo " test-cli Test the command line tools"
@echo " repo/assets Clone OCR-D/assets to ./repo/assets"
@echo " test/assets Setup test assets"
@echo " assets-clean Remove symlinks in test/assets"
Expand All @@ -45,16 +54,17 @@ help:
# intended for dockerfile and travis,
# not recommended for live systems!)
deps-ubuntu:
sudo apt-get install -y \
libxml2-utils \
libimage-exiftool-perl \
apt-get install -y \
git \
python3 \
python3-pip \
libtesseract-dev \
libleptonica-dev \
tesseract-ocr-eng \
tesseract-ocr \
wget
wget -O - https://github.com/nijel/tesseract-ocr-build/releases/download/4.0.0-1/tesseract.tar.xz | tar -xJf -
sudo cp -rt /usr .tesseract/*
cp -rt /usr .tesseract/*

# Install python deps via pip
deps:
Expand All @@ -77,11 +87,12 @@ test: test/assets
# declare -p HTTP_PROXY
$(PYTHON) -m pytest test $(PYTEST_ARGS)

# Test the command line tools
test-cli: test/assets
pip install -e .
$(PIP) install -e .
rm -rfv test-workspace
cp -rv test/assets/kant_aufklaerung_1784 test-workspace
cd test-workspace/data && \
export LC_ALL=C.UTF-8; cd test-workspace/data && \
ocrd-tesserocr-segment-region -l DEBUG -m mets.xml -I OCR-D-IMG -O OCR-D-SEG-BLOCK ; \
ocrd-tesserocr-segment-line -l DEBUG -m mets.xml -I OCR-D-SEG-BLOCK -O OCR-D-SEG-LINE ; \
ocrd-tesserocr-recognize -l DEBUG -m mets.xml -I OCR-D-SEG-LINE -O OCR-D-TESS-OCR
Expand Down

0 comments on commit 7b67a44

Please sign in to comment.