From e5ce591aea13c6a5bc9f356aaa18d0f64f4f384f Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Wed, 24 Jan 2024 16:31:41 +0100 Subject: [PATCH 1/6] move last remaining functionalit from circle to GHA --- .circleci/config.yml | 125 ----------------------------- .github/workflows/docker-image.yml | 32 ++++++-- README.md | 3 +- 3 files changed, 26 insertions(+), 134 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 8d3667af6f..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,125 +0,0 @@ -version: 2 - -orbs: - python: circleci/python@2.0.3 - -jobs: - - test-macos: - macos: - xcode: "12.5.1" - # resource_class: macos.x86.medium.gen2 - working_directory: ~/ocrd-core - environment: - PIP: pip3 - PYTHON: python3 - PIP_INSTALL: pip3 install --user - steps: - - checkout - - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install imagemagick geos bash opencv - - run: $PIP_INSTALL -U pip setuptools - - run: make install - - run: export PATH="/Users/distiller/Library/Python/3.9/bin:$PATH"; make deps-test test benchmark - - test-python37: - docker: - - image: cimg/python:3.7 - working_directory: ~/ocrd-core - steps: - - checkout - - run: sudo apt-get -y update - - run: sudo make deps-ubuntu - - run: make install deps-test - - run: make test benchmark - # smoke test to ensure that --editable install works - - run: make install-dev; ocrd --version - - test-python38: - docker: - - image: cimg/python:3.8 - working_directory: ~/ocrd-core - steps: - - checkout - - run: sudo apt-get -y update - - run: sudo make deps-ubuntu - - run: make install deps-test - - run: make test benchmark - # smoke test to ensure that --editable install works - - run: make install-dev; ocrd --version - - test-python39: - docker: - - image: cimg/python:3.9 - working_directory: ~/ocrd-core - steps: - - checkout - - run: sudo apt-get -y update - - run: sudo make deps-ubuntu - - run: make install deps-test - - run: make test benchmark - # smoke test to ensure that --editable install works - - run: make install-dev; ocrd --version - - test-python310: - docker: - - image: cimg/python:3.10 - working_directory: ~/ocrd-core - steps: - - checkout - - run: sudo apt-get -y update - - run: sudo make deps-ubuntu - - run: make install deps-test - - run: make test benchmark - # smoke test to ensure that --editable install works - - run: make install-dev; ocrd --version - - test-python311: - docker: - - image: cimg/python:3.11 - working_directory: ~/ocrd-core - steps: - - checkout - - run: sudo apt-get -y update - - run: sudo make deps-ubuntu - - run: make install deps-test - - run: make test benchmark - # smoke test to ensure that --editable install works - - run: make install-dev; ocrd --version - - deploy: - docker: - - image: circleci/buildpack-deps:stretch - steps: - - checkout - - setup_remote_docker: # https://circleci.com/docs/2.0/building-docker-images/ - docker_layer_caching: true - - run: make docker - - run: make docker-cuda - - run: - name: Login to Docker Hub - command: echo "$DOCKERHUB_PASS" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin - - run: docker push ocrd/core:latest - - run: docker push ocrd/core-cuda:latest - - run: docker tag ocrd/core ocrd/core:$(git describe --tags --abbrev=0) - - run: docker tag ocrd/core-cuda ocrd/core-cuda:$(git describe --tags --abbrev=0) - - run: docker push ocrd/core:$(git describe --tags --abbrev=0) - - run: docker push ocrd/core-cuda:$(git describe --tags --abbrev=0) - -workflows: - version: 2 - build-master: - jobs: - - deploy: - filters: - branches: - only: master - tags: - only: /^v\d\.\d\d\.\d$/ - test-pull-request: - jobs: - - test-python37 - - test-python38 - - test-python39 - - test-python310 - - test-python311 - # - test-macos diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 85a602a1b2..18b3c38ef8 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -6,7 +6,8 @@ on: workflow_dispatch: # run manually env: - DOCKER_TAG: ghcr.io/ocr-d/core + GHCRIO_DOCKER_TAG: ghcr.io/ocr-d/core + DOCKERIO__DOCKER_TAG: docker.io/ocr-d/core jobs: @@ -24,14 +25,14 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Build the Docker image # default tag uses docker.io, so override on command-line - run: make docker DOCKER_TAG=${{ env.DOCKER_TAG }} + run: make docker DOCKER_TAG=${{ env.GHCRIO_DOCKER_TAG }} - name: Build the Docker image with GPU support # default tag uses docker.io, so override on command-line - run: make docker-cuda DOCKER_TAG=${{ env.DOCKER_TAG }}-cuda DOCKER_BASE_IMAGE=${{ env.DOCKER_TAG }} + run: make docker-cuda DOCKER_TAG=${{ env.GHCRIO_DOCKER_TAG }}-cuda DOCKER_BASE_IMAGE=${{ env.GH_DOCKER_TAG }} - name: Smoke Test that ocrd --help works run: | - docker run --rm ${{ env.DOCKER_TAG }} ocrd --version - docker run --rm ${{ env.DOCKER_TAG }}-cuda ocrd --version + docker run --rm ${{ env.GHCRIO_DOCKER_TAG }} ocrd --version + docker run --rm ${{ env.GHCRIO_DOCKER_TAG }}-cuda ocrd --version - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: @@ -40,6 +41,23 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Push images to Github Container Registry run: | - docker push ${{ env.DOCKER_TAG }}:latest - docker push ${{ env.DOCKER_TAG }}-cuda:latest + docker push ${{ env.GHCRIO_DOCKER_TAG }}:latest + docker push ${{ env.GHCRIO_DOCKER_TAG }}-cuda:latest + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Push images to Docker Hub + run: | + docker tag ${{ GHCRIO_DOCKER_TAG }} ${{ DOCKERIO__DOCKER_TAG }} + docker tag ${{ GHCRIO_DOCKER_TAG }}-cuda ${{ DOCKERIO__DOCKER_TAG }}-cuda + docker push ${{ env.DOCKERIO__DOCKER_TAG }}:latest + docker push ${{ env.DOCKERIO__DOCKER_TAG }}-cuda:latest + docker push ${{ env.DOCKERIO__DOCKER_TAG }}:latest + docker push ${{ env.DOCKERIO__DOCKER_TAG }}-cuda:latest + docker tag ${{ env.DOCKERIO__DOCKER_TAG }} ${{ env.DOCKERIO__DOCKER_TAG }}:$(git describe --tags --abbrev=0) + docker tag ${{ env.DOCKERIO__DOCKER_TAG }}-cuda ${{ env.DOCKERIO__DOCKER_TAG }}-cuda:$(git describe --tags --abbrev=0) + docker push ${{ env.DOCKERIO__DOCKER_TAG }}:$(git describe --tags --abbrev=0) + docker push ${{ env.DOCKERIO__DOCKER_TAG }}-cuda:$(git describe --tags --abbrev=0) diff --git a/README.md b/README.md index f2ad546316..7999ec181a 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,10 @@ > Python modules implementing [OCR-D specs](https://github.com/OCR-D/spec) and related tools [![image](https://img.shields.io/pypi/v/ocrd.svg)](https://pypi.org/project/ocrd/) -[![image](https://circleci.com/gh/OCR-D/core.svg?style=svg)](https://circleci.com/gh/OCR-D/core) [![Docker Image CI](https://github.com/OCR-D/core/actions/workflows/docker-image.yml/badge.svg)](https://github.com/OCR-D/core/actions/workflows/docker-image.yml) [![Unit Test CI](https://github.com/OCR-D/core/actions/workflows/unit-test.yml/badge.svg)](https://github.com/OCR-D/core/actions/workflows/unit-test.yml) -[![image](https://scrutinizer-ci.com/g/OCR-D/core/badges/build.png?b=master)](https://scrutinizer-ci.com/g/OCR-D/core) [![image](https://codecov.io/gh/OCR-D/core/branch/master/graph/badge.svg)](https://codecov.io/gh/OCR-D/core) +[![image](https://scrutinizer-ci.com/g/OCR-D/core/badges/build.png?b=master)](https://scrutinizer-ci.com/g/OCR-D/core) [![image](https://scrutinizer-ci.com/g/OCR-D/core/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/OCR-D/core) [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/OCR-D/Lobby) From ccfd9992f159c9183ad8b0217e1bf0d1a5ed9a52 Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Wed, 24 Jan 2024 18:16:51 +0100 Subject: [PATCH 2/6] gha/docker-image.yml: typos --- .github/workflows/docker-image.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 18b3c38ef8..5d512194b0 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -7,7 +7,7 @@ on: env: GHCRIO_DOCKER_TAG: ghcr.io/ocr-d/core - DOCKERIO__DOCKER_TAG: docker.io/ocr-d/core + DOCKERIO_DOCKER_TAG: docker.io/ocr-d/core jobs: @@ -28,7 +28,7 @@ jobs: run: make docker DOCKER_TAG=${{ env.GHCRIO_DOCKER_TAG }} - name: Build the Docker image with GPU support # default tag uses docker.io, so override on command-line - run: make docker-cuda DOCKER_TAG=${{ env.GHCRIO_DOCKER_TAG }}-cuda DOCKER_BASE_IMAGE=${{ env.GH_DOCKER_TAG }} + run: make docker-cuda DOCKER_TAG=${{ env.GHCRIO_DOCKER_TAG }}-cuda DOCKER_BASE_IMAGE=${{ env.GHCRIO_DOCKER_TAG }} - name: Smoke Test that ocrd --help works run: | docker run --rm ${{ env.GHCRIO_DOCKER_TAG }} ocrd --version @@ -50,14 +50,14 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - name: Push images to Docker Hub run: | - docker tag ${{ GHCRIO_DOCKER_TAG }} ${{ DOCKERIO__DOCKER_TAG }} - docker tag ${{ GHCRIO_DOCKER_TAG }}-cuda ${{ DOCKERIO__DOCKER_TAG }}-cuda - docker push ${{ env.DOCKERIO__DOCKER_TAG }}:latest - docker push ${{ env.DOCKERIO__DOCKER_TAG }}-cuda:latest - docker push ${{ env.DOCKERIO__DOCKER_TAG }}:latest - docker push ${{ env.DOCKERIO__DOCKER_TAG }}-cuda:latest - docker tag ${{ env.DOCKERIO__DOCKER_TAG }} ${{ env.DOCKERIO__DOCKER_TAG }}:$(git describe --tags --abbrev=0) - docker tag ${{ env.DOCKERIO__DOCKER_TAG }}-cuda ${{ env.DOCKERIO__DOCKER_TAG }}-cuda:$(git describe --tags --abbrev=0) - docker push ${{ env.DOCKERIO__DOCKER_TAG }}:$(git describe --tags --abbrev=0) - docker push ${{ env.DOCKERIO__DOCKER_TAG }}-cuda:$(git describe --tags --abbrev=0) + docker tag ${{ env.GHCRIO_DOCKER_TAG }} ${{ env.DOCKERIO_DOCKER_TAG }} + docker tag ${{ env.GHCRIO_DOCKER_TAG }}-cuda ${{ env.DOCKERIO_DOCKER_TAG }}-cuda + docker push ${{ env.DOCKERIO_DOCKER_TAG }}:latest + docker push ${{ env.DOCKERIO_DOCKER_TAG }}-cuda:latest + docker push ${{ env.DOCKERIO_DOCKER_TAG }}:latest + docker push ${{ env.DOCKERIO_DOCKER_TAG }}-cuda:latest + docker tag ${{ env.DOCKERIO_DOCKER_TAG }} ${{ env.DOCKERIO_DOCKER_TAG }}:$(git describe --tags --abbrev=0) + docker tag ${{ env.DOCKERIO_DOCKER_TAG }}-cuda ${{ env.DOCKERIO_DOCKER_TAG }}-cuda:$(git describe --tags --abbrev=0) + docker push ${{ env.DOCKERIO_DOCKER_TAG }}:$(git describe --tags --abbrev=0) + docker push ${{ env.DOCKERIO_DOCKER_TAG }}-cuda:$(git describe --tags --abbrev=0) From bd5ab5a1fb381585b949b0c7e663352f184c250a Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Tue, 30 Jan 2024 17:56:06 +0100 Subject: [PATCH 3/6] ci/docker: rename DOCKER_ -> DOCKERIO_ for consistency --- .github/workflows/docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 5d512194b0..06b7202248 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -46,8 +46,8 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + username: ${{ env.DOCKERIO_USERNAME }} + password: ${{ secrets.DOCKERIO_PASSWORD }} - name: Push images to Docker Hub run: | docker tag ${{ env.GHCRIO_DOCKER_TAG }} ${{ env.DOCKERIO_DOCKER_TAG }} From 11ecbf9a2ccbd4a6cdbc98da3ed4116bb38ab904 Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Tue, 30 Jan 2024 18:39:45 +0100 Subject: [PATCH 4/6] ci/docker: cluster login to ghcr.io and docker.io --- .github/workflows/docker-image.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 06b7202248..f9067965d6 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -39,15 +39,15 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Push images to Github Container Registry - run: | - docker push ${{ env.GHCRIO_DOCKER_TAG }}:latest - docker push ${{ env.GHCRIO_DOCKER_TAG }}-cuda:latest - name: Log in to Docker Hub uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a with: username: ${{ env.DOCKERIO_USERNAME }} password: ${{ secrets.DOCKERIO_PASSWORD }} + - name: Push images to Github Container Registry + run: | + docker push ${{ env.GHCRIO_DOCKER_TAG }}:latest + docker push ${{ env.GHCRIO_DOCKER_TAG }}-cuda:latest - name: Push images to Docker Hub run: | docker tag ${{ env.GHCRIO_DOCKER_TAG }} ${{ env.DOCKERIO_DOCKER_TAG }} From 64debc883c3fa925dee78ea85a2f3280d8968f93 Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Tue, 30 Jan 2024 18:44:07 +0100 Subject: [PATCH 5/6] ci/docker: typo, images on dockerhub in "ocrd" not "ocr-d" --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index f9067965d6..bf8c7b4886 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -7,7 +7,7 @@ on: env: GHCRIO_DOCKER_TAG: ghcr.io/ocr-d/core - DOCKERIO_DOCKER_TAG: docker.io/ocr-d/core + DOCKERIO_DOCKER_TAG: docker.io/ocrd/core jobs: From b21af1b766fafea3abda4ba93bde0746d8b93833 Mon Sep 17 00:00:00 2001 From: Konstantin Baierer Date: Tue, 30 Jan 2024 18:57:25 +0100 Subject: [PATCH 6/6] ci/docker: use secrets for both username and password --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index bf8c7b4886..a02b8c9bed 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -42,7 +42,7 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a with: - username: ${{ env.DOCKERIO_USERNAME }} + username: ${{ secrets.DOCKERIO_USERNAME }} password: ${{ secrets.DOCKERIO_PASSWORD }} - name: Push images to Github Container Registry run: |