Derive CLI version from build info + binary release workflow#52
Conversation
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAdds runtime-derived CLI version output with release linker injection, Go build metadata fallback, and deterministic golden tests. Adds a release-triggered GitHub Actions workflow that cross-compiles Go binaries, archives them, and uploads ZIP files to the GitHub Release. Updates Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
a1c9419 to
01d68eb
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/release.yml (1)
28-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffReplace dead tool
goxwith native build matrix.Tool
goxdead. No updates since 2018. Go 1.26 might break. Use native GitHub Actionsmatrixwithgo build. Less tools. Native support.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 727e6bc4-daa2-4cd4-8e20-d094a1276c9b
📒 Files selected for processing (5)
.github/workflows/release.ymlcli.gocli_test.gotestdata/cli/no-args.goldentestdata/cli/version.golden
Replace the hardcoded "OpenRDAP v0.9.1" string, which had to be manually bumped each release and was missed for v0.10.0 (#51). Version now resolves in order: ldflags-injected releaseVersion (set for released binaries), then the module version from debug.ReadBuildInfo() (so `go install ...@vX.Y.Z` self-reports), then "(dev)". Add a release workflow that cross-compiles binaries with gox on each release, injecting the tag via -ldflags. Added linux/arm64 to the target list. The CLI golden test normalizes the runtime version so it stays deterministic.
01d68eb to
b4ba298
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/release.yml (1)
39-44: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUse built-in GitHub CLI.
Runner have
ghCLI. Drop third-party action. Usegh release upload.♻️ Proposed refactor
- name: Upload Release Assets - uses: softprops/action-gh-release@v2 - with: - files: builds/compressed/*.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.event.release.tag_name }} + run: gh release upload "${TAG}" builds/compressed/*.zipSource: Linters/SAST tools
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9a4b872a-2ee2-47f4-b2a9-b916f8d4b3c7
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (6)
.github/workflows/release.ymlcli.gocli_test.gogo.modtestdata/cli/no-args.goldentestdata/cli/version.golden
🚧 Files skipped from review as they are similar to previous changes (2)
- testdata/cli/no-args.golden
- cli.go
Fixes #51.
Problem
The version was a hardcoded
"OpenRDAP v0.9.1"string that had to be bumped by hand each release. It was missed for v0.10.0, sordap -Vreported the wrong version.Change
versionString()resolves the version in order:releaseVersioninjected via-ldflags "-X github.com/openrdap/rdap.releaseVersion=<tag>"(set for released binaries)debug.ReadBuildInfo()sogo install github.com/openrdap/rdap/cmd/rdap@vX.Y.Zself-reports(dev)fallbackNew
release.ymlcross-compiles binaries with gox on each release and injects the tag. Addedlinux/arm64(the list previously only had 32-bitlinux/arm). The CLI golden test normalizes the runtime version to stay deterministic.Verification
go install ...@v0.99.0(real, via local module proxy)OpenRDAP v0.99.0OpenRDAP v0.11.0go buildOpenRDAP v0.10.0+dirtygo build -buildvcs=falseOpenRDAP (dev)go test ./...passes.Summary by CodeRabbit
golang.org/x/cryptodependency.