Skip to content

Commit f5f5911

Browse files
Add aarch64 CI and wheel publishing targets (#83)
Add Linux aarch64 coverage for package build/import validation and include aarch64 wheels in the publish workflow. Also add Windows amd64 wheel builds alongside the existing Windows support. Use a lightweight C++ extension smoke test for cibuildwheel so publishing checks package installation without requiring GPU runtime dependencies. Signed-off-by: Takeshi Yoshimura <tyos@jp.ibm.com>
1 parent 7bae3af commit f5f5911

4 files changed

Lines changed: 102 additions & 7 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,25 @@ on:
77

88
jobs:
99
build-wheels:
10-
name: Build wheel for ${{ matrix.python-version }}
11-
runs-on: ubuntu-latest
10+
name: Build wheel for ${{ matrix.python-version }} ${{ matrix.platform.arch }}
11+
runs-on: ${{ matrix.platform.runner }}
1212
strategy:
13+
fail-fast: false
1314
matrix:
1415
python-version: ["cp310", "cp311", "cp312", "cp313", "cp314"]
16+
platform:
17+
- arch: x86_64
18+
runner: ubuntu-latest
19+
build: manylinux_x86_64
20+
cibw_arch: x86_64
21+
- arch: aarch64
22+
runner: ubuntu-24.04-arm
23+
build: manylinux_aarch64
24+
cibw_arch: aarch64
25+
- arch: win_amd64
26+
runner: windows-latest
27+
build: win_amd64
28+
cibw_arch: AMD64
1529

1630
steps:
1731
- name: Checkout code
@@ -28,15 +42,15 @@ jobs:
2842
run: |
2943
cibuildwheel --output-dir wheelhouse
3044
env:
31-
CIBW_BUILD: "${{ matrix.python-version }}-manylinux_x86_64"
45+
CIBW_BUILD: "${{ matrix.python-version }}-${{ matrix.platform.build }}"
3246
CIBW_SKIP: "*-musllinux_* *-win32 *-manylinux_i686"
33-
CIBW_TEST_SKIP: "*"
34-
CIBW_ARCHS: "x86_64"
47+
CIBW_TEST_COMMAND: "python {project}/tests/smoke_import_cpp.py"
48+
CIBW_ARCHS: "${{ matrix.platform.cibw_arch }}"
3549

3650
- name: Upload wheel artifact
3751
uses: actions/upload-artifact@v4
3852
with:
39-
name: wheels-${{ matrix.python-version }}
53+
name: wheels-${{ matrix.python-version }}-${{ matrix.platform.arch }}
4054
path: wheelhouse/*.whl
4155

4256
build-sdist:
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: test-aarch64
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build-and-test-aarch64:
15+
name: Test aarch64 Python 3.14
16+
runs-on: ubuntu-24.04-arm
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.14"
24+
25+
- name: Install system dependencies
26+
run: |
27+
sudo apt-get update
28+
sudo apt-get install -y libnuma-dev gcc g++ make
29+
30+
- name: Build package
31+
run: |
32+
python -m pip install --upgrade pip
33+
python -m pip install .
34+
35+
- name: Run extension smoke test
36+
run: |
37+
python tests/smoke_import_cpp.py

tests/smoke_import_cpp.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
"""Smoke-test the compiled C++ extension without importing package __init__."""
4+
5+
import importlib.machinery
6+
import importlib.metadata
7+
import importlib.util
8+
import sys
9+
from pathlib import Path
10+
11+
12+
def _load_cpp_extension():
13+
dist = importlib.metadata.distribution("fastsafetensors")
14+
dist_root = Path(dist.locate_file(""))
15+
16+
for suffix in importlib.machinery.EXTENSION_SUFFIXES:
17+
candidate = dist_root / "fastsafetensors" / f"cpp{suffix}"
18+
if candidate.exists():
19+
spec = importlib.util.spec_from_file_location("cpp", candidate)
20+
if spec is None or spec.loader is None:
21+
raise RuntimeError(f"failed to create import spec for {candidate}")
22+
module = importlib.util.module_from_spec(spec)
23+
sys.modules[spec.name] = module
24+
spec.loader.exec_module(module)
25+
return module
26+
27+
suffixes = ", ".join(importlib.machinery.EXTENSION_SUFFIXES)
28+
raise FileNotFoundError(
29+
f"fastsafetensors.cpp extension was not found under {dist_root}; "
30+
f"checked suffixes: {suffixes}"
31+
)
32+
33+
34+
def main() -> None:
35+
cpp = _load_cpp_extension()
36+
assert cpp.get_alignment_size() == 4096
37+
cpp.load_library_functions("")
38+
assert isinstance(cpp.is_cuda_found(), bool)
39+
assert isinstance(cpp.is_hip_found(), bool)
40+
assert isinstance(cpp.is_cufile_found(), bool)
41+
42+
43+
if __name__ == "__main__":
44+
main()

tests/vllm/test_vllm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import pytest
66

77
pytest.importorskip("vllm", reason="vllm integration tests require vllm")
8-
from vllm import LLM, SamplingParams
8+
from vllm import LLM, SamplingParams # type: ignore[attr-defined]
99

1010
sampling_params = SamplingParams(
1111
temperature=0.0,

0 commit comments

Comments
 (0)