@@ -3,61 +3,54 @@ name: Build and upload to PyPI
33on : [push, pull_request]
44
55jobs :
6- build_wheels :
7- name : Build wheels on ${{ matrix.os }}
8- runs-on : ${{ matrix.os }}
9- strategy :
10- matrix :
11- os : [windows-latest, ubuntu-latest]
12- python-version : ['3.10']
13-
6+ build :
7+ name : Build sdist + wheel (pure Python)
8+ runs-on : ubuntu-latest
149 steps :
15- - uses : actions/checkout@v3
10+ - uses : actions/checkout@v4
1611
17- - name : Set up Python
18- uses : actions/setup-python@v4
12+ - name : Set up Python 3.x
13+ uses : actions/setup-python@v5
1914 with :
20- python-version : ${{ matrix.python-version }}
21-
22- - name : Run test.py in develop mode
15+ python-version : ' 3.12'
16+ cache : pip
17+
18+ - name : Run test.py
2319 run : |
24- python -m pip install opencv-python setuptools
25- python setup_setuptools.py develop
26- python --version
20+ python -m pip install opencv-python dynamsoft-capture-vision-bundle
2721 python test.py
2822
29- - name : Set up QEMU
30- if : runner.os == 'Linux'
31- uses : docker/setup-qemu-action@v2
32- with :
33- platforms : all
23+ - name : Install build tooling
24+ run : |
25+ python -m pip install -U pip build twine
3426
35- - name : Build wheels
36- uses : pypa/cibuildwheel@v2.6.1
37- env :
38- CIBW_BUILD : " cp39-*"
39- CIBW_ARCHS_LINUX : auto, aarch64
40-
41- - uses : actions/upload-artifact@v4
42- with :
43- name : wheel-${{ matrix.os }}-${{ matrix.python-version }}
44- path : ./wheelhouse/*.whl
45-
46- build_sdist :
47- name : Build source distribution
48- runs-on : ubuntu-latest
49- steps :
50- - uses : actions/checkout@v2
27+ - name : Build distributions
28+ run : |
29+ python -m build # creates dist/*.whl and dist/*.tar.gz
5130
52- - name : Build sdist
53- run : pipx run build --sdist
31+ - name : Check metadata
32+ run : |
33+ python -m twine check dist/*
34+
35+ - name : Ensure universal wheel for pure Python
36+ shell : bash
37+ run : |
38+ set -e
39+ WHEEL="$(ls dist/*.whl | head -n1)"
40+ echo "Built wheel: $WHEEL"
41+ # Expect *-py3-none-any.whl for pure-Python universal wheels
42+ if [[ "$WHEEL" != *"-py3-none-any.whl" ]]; then
43+ echo "::warning::Wheel is not tagged 'py3-none-any'. Verify package is pure Python or build config."
44+ fi
5445
55- - uses : actions/upload-artifact@v4
46+ - name : Upload build artifacts
47+ uses : actions/upload-artifact@v4
5648 with :
57- path : dist/*.tar.gz
49+ name : dist
50+ path : dist/*
5851
5952 upload_pypi :
60- needs : [build_wheels, build_sdist]
53+ needs : build
6154 runs-on : ubuntu-latest
6255 # upload to PyPI on every tag starting with 'v'
6356 if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
6659 steps :
6760 - uses : actions/download-artifact@v4
6861 with :
69- name : artifact
62+ name : dist
7063 path : dist
7164
7265 - uses : pypa/gh-action-pypi-publish@v1.4.2
0 commit comments