Skip to content

Improvements Made to Gitsweeper

This document summarizes the improvements made to the gitsweeper project for better distribution, installation, and development experience.

1. GitHub Actions Configuration Fixes

Issues Fixed:

  • Updated deprecated action versions (actions/checkout@v2@v4, actions/setup-go@v4@v5)
  • Replaced deprecated actions/create-release@v1 with softprops/action-gh-release@v2
  • Fixed git commit hash retrieval using git rev-parse --short HEAD
  • Updated artifact actions to v4 for better performance and reliability

New Features:

  • Added automatic checksum generation for all release archives
  • Enhanced release notes with multiple installation methods
  • Improved artifact organization and upload process

2. Cross-Platform Install Script

Features:

  • Similar to golangci-lint: Based on the proven golangci-lint install script pattern
  • Platform Detection: Automatically detects OS and architecture
  • Version Selection: Install latest or specific version
  • Source Compilation: Force build from source with -f flag
  • Custom Location: Install to custom directory with -b flag
  • Checksum Verification: Automatically verifies downloaded binaries
  • Comprehensive Logging: Debug mode with -d flag

Usage Examples:

# Install latest version
curl -sSfL https://raw.githubusercontent.com/petems/gitsweeper/master/install.sh | sh

# Install specific version
curl -sSfL https://raw.githubusercontent.com/petems/gitsweeper/master/install.sh | sh -s v0.1.0

# Install to /usr/local/bin
curl -sSfL https://raw.githubusercontent.com/petems/gitsweeper/master/install.sh | sh -s -- -b /usr/local/bin

# Force build from source
curl -sSfL https://raw.githubusercontent.com/petems/gitsweeper/master/install.sh | sh -s -- -f

3. Homebrew Support

Tappable Brew Configuration:

  • Created Formula/gitsweeper.rb with intelligent binary/source selection
  • Binary Downloads: Uses pre-compiled binaries for Intel Macs when available
  • Source Compilation: Automatically builds from source on Apple Silicon
  • User Choice: --with-source option to force source compilation
  • Comprehensive Tests: Version, help, and error condition testing

Installation Methods:

# Add tap and install
brew tap petems/gitsweeper
brew install gitsweeper

# Force source compilation
brew install gitsweeper --with-source
brew install --build-from-source gitsweeper

Automated Updates:

  • Created .github/workflows/homebrew.yml for automatic tap updates
  • Calculates SHA256 checksums for both source and binary archives
  • Updates formula versions automatically on release

4. Development Environment Support

Brewfile for macOS Development:

  • Core Tools: Go, Git, Make
  • Testing Tools: golangci-lint, Ruby for Cucumber tests
  • Development Tools: Docker, GitHub CLI, jq, tree, htop
  • Git Enhancements: git-delta, lazygit

Enhanced Makefile:

  • Added cucumber target for integration tests
  • Maintained existing build, test, and release targets
  • Cross-platform build support

5. Documentation Improvements

README.md Updates:

  • Installation Priority: Quick install script prominently featured
  • Multiple Methods: Install script, Homebrew, manual, and source options
  • Development Setup: Brewfile-based environment setup
  • Clear Examples: Step-by-step installation guides

New SETUP.md:

  • Comprehensive Guide: Covers all installation methods
  • Troubleshooting: Common issues and solutions
  • Security: Checksum verification instructions
  • Development: Complete development environment setup

6. Release Process Enhancements

Archive Naming:

  • Consistent naming: gitsweeper-vX.Y.Z-OS-ARCH.tar.gz
  • Platform-specific formats (zip for Windows, tar.gz for Unix)
  • Individual and combined checksum files

Security:

  • SHA256 checksums for all archives
  • Automatic verification in install script
  • Combined checksums file for easy verification

Distribution:

  • Multiple installation methods catering to different user preferences
  • Binary downloads for quick installation
  • Source compilation for flexibility and security-conscious users

7. Platform Support

Supported Platforms:

  • Linux: amd64, arm64, 386
  • macOS: amd64 (Intel), arm64 (Apple Silicon)
  • Windows: amd64, 386
  • FreeBSD, NetBSD, OpenBSD: Various architectures
  • Other: Solaris, Plan 9, Android (where Go supports them)

Intelligent Selection:

  • Install script detects platform automatically
  • Homebrew formula chooses optimal method per platform
  • Fallback to source compilation when binaries unavailable

8. Developer Experience

Quick Setup:

git clone https://github.com/petems/gitsweeper.git
cd gitsweeper
brew bundle  # Install all dependencies
make         # Build and test

Available Commands:

  • make build - Build for current platform
  • make build-all - Build for all platforms
  • make test - Run Go unit tests
  • make cucumber - Run integration tests
  • make lint - Run linting
  • make release-archives - Create release packages

Implementation Notes

File Structure:

.
├── .github/workflows/
│   ├── release.yml      # Enhanced with checksums
│   ├── golang.yml       # Updated actions
│   ├── aruba.yml        # Updated actions
│   └── homebrew.yml     # New: tap automation
├── Formula/
│   └── gitsweeper.rb    # Homebrew formula
├── install.sh           # Install script
├── Brewfile            # Development dependencies
├── SETUP.md            # Comprehensive setup guide
└── IMPROVEMENTS.md     # This document

Security Considerations:

  • All downloads verified with SHA256 checksums
  • Install script follows security best practices
  • No automatic execution of untrusted code
  • Clear indication when building from source

Backward Compatibility:

  • All existing installation methods still work
  • Existing GitHub Actions workflows enhanced, not replaced
  • No breaking changes to the binary or its interface

Next Steps

  1. Test Release: Create a test release to verify all workflows
  2. Homebrew Tap: Create petems/homebrew-gitsweeper repository
  3. Documentation: Update any remaining documentation references
  4. Community: Announce new installation methods to users

This implementation provides a professional-grade distribution system similar to major Go tools like golangci-lint, with multiple installation methods catering to different user preferences and technical requirements.