diff --git a/.woodpecker.yml b/.woodpecker.yml index dee3b1e..7357d0e 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,11 +1,79 @@ +# .woodpecker.yml +# 在 macOS ARM64 的本地 exec agent 上跑一组检查 steps: - - name: hello-macos + - name: env-info image: /bin/zsh when: platform: darwin/arm64 event: [push, manual, pull_request] commands: - - 'set -e' - - 'echo "Agent platform: ${CI_SYSTEM_PLATFORM}"' - - 'sw_vers' - - 'xcodebuild -version || true' + - | + 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 diff --git a/config/.woodpecker_line.yml b/config/.woodpecker_line.yml new file mode 100644 index 0000000..dee3b1e --- /dev/null +++ b/config/.woodpecker_line.yml @@ -0,0 +1,11 @@ +steps: + - name: hello-macos + image: /bin/zsh + when: + platform: darwin/arm64 + event: [push, manual, pull_request] + commands: + - 'set -e' + - 'echo "Agent platform: ${CI_SYSTEM_PLATFORM}"' + - 'sw_vers' + - 'xcodebuild -version || true'