Update #14
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
name: Build and upload to PyPI | |
on: [push, pull_request] | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Run test in develop mode | |
run: | | |
python -m pip install opencv-python pytest | |
python setup.py develop | |
python --version | |
pytest | |
- name: Build wheels for Linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
pip install -U wheel setuptools auditwheel patchelf | |
pip wheel . --verbose -w dist | |
auditwheel repair dist/document_scanner_sdk*.whl --plat manylinux_2_24_$(uname -m) | |
- name: Build wheels for Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
pip install -U wheel setuptools | |
python setup.py bdist_wheel -d wheelhouse | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build sdist | |
run: python setup.py sdist -d dist | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: dist/*.tar.gz | |
upload_pypi: | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
# upload to PyPI on every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
# alternatively, to publish when a GitHub Release is created, use the following rule: | |
# if: github.event_name == 'release' && github.event.action == 'published' | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.4.2 | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
skip_existing: true |