Skip to content

Add to support visisual result under CLI #54

Add to support visisual result under CLI

Add to support visisual result under CLI #54

name: Push rapidocr_onnxruntime to pypi
on:
push:
# branches: [ main ]
# paths:
# - 'python/rapidocr_onnxruntime/**'
# - 'docs/doc_whl_rapidocr_ort.md'
# - 'python/setup_onnxruntime.py'
# - '.github/workflows/gen_whl_to_pypi_rapidocr_ort.yml'
tags:
- v*
env:
RESOURCES_URL: https://github.com/RapidAI/RapidOCR/releases/download/v1.1.0/required_for_whl_v1.3.0.zip
TWO_DIM_IMAGE: https://github.com/RapidAI/RapidOCR/releases/download/v1.1.0/two_dim_image.npy
jobs:
UnitTesting:
runs-on: ubuntu-latest
steps:
- name: Pull latest code
uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: '3.7'
architecture: 'x64'
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Unit testings
run: |
wget $RESOURCES_URL
ZIP_NAME=${RESOURCES_URL##*/}
DIR_NAME=${ZIP_NAME%.*}
unzip $DIR_NAME
cp $DIR_NAME/resources/models/*.onnx python/rapidocr_onnxruntime/models/
cp $DIR_NAME/resources/models/*.onnx python/rapidocr_openvino/models/
cd python
pip install -r requirements_ort.txt
pip install pytest wheel get_pypi_latest_version openvino
cd tests
wget $TWO_DIM_IMAGE -O two_dim_image.npy
mv two_dim_image.npy test_files/
pytest test_det.py test_cls.py test_rec.py test_all_ort.py
GenerateWHL_PushPyPi:
needs: UnitTesting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: '3.7'
architecture: 'x64'
- name: Set SSH Environment
env:
DEPLOY_KEYS: ${{ secrets.GEN_PYTHON_SDK }}
run: |
mkdir -p ~/.ssh/
echo "$DEPLOY_KEYS" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
- name: Download models
run: |
cd python
wget $RESOURCES_URL
ZIP_NAME=${RESOURCES_URL##*/}
DIR_NAME=${ZIP_NAME%.*}
unzip $ZIP_NAME
cp $DIR_NAME/resources/models/*.onnx rapidocr_onnxruntime/models
- name: Run setup_onnxruntime.py
run: |
cd python
pip install setuptools get_pypi_latest_version wheel
mkdir rapidocr_onnxruntime_t
mv rapidocr_onnxruntime rapidocr_onnxruntime_t
mv rapidocr_onnxruntime_t rapidocr_onnxruntime
cd rapidocr_onnxruntime
echo "from .rapidocr_onnxruntime.main import RapidOCR, VisRes" > __init__.py
cd ..
python -m pip install --upgrade pip
python setup_onnxruntime.py bdist_wheel ${{ github.event.head_commit.message }}
mv dist ../
- name: Publish distribution 📦 to PyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist/