From 9944d1d95af7553be109180431eb4eebc0b591bc Mon Sep 17 00:00:00 2001 From: massquantity Date: Wed, 16 Jul 2025 20:28:54 +0800 Subject: [PATCH] [Build] Upgrade building wheels --- .github/workflows/wheels.yml | 101 ++++++++++++++++++++++++++--------- 1 file changed, 76 insertions(+), 25 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 3f41a7f9..622f3d72 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -51,83 +51,124 @@ jobs: platform_id: win_amd64 # Linux 64 bit manylinux2014 - - os: ubuntu-20.04 + - os: ubuntu-22.04 python: 36 bitness: 64 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 - - os: ubuntu-20.04 + - os: ubuntu-22.04 python: 37 bitness: 64 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 - - os: ubuntu-20.04 + - os: ubuntu-22.04 python: 38 bitness: 64 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 - - os: ubuntu-20.04 + - os: ubuntu-22.04 python: 39 bitness: 64 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 - - os: ubuntu-20.04 + - os: ubuntu-22.04 python: 310 bitness: 64 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 - - os: ubuntu-20.04 + - os: ubuntu-22.04 python: 311 bitness: 64 platform_id: manylinux_x86_64 manylinux_image: manylinux2014 - # MacOS x86_64 - - os: macos-12 + # MacOS x86_64 (Cross-compiled on Apple Silicon) + - os: macos-latest bitness: 64 python: 36 platform_id: macosx_x86_64 - - os: macos-12 + arch: x86_64 + - os: macos-latest bitness: 64 python: 37 platform_id: macosx_x86_64 - - os: macos-12 + arch: x86_64 + - os: macos-latest bitness: 64 python: 38 platform_id: macosx_x86_64 - - os: macos-12 + arch: x86_64 + - os: macos-latest bitness: 64 python: 39 platform_id: macosx_x86_64 - - os: macos-12 + arch: x86_64 + - os: macos-latest bitness: 64 python: 310 platform_id: macosx_x86_64 - - os: macos-12 + arch: x86_64 + - os: macos-latest bitness: 64 python: 311 platform_id: macosx_x86_64 + arch: x86_64 + + # MacOS ARM64 (Native on Apple Silicon) + - os: macos-latest + bitness: 64 + python: 38 + platform_id: macosx_arm64 + arch: arm64 + - os: macos-latest + bitness: 64 + python: 39 + platform_id: macosx_arm64 + arch: arm64 + - os: macos-latest + bitness: 64 + python: 310 + platform_id: macosx_arm64 + arch: arm64 + - os: macos-latest + bitness: 64 + python: 311 + platform_id: macosx_arm64 + arch: arm64 steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup Python + - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.8' - cache: 'pip' + python-version: '3.12' - - name: Install dependencies + - name: Install dependencies (Python 3.6-3.7) + if: matrix.python == '36' || matrix.python == '37' run: | python -m pip install --upgrade pip python -m pip install cibuildwheel==2.16.2 + - name: Install dependencies (Python 3.8+) + if: matrix.python != '36' && matrix.python != '37' + run: | + python -m pip install --upgrade pip + python -m pip install cibuildwheel>=2.20.0 + - name: Build wheels env: CIBW_BEFORE_BUILD: python -m pip install numpy>=1.19.5 cython>=0.29.0 scipy>=1.7.0 CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} + # Enable cross-compilation for macOS (only on macos-latest) + CIBW_ARCHS_MACOS: ${{ matrix.arch }} + # Set deployment target based on runner type + CIBW_ENVIRONMENT_MACOS: > + MACOSX_DEPLOYMENT_TARGET=${{ (matrix.python == '36' || matrix.python == '37') && '10.9' || '11.0' }} + # Skip tests on cross-compiled wheels (only for macos-latest) + CIBW_TEST_SKIP: ${{ matrix.os == 'macos-latest' && '*-macosx_x86_64 *-macosx_arm64' || '' }} CIBW_BUILD_VERBOSITY: 1 run: cibuildwheel --output-dir wheelhouse @@ -138,21 +179,31 @@ jobs: path: wheelhouse/*.whl merge_wheels: + name: Merge wheels needs: build_wheels runs-on: ubuntu-latest + steps: - - name: Merge All Wheels - uses: actions/download-artifact@v4 - with: - path: wheels - pattern: wheels-cp* - merge-multiple: true - - run: ls -R wheels + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: dist + pattern: wheels-* + merge-multiple: true + + - name: List downloaded wheels + run: ls -R dist/ + + - name: Upload merged wheels + uses: actions/upload-artifact@v4 + with: + name: "πŸ’˜πŸ’˜πŸ’˜all-wheelsπŸ’˜πŸ’˜πŸ’˜" + path: dist/*.whl # Build the source distribution under Linux build_sdist: name: Source distribution - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 steps: - name: Checkout