gen_whl_to_pypi_rapidocr.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. name: Push rapidocr to pypi
  2. on:
  3. push:
  4. tags:
  5. - v*
  6. env:
  7. RESOURCES_URL: https://github.com/RapidAI/RapidOCR/releases/download/v1.1.0/required_for_whl_v3.0.0.zip
  8. jobs:
  9. UnitTesting:
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Pull latest code
  13. uses: actions/checkout@v4
  14. - name: Set up Python 3.10
  15. uses: actions/setup-python@v4
  16. with:
  17. python-version: '3.10'
  18. architecture: 'x64'
  19. - name: Display Python version
  20. run: python -c "import sys; print(sys.version)"
  21. - name: Unit testings
  22. run: |
  23. cd python
  24. pip install -r requirements.txt
  25. pip install pytest wheel get_pypi_latest_version openvino==2023.3.0 onnxruntime python-bidi MNN
  26. pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
  27. python -m pip install paddlepaddle==3.1.1 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/
  28. pytest tests/test_*.py
  29. GenerateWHL_PushPyPi:
  30. needs: UnitTesting
  31. runs-on: ubuntu-latest
  32. steps:
  33. - uses: actions/checkout@v4
  34. - name: Set up Python 3.10
  35. uses: actions/setup-python@v4
  36. with:
  37. python-version: '3.10'
  38. architecture: 'x64'
  39. - name: Download models
  40. run: |
  41. cd python
  42. wget $RESOURCES_URL
  43. ZIP_NAME=${RESOURCES_URL##*/}
  44. DIR_NAME=${ZIP_NAME%.*}
  45. unzip $ZIP_NAME
  46. cp $DIR_NAME/resources/models/*.* rapidocr/models
  47. - name: Run setup.py
  48. run: |
  49. cd python
  50. pip install setuptools get_pypi_latest_version wheel
  51. mkdir rapidocr_t
  52. mv rapidocr rapidocr_t
  53. mv rapidocr_t rapidocr
  54. cd rapidocr
  55. echo "from .rapidocr.main import RapidOCR, VisRes" > __init__.py
  56. cd ..
  57. python -m pip install --upgrade pip
  58. python setup.py bdist_wheel ${{ github.ref_name }}
  59. mv dist ../
  60. - name: Publish distribution 📦 to PyPI
  61. uses: pypa/gh-action-pypi-publish@v1.5.0
  62. with:
  63. password: ${{ secrets.RAPIDOCR }}
  64. packages_dir: dist/