|
| 1 | +name: Push rapidocr_table to pypi |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + paths: |
| 7 | + - 'rapid_table/**' |
| 8 | + - 'docs/doc_whl_rapid_table.md' |
| 9 | + - 'setup_table.py' |
| 10 | + - '.github/workflows/gen_whl_to_pypi_rapid_table.yml' |
| 11 | + - 'tests/test_table.py' |
| 12 | + |
| 13 | +env: |
| 14 | + RESOURCES_URL: https://github.com/RapidAI/RapidOCR/releases/download/v1.1.0/rapid_table_models.zip |
| 15 | + |
| 16 | +jobs: |
| 17 | + UnitTesting: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Pull latest code |
| 21 | + uses: actions/checkout@v3 |
| 22 | + |
| 23 | + - name: Set up Python 3.7 |
| 24 | + uses: actions/setup-python@v4 |
| 25 | + with: |
| 26 | + python-version: '3.7' |
| 27 | + architecture: 'x64' |
| 28 | + |
| 29 | + - name: Display Python version |
| 30 | + run: python -c "import sys; print(sys.version)" |
| 31 | + |
| 32 | + - name: Unit testings |
| 33 | + run: | |
| 34 | + wget $RESOURCES_URL |
| 35 | + ZIP_NAME=${RESOURCES_URL##*/} |
| 36 | + DIR_NAME=${ZIP_NAME%.*} |
| 37 | + unzip $DIR_NAME |
| 38 | + cp $DIR_NAME/*.onnx rapid_table/models/ |
| 39 | + cd python/rapid_structure |
| 40 | + pip install -r requirements.txt |
| 41 | + pip install rapidocr_onnxruntime |
| 42 | + pytest tests/test_table.py |
| 43 | +
|
| 44 | + GenerateWHL_PushPyPi: |
| 45 | + needs: UnitTesting |
| 46 | + runs-on: ubuntu-latest |
| 47 | + |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v3 |
| 50 | + |
| 51 | + - name: Set up Python 3.7 |
| 52 | + uses: actions/setup-python@v4 |
| 53 | + with: |
| 54 | + python-version: '3.7' |
| 55 | + architecture: 'x64' |
| 56 | + |
| 57 | + - name: Run setup |
| 58 | + run: | |
| 59 | + cd python/rapid_structure |
| 60 | + pip install -r requirements.txt |
| 61 | + wget $RESOURCES_URL |
| 62 | + ZIP_NAME=${RESOURCES_URL##*/} |
| 63 | + DIR_NAME=${ZIP_NAME%.*} |
| 64 | + unzip $ZIP_NAME |
| 65 | + mv $DIR_NAME/en_ppstructure_mobile_v2_SLANet.onnx rapid_table/models/ |
| 66 | + python setup_table.py bdist_wheel ${{ github.event.head_commit.message }} |
| 67 | +
|
| 68 | + # - name: Publish distribution 📦 to Test PyPI |
| 69 | + # uses: pypa/gh-action-pypi-publish@v1.5.0 |
| 70 | + # with: |
| 71 | + # password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 72 | + # repository_url: https://test.pypi.org/legacy/ |
| 73 | + # packages_dir: dist/ |
| 74 | + |
| 75 | + - name: Publish distribution 📦 to PyPI |
| 76 | + uses: pypa/gh-action-pypi-publish@v1.5.0 |
| 77 | + with: |
| 78 | + password: ${{ secrets.RAPID_STRUCTURE }} |
| 79 | + packages_dir: dist/ |
0 commit comments