Skip to content

29 add binary creation#30

Merged
Anthony-Bible merged 6 commits into
masterfrom
29-add-binary-creation
Dec 15, 2025
Merged

29 add binary creation#30
Anthony-Bible merged 6 commits into
masterfrom
29-add-binary-creation

Conversation

@Anthony-Bible
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --short flag 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.

Comment thread cmd/version.go Outdated
Comment thread .github/workflows/release.yml Outdated
Comment thread README.md Outdated
Comment thread scripts/build.sh Outdated
Comment thread scripts/release.sh Outdated
Comment thread internal/version/version.go
Comment thread INSTALL.md Outdated
Comment thread cmd/root.go Outdated
Comment thread docker/Dockerfile Outdated
Comment thread README.md Outdated
Anthony-Bible added a commit that referenced this pull request Dec 8, 2025
- 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Makefile Outdated
Comment thread README.md Outdated
Comment thread scripts/release.sh Outdated
Comment thread scripts/release.sh Outdated
Comment thread internal/version/version.go Outdated
Comment thread README.md Outdated
Comment thread INSTALL.md Outdated
Comment thread scripts/build.sh Outdated
Comment on lines +59 to +63
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
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 15, 2025

@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.

Anthony-Bible and others added 6 commits December 15, 2025 08:02
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
@Anthony-Bible Anthony-Bible merged commit da57172 into master Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants