29 add binary creation#30
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive build and release infrastructure for creating versioned binaries of the CodeChunking application. The changes introduce automated build scripts, version management, and CI/CD integration to support binary distribution across multiple platforms.
Key Changes:
- Build and release automation scripts (
build.sh,release.sh) with version injection, cross-platform support, and dry-run capabilities - Centralized version management package (
internal/version) with formatted output and build-time variable injection - Enhanced version command with
--shortflag and integration with the new version package - CI/CD updates for automated GitHub releases with checksums and Docker image publishing
- Comprehensive documentation for installation methods, version management, and troubleshooting
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/build.sh | Build automation script with version injection, cross-platform compilation, and CGO support for tree-sitter |
| scripts/release.sh | Release automation handling version updates, binary packaging, checksum generation, and git tagging |
| scripts/test/build_test.go | Comprehensive test suite for build script covering version handling, binary output, and error scenarios |
| scripts/test/release_test.go | Test suite for release script validating version files, directory creation, and binary copying |
| internal/version/version.go | New package providing centralized version information management with formatted output methods |
| cmd/version.go | Refactored version command integrating with the new version package and supporting legacy ldflags injection |
| cmd/version_test.go | Test suite for version command covering output formats and configuration independence |
| cmd/root.go | Enhanced root command with version flag handling and early exit to bypass config initialization |
| cmd/root_test.go | Tests for root command version flag behavior and priority over subcommands |
| docker/Dockerfile | Updated with build arguments for version injection into Docker images |
| .github/workflows/release.yml | Redesigned release workflow with artifact generation, checksums, and multi-platform builds |
| Makefile | New build targets using scripts, installation commands, and version-aware builds |
| README.md | Updated installation instructions with pre-built binary options and version verification examples |
| INSTALL.md | Comprehensive installation guide covering all methods, troubleshooting, and platform-specific instructions |
| VERSION | Version file containing current release version (v1.4.0) |
| SQUASH_GUIDE.md | Git rebase guide for squashing commits (appears to be for different branch) |
| .gitignore | Updated to allow shell scripts in the scripts directory |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Simplify PersistentPreRunE version flag handling with sentinel error pattern
- Remove unreliable c.Run = func(){} workaround (Copilot review comment)
- Use errVersionShown sentinel to properly stop command execution
- Update Execute() to handle sentinel error gracefully (exit 0)
- Clarify intentional config loading design (not temporary code)
- Add comprehensive test coverage for internal/version package
The version flag now reliably prevents subcommand execution by returning
a sentinel error that Execute() filters out. This is cleaner than the
previous approach of setting c.Run to an empty function.
Addresses Copilot review comments on PR #30
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| CGO_ENABLED=1 go build -ldflags="-s -w \ | ||
| -X codechunking/cmd.Version=${{ github.ref_name }} \ | ||
| -X codechunking/cmd.Commit=${{ github.sha }} \ | ||
| -X codechunking/cmd.BuildTime=${{ steps.build_time.outputs.build_time }}" \ | ||
| -o "$binary_name" main.go |
There was a problem hiding this comment.
Cross-compiling with CGO_ENABLED=1 for multiple platforms (especially darwin/arm64 and windows/amd64 from a Linux host) will likely fail without proper cross-compilation toolchains. The main binary requires CGO for tree-sitter, which makes cross-compilation complex. Consider either: 1) building on platform-specific runners, 2) using cross-compilation toolchains, or 3) documenting the CGO cross-compilation requirements.
|
@Anthony-Bible I've opened a new pull request, #31, to work on those changes. Once the pull request is ready, I'll request review from you. |
Tests for: - Version variable initialization and ldflag injection - Version command output format with --short flag support - --version flag functionality on root command - Version display without config dependency - Graceful error handling for missing values 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add install target for main binary installation - Add install-client target for client binary installation - Add build-with-version target with ldflags for version injection - Support cross-platform installation paths (Unix/Linux/macOS/Windows) - Automatically detect GOPATH/bin or USERPROFILE/bin - Provide user feedback about installation location and PATH requirements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Replace deprecated create-release and upload-release-asset actions with softprops/action-gh-release@v2 - Fix version ldflags to use correct path (cmd.Version vs main.Version) - Add client binary (codechunking-client) to releases alongside main binary - Generate SHA256 checksums for all release assets - Improve workflow structure with separate build and release jobs - Add build arguments to Docker builds for version metadata - Auto-generate release notes from git history 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Tests for build.sh: - Version handling from file and command line - Git commit info integration - Binary output verification (main and client) - Correct ldflags usage for version injection - Error handling for missing dependencies - Various build modes (clean, verbose, cross-platform) Tests for release.sh: - Version argument validation - VERSION file management - Build script execution - Release directory structure - Binary versioning and copying - SHA256 checksum generation - Dry run and git tag functionality All tests currently failing as scripts don't exist yet. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix README.md installation section with correct module paths - Add comprehensive binary download instructions from GitHub releases - Document version command usage and expected output format - Clarify differences between main binary and client binary - Create detailed INSTALL.md guide covering multiple installation methods - Document build scripts usage and cross-platform compilation - Update Makefile to use new build script by default - Add troubleshooting section for common installation issues - Include Docker installation instructions - Document CGO requirements for tree-sitter support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
test(scripts): always append version arg in build_test; include stdout/stderr in release_test failure message
1560dbb to
786d903
Compare
No description provided.