Update workflows

This commit is contained in:
YuWuKunCheng
2026-05-27 00:07:54 +08:00
parent 9280041f2a
commit 98f07508fa
2 changed files with 62 additions and 21 deletions
+62 -19
View File
@@ -16,36 +16,69 @@ env:
jobs:
# ============================================================
# Linux wheels (x86_64 + aarch64)
# Linux x86_64 (manylinux)
# ============================================================
linux:
linux-x86_64:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64, aarch64]
steps:
- uses: actions/checkout@v4
- name: 安装 Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
- name: 构建 wheel
- name: 构建 wheel (manylinux)
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
target: x86_64
working-directory: chanlun-py
args: --release --out dist
manylinux: auto
python-source: download
before-script-linux: |
if [ "${{ matrix.target }}" = "aarch64" ]; then
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
fi
- name: 上传 wheel 产物
uses: actions/upload-artifact@v4
with:
name: wheels-linux-${{ matrix.target }}
name: wheels-linux-x86_64
path: chanlun-py/dist/
# ============================================================
# Linux aarch64 (宿主机交叉编译,非 manylinux)
# ============================================================
linux-aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 安装 Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: 安装 Rust 工具链 + aarch64 目标
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu
- name: 安装 aarch64 交叉编译器
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: 构建 wheel
uses: PyO3/maturin-action@v1
with:
target: aarch64
working-directory: chanlun-py
args: --release --out dist
- name: 上传 wheel 产物
uses: actions/upload-artifact@v4
with:
name: wheels-linux-aarch64
path: chanlun-py/dist/
# ============================================================
@@ -62,6 +95,11 @@ jobs:
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
- name: 安装 Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: 构建 wheel
uses: PyO3/maturin-action@v1
with:
@@ -89,6 +127,11 @@ jobs:
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
- name: 安装 Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: 构建 wheel
uses: PyO3/maturin-action@v1
with:
@@ -110,6 +153,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: 安装 Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: 构建 sdist
uses: PyO3/maturin-action@v1
with:
@@ -127,7 +175,7 @@ jobs:
# 发布至 PyPI
# ============================================================
publish:
needs: [linux, macos, windows, sdist]
needs: [linux-x86_64, linux-aarch64, macos, windows, sdist]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish-to-pypi == 'true'
permissions:
@@ -148,8 +196,3 @@ jobs:
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
# 使用 OIDC 信任发布(推荐),无需配置 token
# 若使用 API token,在 GitHub Secrets 中设置:
# PYPI_TOKEN: pypi-xxxxxxxxxxxx
# 然后将下一行改为:
# password: ${{ secrets.PYPI_TOKEN }}