diff --git a/.github/workflows/pip4linux.yml b/.github/workflows/pip4linux.yml index 95f21d78..ee063b01 100644 --- a/.github/workflows/pip4linux.yml +++ b/.github/workflows/pip4linux.yml @@ -12,38 +12,33 @@ on: jobs: build: - strategy: - fail-fast: false - matrix: - platform: [ubuntu-latest] - python-version: ["3.9", - "3.10", - "3.11", - "3.12", - "3.13", - "3.14"] - - runs-on: ${{ matrix.platform }} + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: "3.12" - - name: Update requirements + - name: Install build tools run: | python -m pip install --upgrade pip - pip install pybind11 setuptools wheel twine auditwheel + python -m pip install cibuildwheel twine - - name: Build and install for linux + - name: Build linux wheels + env: + CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*" + CIBW_SKIP: "*-musllinux_*" + CIBW_ARCHS_LINUX: "x86_64" + run: | + python -m cibuildwheel --output-dir wheelhouse python + + - name: Check wheels run: | - cd python - python setup.py bdist_wheel --plat-name manylinux2014_x86_64 - auditwheel repair dist/*.whl --wheel-dir auditwheel_dist + twine check wheelhouse/* - name: Upload to pypi when release if: github.event_name == 'release' && github.event.action == 'published' @@ -51,6 +46,4 @@ jobs: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_PYCGRAPH_TOKEN }} run: | - cd python - twine check dist/* - twine upload --verbose --skip-existing dist/* + twine upload --verbose --skip-existing wheelhouse/* diff --git a/python/setup.py b/python/setup.py index 4948b119..f3cef460 100644 --- a/python/setup.py +++ b/python/setup.py @@ -6,6 +6,7 @@ @Desc: """ +import sys import glob from setuptools import setup, Extension import pybind11 @@ -33,10 +34,12 @@ "-fvisibility=hidden"] _include_dirs = [pybind11.get_include(), "../src"] +_extra_link_args = ["-pthread"] if sys.platform != "win32" else [] _ext_modules = [ Extension( name=__PYCGRAPH_NAME__, sources=_sources, + extra_link_args=_extra_link_args, extra_compile_args=_extra_compile_args, include_dirs=_include_dirs, ),