Skip to content

Commit 6d17466

Browse files
committed
fix(ci): reuse stable Metal build environment
Signed-off-by: AlpinDale <alpindale@gmail.com>
1 parent 0c2239c commit 6d17466

4 files changed

Lines changed: 31 additions & 6 deletions

File tree

‎.github/scripts/build_metal_wheel.sh‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,24 @@
44
set -euo pipefail
55

66
output_dir="${1:?usage: build_metal_wheel.sh OUTPUT_DIR}"
7+
: "${METAL_BUILD_PYTHON:?METAL_BUILD_PYTHON is required}"
78

89
mkdir -p "$output_dir"
910
rm -f "$output_dir"/*.whl
1011

11-
# uv creates a new isolated build environment for every wheel. CMake otherwise
12-
# keeps Torch paths from the previous environment, which uv removes after the
13-
# build. Refresh only CMake's path cache and retain incremental build outputs.
14-
find build -type f -name CMakeCache.txt -delete 2>/dev/null || true
12+
if [[ ! -x "$METAL_BUILD_PYTHON" ]]; then
13+
echo "::error::Metal build Python is not executable: ${METAL_BUILD_PYTHON}"
14+
exit 1
15+
fi
1516

1617
APHRODITE_TARGET_DEVICE=metal \
1718
APHRODITE_REQUIRE_RUST_FRONTEND=1 \
1819
MACOSX_DEPLOYMENT_TARGET="${MACOSX_DEPLOYMENT_TARGET:-14.0}" \
19-
uv build --wheel --out-dir "$output_dir"
20+
uv build \
21+
--python "$METAL_BUILD_PYTHON" \
22+
--no-build-isolation \
23+
--wheel \
24+
--out-dir "$output_dir"
2025

2126
wheel="$(find "$output_dir" -maxdepth 1 -type f -name '*.whl' -print -quit)"
2227
test -n "$wheel"

‎.github/workflows/platform-wheel.yml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ jobs:
185185
with:
186186
python-version: "3.13"
187187

188+
- name: Create stable Metal build environment
189+
run: |
190+
uv venv --python 3.13 .metal-build-venv
191+
uv pip install \
192+
--python .metal-build-venv/bin/python \
193+
--requirements requirements/build/metal.txt
194+
188195
- name: Install Rust
189196
run: rustup toolchain install stable --profile minimal
190197

@@ -211,6 +218,7 @@ jobs:
211218
PLATFORM_ARCHITECTURE: aarch64
212219
PLATFORM_VERSION_LOCAL: metal
213220
PLATFORM_BUILD_SCRIPT: .github/scripts/build_metal_wheel.sh
221+
METAL_BUILD_PYTHON: ${{ github.workspace }}/.metal-build-venv/bin/python
214222
run: |
215223
.github/scripts/reconcile_platform_wheels.sh \
216224
dist/metal-aarch64 page-index

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
# Should be mirrored in requirements/build/cuda.txt
2+
# Should be mirrored in requirements/build/cuda.txt and requirements/build/metal.txt
33
requires = [
44
"cmake>=3.26.1",
55
"ninja",

‎requirements/build/metal.txt‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Should be mirrored in pyproject.toml
2+
cmake>=3.26.1
3+
ninja
4+
packaging>=24.2
5+
setuptools>=77.0.3,<81.0.0
6+
setuptools-scm>=8.0
7+
setuptools-rust>=1.9.0
8+
torch==2.13.0
9+
wheel
10+
jinja2
11+
mlx>=0.31.0,<0.32.0
12+
nanobind==2.10.2

0 commit comments

Comments
 (0)