fix: set GOOS/GOARCH for correct cross-compilation in release - #9
Conversation
Release binaries had mismatched architectures because go build used the runner's native arch instead of the target arch from the matrix. Add GOOS, GOARCH and CGO_ENABLED=0 env vars to the build step, and skip tests for cross-compiled binaries that can't run on the runner. Closes #3
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
GOOS/GOARCH/CGO_ENABLED=0环境变量,确保交叉编译产物架构与文件名匹配can_test字段,跳过无法在当前 runner 上执行的交叉编译二进制测试Problem
Release workflow 的
go build没有设置GOOS/GOARCH,导致所有构建使用 runner 原生架构:macos-latest(arm64) →codes-darwin-amd64实际是 arm64 ❌ubuntu-latest(amd64) →codes-linux-arm64实际是 amd64 ❌windows-latest(amd64) →codes-windows-arm64实际是 amd64 ❌Test plan
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build产物经file确认为 ARM aarch64Closes #3