Skip to content

Commit

Permalink
Merge branch 'pr/986'
Browse files Browse the repository at this point in the history
  • Loading branch information
kba committed Mar 15, 2023
2 parents 3af0bd0 + 8e9efaf commit c4f53ce
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 18 deletions.
39 changes: 27 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,25 @@ jobs:
xcode: "12.5.1"
# resource_class: macos.x86.medium.gen2
working_directory: ~/ocrd-core
environment:
PIP: pip3
PYTHON: python3
steps:
- checkout
- run: HOMEBREW_NO_AUTO_UPDATE=1 brew install imagemagick geos
- run: make deps-test install PIP=pip3
- run: make test benchmark PYTHON=python3
- run: make install
- run: make deps-test test benchmark

test-python36:
docker:
- image: python:3.6.15
working_directory: ~/ocrd-core
steps:
- checkout
- run: apt-get -y update
- run: pip install -U pip
- run: make deps-ubuntu install
- run: make deps-test test benchmark

test-python37:
docker:
Expand All @@ -23,8 +37,8 @@ jobs:
steps:
- checkout
- run: apt-get -y update
- run: make deps-ubuntu deps-test install
- run: make test benchmark
- run: make deps-ubuntu install
- run: make deps-test test benchmark

test-python38:
docker:
Expand All @@ -33,8 +47,8 @@ jobs:
steps:
- checkout
- run: apt-get -y update
- run: make deps-ubuntu deps-test install
- run: make test benchmark
- run: make deps-ubuntu install
- run: make deps-test test benchmark

test-python39:
docker:
Expand All @@ -43,8 +57,8 @@ jobs:
steps:
- checkout
- run: apt-get -y update
- run: make deps-ubuntu deps-test install
- run: make test benchmark
- run: make deps-ubuntu install
- run: make deps-test test benchmark

test-python310:
docker:
Expand All @@ -53,8 +67,8 @@ jobs:
steps:
- checkout
- run: apt-get -y update
- run: make deps-ubuntu deps-test install
- run: make test benchmark
- run: make deps-ubuntu install
- run: make deps-test test benchmark

test-python311:
docker:
Expand All @@ -63,8 +77,8 @@ jobs:
steps:
- checkout
- run: apt-get -y update
- run: make deps-ubuntu deps-test install
- run: make test benchmark
- run: make deps-ubuntu install
- run: make deps-test test benchmark

deploy:
docker:
Expand All @@ -90,6 +104,7 @@ workflows:
only: master
test-pull-request:
jobs:
- test-python36
- test-python37
- test-python38
- test-python39
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Docker Image CI

on:
push:
branches: [ "master" ]
workflow_dispatch: # run manually

jobs:

build:

runs-on: ubuntu-latest
permissions:
packages: write
contents: read

steps:
- uses: actions/checkout@v3
- # Activate cache export feature to reduce build time of images
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build the Docker image
run: make docker DOCKER_TAG=ghcr.io/ocrd/core
- name: Build the Docker image with GPU support
run: make docker-cuda DOCKER_TAG=ghcr.io/ocrd/core-cuda
#- name: Authenticate with ghcr.io
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images to Github Container Registry
run: |
docker push ghcr.io/ocrd/core:latest
docker push ghcr.io/ocrd/core-cuda:latest
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ ENV DEBIAN_FRONTEND noninteractive
ENV PYTHONIOENCODING utf8
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV PIP=pip3

WORKDIR /build-ocrd
COPY ocrd ./ocrd
Expand All @@ -31,7 +32,7 @@ RUN apt-get update && apt-get -y install software-properties-common \
sudo \
git \
&& make deps-ubuntu \
&& pip install --upgrade pip setuptools \
&& pip3 install --upgrade pip setuptools \
&& make install \
&& apt-get remove -y gcc \
&& apt-get autoremove -y \
Expand Down
12 changes: 7 additions & 5 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 ?= python
PIP ?= pip
LOG_LEVEL = INFO
PYTHONIOENCODING=utf8
TESTDIR = tests
Expand Down Expand Up @@ -55,7 +55,7 @@ DOCKER_BASE_IMAGE = ubuntu:20.04
DOCKER_ARGS =

# pip install command. Default: $(PIP_INSTALL)
PIP_INSTALL = pip install
PIP_INSTALL = $(PIP) install

# Dependencies for deployment in an ubuntu/debian linux
deps-ubuntu:
Expand All @@ -69,17 +69,19 @@ deps-test:
# (Re)install the tool
install:
$(PIP) install -U pip wheel setuptools fastentrypoints
@# speedup for end-of-life builds
if $(PYTHON) -V | fgrep -e 3.5 -e 3.6; then $(PIP) install --prefer-binary -U opencv-python-headless numpy; fi
for mod in $(BUILD_ORDER);do (cd $$mod ; $(PIP_INSTALL) .);done
@# workaround for shapely#1598
$(PIP) install --no-binary shapely --force-reinstall shapely

# Install with pip install -e
install-dev: uninstall
$(MAKE) install PIP_INSTALL="pip install -e"
$(MAKE) install PIP_INSTALL="$(PIP) install -e"

# Uninstall the tool
uninstall:
for mod in $(BUILD_ORDER);do pip uninstall -y $$mod;done
for mod in $(BUILD_ORDER);do $(PIP) uninstall -y $$mod;done

# Regenerate python code from PAGE XSD
generate-page: GDS_PAGE = ocrd_models/ocrd_models/ocrd_page_generateds.py
Expand Down

0 comments on commit c4f53ce

Please sign in to comment.