-
-
Notifications
You must be signed in to change notification settings - Fork 366
99 lines (85 loc) · 2.87 KB
/
gen_whl_to_pypi_rapidocr_paddle.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Push rapidocr_paddle to pypi
on:
push:
branches: [ main ]
paths:
- 'python/rapidocr_paddle/**'
- 'docs/doc_whl_rapidocr_paddle.md'
- 'python/setup_paddle.py'
- '.github/workflows/gen_whl_to_pypi_rapidocr_paddle.yml'
# tags:
# - v*
env:
RESOURCES_URL: https://github.com/RapidAI/RapidOCR/releases/download/v1.1.0/paddle_models_v4.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/models/* python/rapidocr_paddle/models/
cd python
pip install -r requirements_paddle.txt
pip install pytest wheel get_pypi_latest_version paddlepaddle
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_paddle.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/models/* rapidocr_paddle/models
- name: Run setup_paddle.py
run: |
cd python
pip install setuptools get_pypi_latest_version wheel
mkdir rapidocr_paddle_t
mv rapidocr_paddle rapidocr_paddle_t
mv rapidocr_paddle_t rapidocr_paddle
cd rapidocr_paddle
echo "from .rapidocr_paddle.main import RapidOCR, VisRes" > __init__.py
cd ..
python -m pip install --upgrade pip
python setup_paddle.py bdist_wheel ${{ github.event.head_commit.message }}
mv dist ../
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@v1.5.0
with:
password: ${{ secrets.RAPIDOCR_OPENVINO }}
packages_dir: dist/