From a24670edcc05527c95c49fa946e2e4b09993f9dd Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Fri, 16 Oct 2020 13:31:28 +0200 Subject: [PATCH] minimal CI setup --- .circleci/config.yml | 47 ++++++++++++++++++++++++++++++++++++++++++++ Makefile | 34 +++++++++++++++++++++++++++++++- setup.py | 1 + 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..ca93957 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,47 @@ +version: 2 + +jobs: + + build-python36: + docker: + - image: python:3.6 + steps: + - checkout + - restore_cache: + keys: + - model-cache + - run: make model + - save_cache: + key: model-cache + paths: + models.tar.gz + models + - run: make install + - run: git submodule update --init + - run: make test + + build-python37: + docker: + - image: python:3.7 + steps: + - checkout + - restore_cache: + keys: + - model-cache + - run: make model + - save_cache: + key: model-cache + paths: + models.tar.gz + models + - run: make install + - run: git submodule update --init + - run: make test + +workflows: + version: 2 + build: + jobs: + - build-python36 + - build-python37 + #- build-python38 # no tensorflow for python 3.8 diff --git a/Makefile b/Makefile index f92ba15..95ddbfe 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,36 @@ -all: install +# Directory to store models +MODEL_DIR = $(PWD)/models +# BEGIN-EVAL makefile-parser --make-help Makefile + +help: + @echo "" + @echo " Targets" + @echo "" + @echo " install Install with pip" + @echo " model Downloads the pre-trained models from qurator-data.de" + @echo " test Run tests" + @echo "" + @echo " Variables" + @echo "" + @echo " MODEL_DIR Directory to store models" + +# END-EVAL + +# Install with pip install: pip install . + +# Downloads the pre-trained models from qurator-data.de +model: $(MODEL_DIR)/model1_bin.h5 + +$(MODEL_DIR)/model1_bin.h5: models.tar.gz + tar xf models.tar.gz + +models.tar.gz: + wget 'https://qurator-data.de/sbb_binarization/models.tar.gz' + +# Run tests +test: model + cd repo/assets/data/kant_aufklaerung_1784/data; ocrd-sbb-binarize -I OCR-D-IMG -O BIN -P model $(MODEL_DIR) + cd repo/assets/data/kant_aufklaerung_1784-page-region/data; ocrd-sbb-binarize -I OCR-D-IMG -O BIN -P model $(MODEL_DIR) -P level-of-operation region diff --git a/setup.py b/setup.py index 2ad6418..7ab6e02 100644 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ setup( license='Apache License 2.0', packages=find_packages(exclude=('tests', 'docs')), include_package_data=True, + package_data={'': ['*.json', '*.yml', '*.yaml']}, install_requires=install_requires, entry_points={ 'console_scripts': [