mirror of
https://github.com/Tencent/ncnn.git
synced 2026-10-18 05:36:58 +08:00
c15904bb89
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 4.3.0 to 4.3.1. - [Release notes](https://github.com/pypa/cibuildwheel/releases) - [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md) - [Commits](https://github.com/pypa/cibuildwheel/compare/v4.3.0...v4.3.1) --- updated-dependencies: - dependency-name: pypa/cibuildwheel dependency-version: 4.3.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
334 lines
13 KiB
YAML
334 lines
13 KiB
YAML
name: release-python
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
DEVELOPER_DIR: /Applications/Xcode_16.4.0.app/Contents/Developer
|
|
MAC_DEPLOYMENT_TARGET: '11.0'
|
|
ENABLE_BITCODE: OFF
|
|
ENABLE_ARC: OFF
|
|
ENABLE_VISIBILITY: OFF
|
|
CIBW_SKIP: "cp3??t-*"
|
|
|
|
jobs:
|
|
build_sdist:
|
|
name: Build SDist
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
submodules: true
|
|
|
|
- uses: actions/setup-python@v7
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- name: Install deps
|
|
run: python -m pip install twine build
|
|
|
|
- name: Build SDist
|
|
run: python -m build -s
|
|
|
|
- name: Check metadata
|
|
run: twine check dist/*
|
|
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: sdist
|
|
path: dist/*.tar.gz
|
|
|
|
build_wheels:
|
|
name: ${{ matrix.arch }} ${{ matrix.build_id }} on ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { os: ubuntu-24.04, arch: x86_64, build: 'cp*-manylinux*', build_id: cp-manylinux }
|
|
- { os: ubuntu-24.04, arch: x86_64, build: 'cp*-musllinux*', build_id: cp-musllinux }
|
|
- { os: ubuntu-24.04, arch: x86_64, build: 'pp*', build_id: pp }
|
|
- { os: ubuntu-24.04, arch: i686, build: 'cp*-manylinux*', build_id: cp-manylinux }
|
|
- { os: ubuntu-24.04, arch: i686, build: 'cp*-musllinux*', build_id: cp-musllinux }
|
|
- { os: ubuntu-24.04, arch: i686, build: 'pp*', build_id: pp }
|
|
- { os: windows-2025, arch: x86, build: 'cp*', build_id: cp }
|
|
- { os: windows-2025, arch: AMD64, build: 'cp*', build_id: cp }
|
|
- { os: windows-2025, arch: AMD64, build: 'pp*', build_id: pp }
|
|
- { os: windows-11-arm, arch: ARM64, build: 'cp*', build_id: cp }
|
|
- { os: macos-15-intel, arch: x86_64, build: 'cp*', build_id: cp }
|
|
- { os: macos-15, arch: arm64, build: 'cp*', build_id: cp }
|
|
- { os: ubuntu-24.04-arm, arch: armv7l, build: 'cp*-manylinux*', build_id: cp-manylinux }
|
|
- { os: ubuntu-24.04-arm, arch: armv7l, build: 'cp*-musllinux*', build_id: cp-musllinux }
|
|
- { os: ubuntu-24.04-arm, arch: aarch64, build: 'cp*-manylinux*', build_id: cp-manylinux }
|
|
- { os: ubuntu-24.04-arm, arch: aarch64, build: 'cp*-musllinux*', build_id: cp-musllinux }
|
|
- { os: ubuntu-24.04-arm, arch: aarch64, build: 'pp*', build_id: pp }
|
|
|
|
env:
|
|
OPENMP_VERSION: '18.1.2'
|
|
OPENMP_CMAKE_OPTIONS: |
|
|
-DCMAKE_TOOLCHAIN_FILE=../../toolchains/ios.toolchain.cmake \
|
|
-DDEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET \
|
|
-DENABLE_BITCODE=$ENABLE_BITCODE \
|
|
-DENABLE_ARC=$ENABLE_ARC \
|
|
-DENABLE_VISIBILITY=$ENABLE_VISIBILITY \
|
|
-DCMAKE_INSTALL_PREFIX=install \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DLIBOMP_ENABLE_SHARED=OFF \
|
|
-DLIBOMP_OMPT_SUPPORT=OFF \
|
|
-DLIBOMP_USE_HWLOC=OFF \
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
submodules: true
|
|
|
|
# build wheels for ubuntu
|
|
- name: Build wheels for ubuntu
|
|
if: matrix.os == 'ubuntu-24.04'
|
|
uses: pypa/cibuildwheel@v4.3.1
|
|
env:
|
|
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
|
|
CIBW_BUILD: ${{ matrix.build }}
|
|
CIBW_ENABLE: pypy
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=4
|
|
with:
|
|
output-dir: wheelhouse
|
|
|
|
# build wheels for ubuntu armv7l
|
|
- name: Build wheels for ubuntu armv7l
|
|
if: matrix.os == 'ubuntu-24.04-arm' && (matrix.arch == 'armv7l')
|
|
uses: pypa/cibuildwheel@v4.3.1
|
|
env:
|
|
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
|
|
CIBW_BUILD: ${{ matrix.build }}
|
|
CIBW_ENABLE: pypy
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=4
|
|
CFLAGS="-mfpu=neon" CXXFLAGS="-mfpu=neon"
|
|
with:
|
|
output-dir: wheelhouse
|
|
|
|
# build wheels for ubuntu aarch64
|
|
- name: Build wheels for ubuntu aarch64
|
|
if: matrix.os == 'ubuntu-24.04-arm' && (matrix.arch == 'aarch64')
|
|
uses: pypa/cibuildwheel@v4.3.1
|
|
env:
|
|
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
|
|
CIBW_BUILD: ${{ matrix.build }}
|
|
CIBW_ENABLE: pypy
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=4
|
|
with:
|
|
output-dir: wheelhouse
|
|
|
|
# build wheels for windows
|
|
- name: Build wheels for windows
|
|
if: matrix.os == 'windows-2025' && (matrix.arch == 'AMD64' || matrix.arch == 'x86')
|
|
uses: pypa/cibuildwheel@v4.3.1
|
|
env:
|
|
CIBW_ARCHS_WINDOWS: ${{ matrix.arch }}
|
|
CIBW_BUILD: ${{ matrix.build }}
|
|
CIBW_ENABLE: pypy
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
CIBW_ENVIRONMENT_WINDOWS: CMAKE_BUILD_PARALLEL_LEVEL=4
|
|
CIBW_BEFORE_BUILD: pip install delvewheel
|
|
CIBW_REPAIR_WHEEL_COMMAND: delvewheel repair -w {dest_dir} {wheel}
|
|
with:
|
|
output-dir: wheelhouse
|
|
|
|
- name: Build wheels for windows ARM64
|
|
if: matrix.os == 'windows-11-arm' && matrix.arch == 'ARM64'
|
|
uses: pypa/cibuildwheel@v4.3.1
|
|
env:
|
|
CIBW_ARCHS_WINDOWS: ${{ matrix.arch }}
|
|
CIBW_BUILD: ${{ matrix.build }}
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
CIBW_ENVIRONMENT_WINDOWS: CMAKE_BUILD_PARALLEL_LEVEL=4
|
|
CIBW_BEFORE_BUILD: pip install delvewheel
|
|
CIBW_REPAIR_WHEEL_COMMAND: delvewheel repair -w {dest_dir} {wheel} --no-dll "msvcp140.dll;vcomp140.dll"
|
|
with:
|
|
output-dir: wheelhouse
|
|
|
|
# build wheels for macos
|
|
- name: cache-openmp for macos
|
|
if: matrix.os == 'macos-15-intel' || matrix.os == 'macos-15'
|
|
id: cache-openmp
|
|
uses: actions/cache@v6
|
|
with:
|
|
path: openmp-install
|
|
key: openmp-macos-install-20251004
|
|
|
|
- name: openmp for macos
|
|
if: (matrix.os == 'macos-15-intel' || matrix.os == 'macos-15') && steps.cache-openmp.outputs.cache-hit != 'true'
|
|
run: |
|
|
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
|
|
tar -xf cmake-${{ env.OPENMP_VERSION }}.src.tar.xz
|
|
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-${{ env.OPENMP_VERSION }}/openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
|
|
tar -xf openmp-${{ env.OPENMP_VERSION }}.src.tar.xz
|
|
mv cmake-${{ env.OPENMP_VERSION }}.src/Modules/* openmp-${{ env.OPENMP_VERSION }}.src/cmake/
|
|
cd openmp-${{ env.OPENMP_VERSION }}.src
|
|
wget https://github.com/nihui/llvm-project/commit/ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
|
|
patch -p2 -i ef8c35bcf5d9cfdb0764ffde6a63c04ec715bc37.patch
|
|
wget https://github.com/nihui/llvm-project/commit/5c12711f9a21f41bea70566bf15a4026804d6b20.patch
|
|
patch -p2 -i 5c12711f9a21f41bea70566bf15a4026804d6b20.patch
|
|
|
|
- name: openmp-build-x86_64 for macos
|
|
if: (matrix.os == 'macos-15-intel' || matrix.os == 'macos-15') && steps.cache-openmp.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd openmp-${{ env.OPENMP_VERSION }}.src
|
|
mkdir -p build-x86_64 && cd build-x86_64
|
|
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=MAC -DARCHS="x86_64" ..
|
|
cmake --build . -j 4
|
|
cmake --build . --target install
|
|
|
|
- name: openmp-build-arm64 for macos
|
|
if: (matrix.os == 'macos-15-intel' || matrix.os == 'macos-15') && steps.cache-openmp.outputs.cache-hit != 'true'
|
|
run: |
|
|
cd openmp-${{ env.OPENMP_VERSION }}.src
|
|
mkdir -p build-arm64 && cd build-arm64
|
|
cmake ${{ env.OPENMP_CMAKE_OPTIONS }} -DPLATFORM=MAC_ARM64 -DARCHS="arm64" ..
|
|
cmake --build . -j 4
|
|
cmake --build . --target install
|
|
|
|
- name: openmp-merge-fat-library for macos
|
|
if: (matrix.os == 'macos-15-intel' || matrix.os == 'macos-15') && steps.cache-openmp.outputs.cache-hit != 'true'
|
|
run: |
|
|
mkdir -p $GITHUB_WORKSPACE/openmp-install
|
|
cp -a openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/include $GITHUB_WORKSPACE/openmp-install
|
|
mkdir -p $GITHUB_WORKSPACE/openmp-install/lib
|
|
lipo -create \
|
|
openmp-${{ env.OPENMP_VERSION }}.src/build-x86_64/install/lib/libomp.a \
|
|
openmp-${{ env.OPENMP_VERSION }}.src/build-arm64/install/lib/libomp.a \
|
|
-o $GITHUB_WORKSPACE/openmp-install/lib/libomp.a
|
|
|
|
- name: install-openmp for macos
|
|
if: matrix.os == 'macos-15-intel' || matrix.os == 'macos-15'
|
|
run: |
|
|
sudo cp $GITHUB_WORKSPACE/openmp-install/include/* $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
|
|
sudo cp $GITHUB_WORKSPACE/openmp-install/lib/libomp.a $DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
|
|
|
|
- name: vulkansdk for macos
|
|
if: matrix.os == 'macos-15-intel' || matrix.os == 'macos-15'
|
|
run: |
|
|
wget -q https://sdk.lunarg.com/sdk/download/1.4.335.1/mac/vulkansdk-macos-1.4.335.1.zip?Human=true -O vulkansdk-macos-1.4.335.1.zip
|
|
unzip vulkansdk-macos-1.4.335.1.zip
|
|
sudo vulkansdk-macOS-1.4.335.1.app/Contents/MacOS/vulkansdk-macOS-1.4.335.1 --root $GITHUB_WORKSPACE/vulkansdk-macos-1.4.335.1 --accept-licenses --default-answer --confirm-command install
|
|
|
|
- name: Build wheels for macos x86_64
|
|
if: matrix.os == 'macos-15-intel' && matrix.arch == 'x86_64'
|
|
uses: pypa/cibuildwheel@v4.3.1
|
|
env:
|
|
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
|
|
CIBW_BUILD: ${{ matrix.build }}
|
|
CIBW_ENABLE: pypy
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=4
|
|
CMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/toolchains/ios.toolchain.cmake PLATFORM=MAC ARCHS="x86_64"
|
|
DEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET ENABLE_BITCODE=OFF ENABLE_ARC=OFF ENABLE_VISIBILITY=OFF
|
|
OpenMP_C_FLAGS="-Xclang -fopenmp" OpenMP_CXX_FLAGS="-Xclang -fopenmp"
|
|
OpenMP_C_LIB_NAMES="libomp" OpenMP_CXX_LIB_NAMES="libomp"
|
|
OpenMP_libomp_LIBRARY="libomp.a"
|
|
Vulkan_LIBRARY=$GITHUB_WORKSPACE/vulkansdk-macos-1.4.335.1/macOS/lib/libMoltenVK.dylib
|
|
MACOSX_DEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET
|
|
with:
|
|
output-dir: wheelhouse
|
|
|
|
- name: Build wheels for macos arm64
|
|
if: matrix.os == 'macos-15' && matrix.arch == 'arm64'
|
|
uses: pypa/cibuildwheel@v4.3.1
|
|
env:
|
|
CIBW_ARCHS_MACOS: ${{ matrix.arch }}
|
|
CIBW_BUILD: ${{ matrix.build }}
|
|
CIBW_ENABLE: pypy
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=4
|
|
CMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/toolchains/ios.toolchain.cmake PLATFORM=MAC_ARM64 ARCHS="arm64"
|
|
DEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET ENABLE_BITCODE=OFF ENABLE_ARC=OFF ENABLE_VISIBILITY=OFF
|
|
OpenMP_C_FLAGS="-Xclang -fopenmp" OpenMP_CXX_FLAGS="-Xclang -fopenmp"
|
|
OpenMP_C_LIB_NAMES="libomp" OpenMP_CXX_LIB_NAMES="libomp"
|
|
OpenMP_libomp_LIBRARY="libomp.a"
|
|
Vulkan_LIBRARY=$GITHUB_WORKSPACE/vulkansdk-macos-1.4.335.1/macOS/lib/libMoltenVK.dylib
|
|
MACOSX_DEPLOYMENT_TARGET=$MAC_DEPLOYMENT_TARGET
|
|
with:
|
|
output-dir: wheelhouse
|
|
|
|
- name: Show files
|
|
run: ls -lh wheelhouse
|
|
shell: bash
|
|
|
|
- name: Verify clean directory
|
|
run: git diff --exit-code
|
|
shell: bash
|
|
|
|
- name: Upload wheels
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.build_id }}
|
|
path: wheelhouse/*.whl
|
|
|
|
build_wheels_qemu_cp:
|
|
name: ${{ matrix.arch }} ${{ matrix.build_cp }} ${{ matrix.build_sub }}
|
|
runs-on: ubuntu-24.04
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
arch: [riscv64]
|
|
build_cp: [cp38, cp39, cp310, cp311, cp312, cp313, cp314]
|
|
build_sub: [manylinux, musllinux]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v4
|
|
with:
|
|
platforms: all
|
|
|
|
- name: Build wheels with qemu
|
|
uses: pypa/cibuildwheel@v4.3.1
|
|
env:
|
|
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
|
|
CIBW_BUILD: ${{ matrix.build_cp }}-${{ matrix.build_sub }}*
|
|
CIBW_BUILD_VERBOSITY: 1
|
|
CIBW_ENVIRONMENT: CMAKE_BUILD_PARALLEL_LEVEL=4 EXTRA_CMAKE_ARGS="-DNCNN_XTHEADVECTOR=OFF"
|
|
with:
|
|
output-dir: wheelhouse
|
|
|
|
- name: Show files
|
|
run: ls -lh wheelhouse
|
|
shell: bash
|
|
|
|
- name: Verify clean directory
|
|
run: git diff --exit-code
|
|
shell: bash
|
|
|
|
- name: Upload wheels
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: wheels_qemu_cp-${{ matrix.arch }}-${{ matrix.build_cp }}-${{ matrix.build_sub }}
|
|
path: wheelhouse/*.whl
|
|
|
|
upload_all:
|
|
permissions:
|
|
contents: none
|
|
name: Upload
|
|
needs: [build_wheels, build_wheels_qemu_cp, build_sdist]
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
path: dist
|
|
merge-multiple: true
|
|
|
|
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
with:
|
|
user: __token__
|
|
password: ${{ secrets.PYPI_API_TOKEN }}
|