@@ -13,36 +13,39 @@ permissions:
1313jobs :
1414 build_wheels :
1515 name : Build wheels on ${{ matrix.os }} (${{ matrix.arch }})
16- # 在多个操作系统上运行
1716 runs-on : ${{ matrix.os }}
1817 strategy :
19- fail-fast : false # 一个失败不影响其他
18+ fail-fast : false
2019 matrix :
21- os : [ubuntu-latest, windows-latest, macos-latest]
22- arch : [auto] # 让 cibuildwheel 自动检测架构
20+ os : [ ubuntu-latest, windows-latest, macos-latest ]
21+ arch : [ auto ]
2322
2423 steps :
2524 - name : Checkout repository
2625 uses : actions/checkout@v4
2726 with :
28- fetch-depth : 0 # 获取所有历史记录,可能对版本号有用
27+ fetch-depth : 0
28+
29+ - name : Set up QEMU
30+ if : matrix.os == 'ubuntu-latest'
31+ uses : docker/setup-qemu-action@v3
32+ with :
33+ platforms : arm64
2934
30- # 使用 pypa/cibuildwheel action 来构建
3135 - name : Build wheels
32- uses : pypa/cibuildwheel@v2.23.2
36+ uses : pypa/cibuildwheel@v2 # 使用主版本引用
3337 env :
34- # --- cibuildwheel 配置 (根据你的需要调整) ---
35- CIBW_BUILD : cp38-* cp39-* cp310-* cp311-* cp312-* # 构建的 Python 版本范围
36- CIBW_ARCHS_MACOS : x86_64 arm64 # 尝试构建 macOS universal2
37- CIBW_MANYLINUX_X86_64_IMAGE : manylinux2014 # 使用兼容性好的 Linux 镜像
38- CIBW_MANYLINUX_AARCH64_IMAGE : manylinux2014 # Linux ARM 镜像
38+ # --- 其他 cibuildwheel 配置 ---
39+ CIBW_ARCHS_MACOS : x86_64 arm64
40+ CIBW_MANYLINUX_X86_64_IMAGE : manylinux2014
41+ CIBW_MANYLINUX_AARCH64_IMAGE : manylinux2014
42+ CIBW_REPAIR_WHEEL_COMMAND_MACOS : pip install delvewheel && delvewheel repair -w {dest_dir} {wheel}
3943
40- # 将构建好的 wheels 作为 artifact 上传,方便后续 Job 使用或手动下载
4144 - name : Upload wheels artifact
4245 uses : actions/upload-artifact@v4
4346 with :
4447 name : wheels-${{ matrix.os }}-${{ matrix.arch }}
45- path : ./wheelhouse/*.whl # cibuildwheel 默认输出到 wheelhouse
48+ path : ./wheelhouse/*.whl
4649
4750 build_sdist :
4851 name : Build source distribution
@@ -85,24 +88,21 @@ jobs:
8588 id-token : write # 必需权限
8689
8790 steps :
88- # 下载所有构建好的 wheels artifacts
91+ steps :
92+ # 步骤 1: 下载所有 Wheels Artifacts
8993 - name : Download wheel artifacts
9094 uses : actions/download-artifact@v4
9195 with :
92- pattern : wheels-* # 匹配所有 wheels-os-arch 模式的 artifact
93- path : dist/wheels # 下载到 dist/wheels 子目录
94- merge-multiple : true # 合并所有 artifact 到一个目录
96+ pattern : wheels-*
97+ path : dist # <--- 直接下载到 dist 目录
98+ merge-multiple : true
9599
96- # 下载 sdist artifact
100+ # 步骤 2: 下载 sdist Artifact
97101 - name : Download sdist artifact
98102 uses : actions/download-artifact@v4
99103 with :
100104 name : sdist
101- path : dist # 下载到 dist 目录
102-
103- # 将 wheels 移动到主 dist 目录 (pypi-publish action 期望的)
104- - name : Move wheels to dist
105- run : mv dist/wheels/* dist/
105+ path : dist
106106
107107 # 查看最终要上传的文件列表
108108 - name : List distributions
0 commit comments