Add strip_undecomposable_errors=False to decomposition (#218)
#191
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2025 Google LLC | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # https://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| name: Pre-release Tesseract | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| jobs: | |
| create_version: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4 | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Create version | |
| run: | | |
| mkdir version | |
| echo "$(python _version.py).dev$(date '+%Y%m%d%H%M%S')" > version/version.txt | |
| cat version/version.txt | |
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: version-file | |
| path: version | |
| build_wheels: | |
| runs-on: ${{ matrix.os }} | |
| needs: [create_version] | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ubuntu-22.04, ubuntu-24.04, macos-14] | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: version-file | |
| path: version | |
| - name: Set up Bazel | |
| uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0 | |
| with: | |
| bazelisk-cache: true | |
| disk-cache: ${{ github.workflow }} | |
| repository-cache: true | |
| - name: Set Python Version | |
| env: | |
| TARGET_PYTHON: ${{ matrix.python-version }} | |
| run: | | |
| echo "set version to ${TARGET_PYTHON}" | |
| python _update_bazel_py_version.py $TARGET_PYTHON | |
| - name: Build package | |
| env: | |
| TARGET_PYTHON: ${{ matrix.python-version }} | |
| run: | | |
| glibc_version=$(ldd --version | awk '/ldd/{print $NF}') | |
| export GLIBC_VERSION="${glibc_version//./_}" | |
| echo $GLIBC_VERSION | |
| sed "s/^MANYLINUX_VERSION.*/MANYLINUX_VERSION=\"manylinux_${GLIBC_VERSION}_x86_64.manylinux2014_x86_64\"/" BUILD -i || true | |
| bazel build --define GLIBC_VERSION=$GLIBC_VERSION --define TARGET_VERSION="$(python -c "print(\"py${TARGET_PYTHON}\".replace(\".\", \"\"))")" --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel | |
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: python-wheels-${{ matrix.os }}-${{ matrix.python-version }} | |
| path: ./bazel-bin/*.whl | |
| build_wheels_for_legacy_systems: | |
| runs-on: ${{ matrix.os }} | |
| needs: [create_version] | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| os: [ubuntu-22.04] | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| name: version-file | |
| path: version | |
| - name: Set Python Version | |
| env: | |
| TARGET_PYTHON: ${{ matrix.python-version }} | |
| run: | | |
| echo "set version to ${TARGET_PYTHON}" | |
| python _update_bazel_py_version.py $TARGET_PYTHON | |
| - name: build custom C++ toolchain | |
| env: | |
| TARGET_PYTHON: ${{ matrix.python-version }} | |
| run: | | |
| . devtools/build_with_custom_toolchain.sh | |
| - name: Set up Bazel | |
| uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0 | |
| with: | |
| bazelisk-cache: true | |
| disk-cache: ${{ github.workflow }} | |
| repository-cache: true | |
| - name: Build package | |
| env: | |
| TARGET_PYTHON: ${{ matrix.python-version }} | |
| run: | | |
| export GLIBC_VERSION=2_28 | |
| echo $GLIBC_VERSION | |
| sed "s/^MANYLINUX_VERSION.*/MANYLINUX_VERSION=\"manylinux_${GLIBC_VERSION}_x86_64.manylinux2014_x86_64\"/" BUILD -i || true | |
| bazel build --define GLIBC_VERSION=$GLIBC_VERSION --define TARGET_VERSION="$(python -c "print(\"py${TARGET_PYTHON}\".replace(\".\", \"\"))")" --define VERSION="$(cat version/version.txt)" :tesseract_decoder_wheel | |
| - name: Test | |
| run: | | |
| pip install pytest sinter auditwheel | |
| auditwheel show $(ls bazel-bin/*.whl) | |
| pip install bazel-bin/*.whl | |
| mv src/py/ src/_lib # rename because `py` causes pytest issues. | |
| rm src/_lib/stub_test.py # ignore this test because it uses os flags that are set by bazel | |
| rm src/_lib/tesseract_sinter_compat_test.py # ignore this test because it mixes np.int64 and int which doesn't work with older python versions | |
| PYTHONPATH=src/_lib/::$PYTHONPATH pytest src/_lib/ | |
| - uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: python-wheels-${{ matrix.os }}-${{ matrix.python-version }}-legacy | |
| path: ./bazel-bin/*.whl | |
| release-wheels: | |
| name: Publish all wheels | |
| needs: [build_wheels,build_wheels_for_legacy_systems] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 | |
| with: | |
| pattern: python-wheels-* | |
| merge-multiple: true | |
| path: wheelhouse/ | |
| - name: Publish package to testpypi | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e | |
| with: | |
| repository_url: https://test.pypi.org/legacy/ | |
| user: __token__ | |
| password: ${{ secrets.TEST_PYPI_TOKEN }} | |
| packages_dir: wheelhouse/ | |
| verbose: true | |
| - name: Publish package to pypi | |
| uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_TOKEN }} | |
| packages_dir: wheelhouse/ |