Skip to content

Commit 380fa5d

Browse files
committed
fix(macos): download Metal Toolchain before release compile
macOS release jobs (arm64/intel) failed at "Check release compile": error compiling metal shaders to .air; cannot execute tool 'metal' due to missing Metal Toolchain Xcode 26 split the Metal Toolchain into a separately downloadable component that the macos-26 runner image does not preinstall. The build compiles shaders through the Xcode at MD_APPLE_SDK_ROOT (an RC Xcode on the new image), which differs from the one setup-xcode selects, so the toolchain setup-xcode pulls is not the one used. Add a prepare_environment step that downloads MetalToolchain for the Xcode actually used for compilation (MD_APPLE_SDK_ROOT, falling back to xcode-select -p). The download is idempotent.
1 parent 8ff3ce6 commit 380fa5d

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.github/actions/prepare_environment/action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,20 @@ runs:
187187
if: ${{ inputs.target_os == 'macos' && inputs.is_self_hosted != 'true' }}
188188
with:
189189
xcode-version: '26'
190+
191+
- name: Ensure Metal Toolchain is available (macOS)
192+
if: ${{ inputs.target_os == 'macos' && inputs.is_self_hosted != 'true' }}
193+
shell: bash
194+
# warpui 的 build script 用 `metal` 把 shaders.metal 编译成 .air。Xcode 26 把
195+
# Metal Toolchain 拆成需单独下载的组件,macos-26 runner 镜像默认不预装,且
196+
# 编译走 MD_APPLE_SDK_ROOT 指向的 Xcode(可能与 setup-xcode 选定的不同),
197+
# 故对该 Xcode 显式下载组件。-downloadComponent 幂等,已存在则快速返回。
198+
run: |
199+
if [ -n "$MD_APPLE_SDK_ROOT" ]; then
200+
DEVELOPER_DIR="$MD_APPLE_SDK_ROOT/Contents/Developer"
201+
else
202+
DEVELOPER_DIR="$(xcode-select -p)"
203+
fi
204+
export DEVELOPER_DIR
205+
echo "Using DEVELOPER_DIR=$DEVELOPER_DIR"
206+
xcodebuild -downloadComponent MetalToolchain

0 commit comments

Comments
 (0)