Skip to content

Commit f94a7a5

Browse files
committed
build(whl): back to CIBW_ due pypi upload
1 parent 2d64264 commit f94a7a5

File tree

1 file changed

+53
-20
lines changed

1 file changed

+53
-20
lines changed

.github/workflows/ampere-build-and-release.yaml

Lines changed: 53 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,17 @@ permissions:
1212

1313
jobs:
1414
build_wheels_arm64:
15-
name: Build arm64 wheel (Python ${{ matrix.python-version }})
15+
name: Build arm64 wheels
1616
runs-on: [self-hosted]
1717
container:
18-
image: ubuntu:24.04
19-
strategy:
20-
matrix:
21-
python-version: ["3.10", "3.11", "3.12", "3.13"]
18+
image: ubuntu:22.04
19+
options: --privileged -v /var/run/docker.sock:/var/run/docker.sock
2220

2321
steps:
24-
- name: Install system dependencies
22+
- name: Install prerequisites
2523
run: |
2624
apt-get update
27-
apt-get install -y git cmake ninja-build gcc g++ curl
25+
apt-get install -y git python3 python3-pip docker.io
2826
2927
- uses: actions/checkout@v4
3028
with:
@@ -33,17 +31,26 @@ jobs:
3331

3432
- uses: actions/setup-python@v5
3533
with:
36-
python-version: ${{ matrix.python-version }}
34+
python-version: "3.11"
3735

38-
- name: Install build dependencies
39-
run: python -m pip install build scikit-build-core
36+
- name: Install cibuildwheel
37+
run: python -m pip install cibuildwheel==2.22.0
4038

41-
- name: Build wheel
42-
run: >
43-
CMAKE_ARGS="-DGGML_NATIVE=OFF
44-
-DCMAKE_CXX_FLAGS='-march=armv8.2-a+dotprod+fp16'
45-
-DCMAKE_C_FLAGS='-march=armv8.2-a+dotprod+fp16'"
46-
python -m build --wheel --outdir wheelhouse/
39+
- name: Build wheels
40+
run: python -m cibuildwheel --output-dir wheelhouse
41+
env:
42+
CIBW_SKIP: "*musllinux* pp*"
43+
CIBW_REPAIR_WHEEL_COMMAND: ""
44+
CIBW_ARCHS: "aarch64"
45+
CIBW_MANYLINUX_AARCH64_IMAGE: "quay.io/pypa/manylinux_2_34_aarch64"
46+
CIBW_BEFORE_ALL: "dnf install -y gcc-toolset-13"
47+
CIBW_ENVIRONMENT: >
48+
CC=/opt/rh/gcc-toolset-13/root/usr/bin/gcc
49+
CXX=/opt/rh/gcc-toolset-13/root/usr/bin/g++
50+
CMAKE_ARGS="-DGGML_NATIVE=OFF
51+
-DCMAKE_CXX_FLAGS=-march=armv8.2-a+dotprod+fp16
52+
-DCMAKE_C_FLAGS=-march=armv8.2-a+dotprod+fp16"
53+
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
4754

4855
- name: Inspect wheel contents
4956
run: |
@@ -54,7 +61,7 @@ jobs:
5461
5562
- uses: actions/upload-artifact@v4
5663
with:
57-
name: wheel-py${{ matrix.python-version }}
64+
name: wheels_arm64
5865
path: ./wheelhouse/*.whl
5966

6067
release:
@@ -63,17 +70,43 @@ jobs:
6370
if: startsWith(github.ref, 'refs/tags/')
6471
runs-on: [self-hosted]
6572
container:
66-
image: ubuntu:24.04
73+
image: ubuntu:22.04
6774

6875
steps:
6976
- uses: actions/download-artifact@v4
7077
with:
71-
pattern: wheel-py*
72-
merge-multiple: true
78+
name: wheels_arm64
7379
path: dist
7480

7581
- uses: softprops/action-gh-release@v2
7682
with:
7783
files: dist/*
7884
env:
7985
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
87+
publish:
88+
name: Publish to PyPI
89+
needs: [build_wheels_arm64]
90+
if: startsWith(github.ref, 'refs/tags/')
91+
runs-on: [self-hosted]
92+
container:
93+
image: ubuntu:22.04
94+
95+
steps:
96+
- name: Install prerequisites
97+
run: |
98+
apt-get update
99+
apt-get install -y python3 python3-pip
100+
101+
- uses: actions/download-artifact@v4
102+
with:
103+
name: wheels_arm64
104+
path: dist/
105+
106+
- name: Publish to PyPI
107+
run: |
108+
python3 -m pip install twine
109+
python3 -m twine upload --non-interactive dist/*.whl
110+
env:
111+
TWINE_USERNAME: __token__
112+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

0 commit comments

Comments
 (0)