Update workflows
This commit is contained in:
@@ -16,36 +16,69 @@ env:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ============================================================
|
# ============================================================
|
||||||
# Linux wheels (x86_64 + aarch64)
|
# Linux x86_64 (manylinux)
|
||||||
# ============================================================
|
# ============================================================
|
||||||
linux:
|
linux-x86_64:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
target: [x86_64, aarch64]
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 安装 Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
- name: 安装 Rust 工具链
|
- name: 安装 Rust 工具链
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
- name: 构建 wheel
|
- name: 构建 wheel (manylinux)
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
target: ${{ matrix.target }}
|
target: x86_64
|
||||||
working-directory: chanlun-py
|
working-directory: chanlun-py
|
||||||
args: --release --out dist
|
args: --release --out dist
|
||||||
manylinux: auto
|
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 产物
|
- name: 上传 wheel 产物
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
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/
|
path: chanlun-py/dist/
|
||||||
|
|
||||||
# ============================================================
|
# ============================================================
|
||||||
@@ -62,6 +95,11 @@ jobs:
|
|||||||
- name: 安装 Rust 工具链
|
- name: 安装 Rust 工具链
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- name: 安装 Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
- name: 构建 wheel
|
- name: 构建 wheel
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
@@ -89,6 +127,11 @@ jobs:
|
|||||||
- name: 安装 Rust 工具链
|
- name: 安装 Rust 工具链
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
|
- name: 安装 Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
- name: 构建 wheel
|
- name: 构建 wheel
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
@@ -110,6 +153,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 安装 Python
|
||||||
|
uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
- name: 构建 sdist
|
- name: 构建 sdist
|
||||||
uses: PyO3/maturin-action@v1
|
uses: PyO3/maturin-action@v1
|
||||||
with:
|
with:
|
||||||
@@ -127,7 +175,7 @@ jobs:
|
|||||||
# 发布至 PyPI
|
# 发布至 PyPI
|
||||||
# ============================================================
|
# ============================================================
|
||||||
publish:
|
publish:
|
||||||
needs: [linux, macos, windows, sdist]
|
needs: [linux-x86_64, linux-aarch64, macos, windows, sdist]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish-to-pypi == 'true'
|
if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.publish-to-pypi == 'true'
|
||||||
permissions:
|
permissions:
|
||||||
@@ -148,8 +196,3 @@ jobs:
|
|||||||
uses: pypa/gh-action-pypi-publish@release/v1
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
packages-dir: dist/
|
packages-dir: dist/
|
||||||
# 使用 OIDC 信任发布(推荐),无需配置 token
|
|
||||||
# 若使用 API token,在 GitHub Secrets 中设置:
|
|
||||||
# PYPI_TOKEN: pypi-xxxxxxxxxxxx
|
|
||||||
# 然后将下一行改为:
|
|
||||||
# password: ${{ secrets.PYPI_TOKEN }}
|
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ crate-type = ["cdylib"]
|
|||||||
name = "chanlun"
|
name = "chanlun"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# 发布至 PyPI 前,需先将 chanlun 发布至 crates.io,然后替换为版本号依赖:
|
|
||||||
# chanlun = "0.1"
|
|
||||||
chanlun = "26.5.1" # { path = "../chanlun" }
|
chanlun = "26.5.1" # { path = "../chanlun" }
|
||||||
pyo3 = { version = "0.28", features = ["extension-module"] }
|
pyo3 = { version = "0.28", features = ["extension-module"] }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
|
|||||||
Reference in New Issue
Block a user