Files
woodpecker-metal/.woodpecker.yml
lingyuzeng 4ff84858c3
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
fix1
2025-10-04 15:17:38 +08:00

80 lines
2.4 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# .woodpecker.yml
# 在 macOS ARM64 的本地 exec agent 上跑一组检查
steps:
- name: env-info
image: /bin/zsh
when:
platform: darwin/arm64
event: [push, manual, pull_request]
commands:
- |
set -e
echo "== Agent =="
echo "Host: ${HOST:-unknown}"
echo "Platform: ${CI_SYSTEM_PLATFORM}"
echo "Backend: ${CI_SYSTEM_BACKEND}"
echo "Agent name: ${CI_AGENT_NAME:-unknown}"
echo
echo "== OS =="
sw_vers
uname -a
echo
echo "== Toolchains =="
xcodebuild -version || true
xcrun -sdk macosx --show-sdk-version || true
swift --version || true
clang --version || true
echo
echo "== GPU (Metal) =="
system_profiler SPDisplaysDataType | sed -n '1,120p' || true
# 如未装完整 Xcode/CLT下面 metal 编译可能跳过
xcrun -sdk macosx --find metal >/dev/null 2>&1 && echo "metal is available" || echo "metal not found"
- name: swift-hello
image: /bin/zsh
when:
platform: darwin/arm64
event: [push, manual, pull_request]
commands:
- |
set -e
cat > hello.swift <<'SWIFT'
import Foundation
print("Hello from Swift on \(ProcessInfo.processInfo.operatingSystemVersionString)")
SWIFT
swiftc hello.swift -o hello
./hello
- name: metal-compile
image: /bin/zsh
when:
platform: darwin/arm64
event: [push, manual, pull_request]
commands:
- |
set -e
if xcrun -sdk macosx --find metal >/dev/null 2>&1; then
cat > shader.metal <<'METAL'
using namespace metal;
kernel void k(device float* in [[buffer(0)]],
device float* out [[buffer(1)]],
uint id [[thread_position_in_grid]]) { out[id] = in[id] * 2.0; }
METAL
xcrun -sdk macosx metal -c shader.metal -o shader.air
xcrun -sdk macosx metallib shader.air -o shader.metallib
ls -lh shader.*
else
echo "Skipping Metal compile because Xcode CLI tools (metal) are not available."
fi
- name: brew-check
image: /bin/zsh
when:
platform: darwin/arm64
event: [push, manual, pull_request]
commands:
- |
set -e
brew --version || true
which brew || true