Skip to content

Commit f0391c5

Browse files
authored
fix(ci): release wheel workflow (abetlen#2154)
* fix(ci): harden release wheel workflow * fix(ci): document and pin release wheel baselines * fix(ci): speed up release arch builds * fix(ci): split riscv64 by python version * fix(ci): sanitize riscv64 artifact names
1 parent a6b1807 commit f0391c5

File tree

1 file changed

+39
-10
lines changed

1 file changed

+39
-10
lines changed

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

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ jobs:
4646
env:
4747
# disable repair
4848
CIBW_REPAIR_WHEEL_COMMAND: ""
49+
# Skip cibuildwheel's default i686 sidecar and keep Linux release
50+
# wheels on a portable x86_64 CPU baseline.
51+
CIBW_ARCHS_LINUX: "auto64"
52+
CIBW_ENVIRONMENT_LINUX: CMAKE_ARGS="-DGGML_NATIVE=off"
53+
# Keep macOS release wheels on a portable CPU baseline instead of
54+
# inheriting the hosted runner's native flags.
55+
CIBW_ENVIRONMENT_MACOS: CMAKE_ARGS="-DGGML_NATIVE=off"
4956
with:
5057
package-dir: .
5158
output-dir: wheelhouse
@@ -57,24 +64,21 @@ jobs:
5764

5865
build_wheels_arm64:
5966
name: Build arm64 wheels
60-
runs-on: ubuntu-latest
67+
runs-on: ubuntu-24.04-arm
6168
steps:
6269
- uses: actions/checkout@v4
6370
with:
6471
submodules: "recursive"
6572

66-
- name: Set up QEMU
67-
uses: docker/setup-qemu-action@v3
68-
with:
69-
platforms: linux/arm64
70-
7173
- name: Build wheels
7274
uses: pypa/cibuildwheel@v2.22.0
7375
env:
7476
CIBW_SKIP: "*musllinux* pp*"
7577
CIBW_REPAIR_WHEEL_COMMAND: ""
7678
CIBW_ARCHS: "aarch64"
77-
CIBW_ENVIRONMENT: CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_APPLE_SILICON_PROCESSOR=arm64 -DCMAKE_CROSSCOMPILING=ON"
79+
# Keep native arm64 builds on a portable CPU baseline instead of
80+
# tuning wheels to the hosted runner.
81+
CIBW_ENVIRONMENT: CMAKE_ARGS="-DGGML_NATIVE=off"
7882
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*"
7983
with:
8084
output-dir: wheelhouse
@@ -86,8 +90,27 @@ jobs:
8690
path: ./wheelhouse/*.whl
8791

8892
build_wheels_riscv64:
89-
name: Build riscv64 wheels
93+
name: Build riscv64 wheels (${{ matrix.shard.name }})
9094
runs-on: ubuntu-latest
95+
strategy:
96+
fail-fast: false
97+
matrix:
98+
shard:
99+
- name: cp310
100+
build: "cp310-*"
101+
artifact: wheels_riscv64_cp310
102+
- name: cp311
103+
build: "cp311-*"
104+
artifact: wheels_riscv64_cp311
105+
- name: cp312
106+
build: "cp312-*"
107+
artifact: wheels_riscv64_cp312
108+
- name: cp313
109+
build: "cp313-*"
110+
artifact: wheels_riscv64_cp313
111+
- name: cp314
112+
build: "cp314-*"
113+
artifact: wheels_riscv64_cp314
91114
steps:
92115
- uses: actions/checkout@v4
93116
with:
@@ -104,14 +127,19 @@ jobs:
104127
CIBW_SKIP: "*musllinux* pp*"
105128
CIBW_REPAIR_WHEEL_COMMAND: ""
106129
CIBW_ARCHS: "riscv64"
107-
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-* cp314-*"
130+
# Build riscv64 wheels against a conservative baseline instead of
131+
# enabling RVV-related extensions from the build container.
132+
CIBW_ENVIRONMENT: CMAKE_ARGS="-DGGML_NATIVE=off -DGGML_RVV=off -DGGML_RV_ZFH=off -DGGML_RV_ZVFH=off -DGGML_RV_ZICBOP=off -DGGML_RV_ZIHINTPAUSE=off"
133+
# Split the emulated riscv64 build into one Python version per job
134+
# to minimize wall-clock time without changing the release artifacts.
135+
CIBW_BUILD: ${{ matrix.shard.build }}
108136
with:
109137
output-dir: wheelhouse
110138

111139
- name: Upload wheels as artifacts
112140
uses: actions/upload-artifact@v4
113141
with:
114-
name: wheels_riscv64
142+
name: ${{ matrix.shard.artifact }}
115143
path: ./wheelhouse/*.whl
116144

117145
build_sdist:
@@ -159,6 +187,7 @@ jobs:
159187
release:
160188
name: Release
161189
needs: [build_wheels, build_wheels_arm64, build_wheels_riscv64, build_sdist]
190+
if: startsWith(github.ref, 'refs/tags/')
162191
runs-on: ubuntu-latest
163192

164193
steps:

0 commit comments

Comments
 (0)