diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..237c8da --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,57 @@ +name: pypi +#on: [push, pull_request] +on: + push: + tags: + - '*' + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v4 + + - name: setup-qemu + if: matrix.os == 'ubuntu-latest' + uses: docker/setup-qemu-action@v3 + with: + platforms: all + + - name: cibuildwheel + uses: pypa/cibuildwheel@v2.16.5 + env: + CIBW_ARCHS_LINUX: "x86_64 i686 aarch64 ppc64le s390x" + CIBW_ARCHS_MACOS: "x86_64 arm64 universal2" + CIBW_ARCHS_WINDOWS: "AMD64 x86 ARM64" + CIBW_BUILD: "cp311*" + CIBW_BUILD_VERBOSITY: 1 + with: + output-dir: wheelhouse + + - uses: actions/upload-artifact@v4 + with: + name: wheels-${{ matrix.os }} + path: ./wheelhouse/*.whl + + upload_all: + permissions: + contents: none + name: Upload + needs: [build_wheels] + runs-on: ubuntu-latest + + steps: + - uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 482069a..f279380 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools", "cython"] +requires = ["setuptools", "cython", "wheel"] build-backend = "setuptools.build_meta" [project] diff --git a/setup.py b/setup.py index fb88143..1baaca1 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,17 @@ # -*- coding: utf-8 -*- from setuptools import setup, find_packages, Extension +from wheel.bdist_wheel import bdist_wheel + +class bdist_wheel_abi3(bdist_wheel): + def get_tag(self): + python, abi, plat = super().get_tag() + + if python.startswith("cp"): + # on CPython, our wheels are abi3 and compatible back to 3.6 + return "cp36", "abi3", plat + + return python, abi, plat ext = Extension( name = 'ruapu', @@ -10,9 +21,11 @@ ext = Extension( ) setup_args = dict( + name = 'ruapu', packages = find_packages(where="."), package_dir = {"": "."}, ext_modules = [ext], + cmdclass = {"bdist_wheel": bdist_wheel_abi3}, ) setup(**setup_args)