Skip to content

Commit 6b4b846

Browse files
committed
build(ci): 更新 Python 版本要求并改进轮子构建流程
- 将最低 Python 版本要求从 3.7 提升到 3.8 - 修正 README 文件引用(从 readme = "README.md" 改为 readme = "README.MD") - 更新 GitHub Actions 工作流,增加 QEMU 设置步骤以支持 ARM 架构 - 修改轮子构建配置,使用主版本引用并添加修复 Wheel 命令 - 优化 artifact 下载和合并流程,简化构建产物处理
1 parent 9792075 commit 6b4b846

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

.github/workflows/python-publish.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,36 +13,39 @@ permissions:
1313
jobs:
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

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ authors = [
99
{name = "xiaosu", email = "xiaosu-1009@qq.com"},
1010
]
1111
description = "内存优化的 CppJieba Python 绑定 (基于 DAT)"
12-
readme = "README.md"
13-
requires-python = ">=3.7"
12+
readme = "README.MD"
13+
requires-python = ">=3.8"
1414
license = { file = "LICENSE" }
1515
classifiers = [
1616
"Development Status :: 4 - Beta",

0 commit comments

Comments
 (0)