-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add automated cross-platform binary builds and releases #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Added GitHub Actions workflows for: - Automated releases on version tags - Cross-platform binary builds (Linux, macOS, Windows) - Artifact uploads for testing - Local build script for development Supports 6 platforms: Linux/macOS/Windows x amd64/arm64 Co-authored-by: f0ssel <[email protected]>
Removed Windows platform support from: - GitHub Actions release workflow - GitHub Actions build workflow - Local build script - Documentation Now supports 4 platforms: - Linux: amd64, arm64 - macOS: amd64 (Intel), arm64 (Apple Silicon) All builds create .tar.gz archives for consistency. Co-authored-by: f0ssel <[email protected]>
Added comprehensive Makefile with targets: - make build: Build for current platform - make build-all: Cross-platform builds - make test: Run tests - make clean: Clean artifacts - make install/uninstall: System installation - make help: Show all targets Includes version injection, coverage reports, and development tools. Co-authored-by: f0ssel <[email protected]>
Updated workflows to use Makefile targets for consistency: ## CI Workflow - Use 'make tidy' instead of 'go mod download' + 'go mod verify' - Use 'make test' instead of 'go test -v -race ./...' - Use 'make build' instead of 'go build -v ./...' ## Build & Release Workflows - Use 'make tidy' for dependency management - Keep direct Go commands for cross-compilation (needed for matrix builds) - Maintain parallel builds for different platforms ## New Makefile Build Workflow - Added weekly workflow that demonstrates 'make build-all' - Builds all platforms in single job using Makefile - Manual trigger available for testing - Uploads all binaries as single artifact This ensures consistency between local development (using Makefile) and CI/CD (using same Makefile targets where appropriate). Tested: make tidy && make test && make build works correctly. Co-authored-by: f0ssel <[email protected]>
…lp targets Removed targets that are not core to build/test workflow: - install/uninstall: System installation should be manual - tidy: Direct go mod commands are clearer in workflows - dev-setup: Too opinionated for a build tool - help: Makefile is simple enough without help Remaining focused targets: - build: Build for current platform - build-all: Cross-platform builds - test: Run tests with race detection - test-coverage: Generate coverage reports - clean: Clean build artifacts - fmt: Format code - lint: Lint code Updated GitHub Actions workflows to use direct Go commands for dependency management instead of removed make tidy. Updated RELEASES.md to reflect simplified Makefile. Tested: make build && make test && make clean works correctly. Co-authored-by: f0ssel <[email protected]>
Simplified the lint target to just run golangci-lint directly instead of falling back to go vet when golangci-lint is not available. Before: - Complex shell logic to check if golangci-lint exists - Fallback to go vet if not found - Confusing behavior (different tools run depending on environment) After: - Simple: golangci-lint run - Clear error if golangci-lint not installed - Consistent behavior across environments Updated RELEASES.md to document the golangci-lint requirement. Tested: make lint fails cleanly with clear error when golangci-lint missing. Co-authored-by: f0ssel <[email protected]>
Removed .github/workflows/makefile-build.yml as it duplicated the functionality of the existing build.yml workflow. The makefile-build workflow was added to demonstrate make build-all but it created unnecessary duplication: - build.yml: Builds on push/PR with matrix for parallel builds - makefile-build.yml: Weekly + manual trigger using make build-all The existing build.yml workflow already provides: - Cross-platform builds for all supported platforms - Artifact uploads for testing - Triggered on every push/PR for immediate feedback Users can run 'make build-all' locally if they want to build all platforms in a single command. Now we have a clean, focused workflow structure: - ci.yml: Testing and verification - build.yml: Cross-platform binary builds - release.yml: Automated releases on tags Co-authored-by: f0ssel <[email protected]>
Removed all development-related content from RELEASES.md: ## Removed Sections - Local Development (Makefile usage, build scripts) - Development Builds (GitHub Actions artifacts) - Manual cross-compilation examples - Build troubleshooting - Version injection examples ## Kept Release-Focused Content - Automated release process (git tag workflow) - Supported platforms table - Release process for maintainers - Version naming conventions - Installation from GitHub releases - Release troubleshooting The file now focuses exclusively on: 1. How to cut a release (git tag v1.0.0) 2. What gets built and released 3. How users install releases 4. Troubleshooting release issues Development information belongs in README.md or separate docs, not in a release-focused document. Co-authored-by: f0ssel <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Adds comprehensive release automation with GitHub Actions to build and distribute jail binaries across Unix platforms, plus development tooling improvements.
🚀 Automated Releases
Release on Tags
Simply push a version tag to create a release:
This automatically:
Development Builds
Every push to main and PR creates artifacts:
💻 Supported Platforms
jail-linux-amd64
.tar.gz
jail-linux-arm64
.tar.gz
jail-darwin-amd64
.tar.gz
jail-darwin-arm64
.tar.gz
🛠️ Development Tools
Makefile
Added focused Makefile with core targets:
Build Script
Local cross-platform build script:
./scripts/build.sh # Builds all 4 platforms
🔧 Environment Preservation
Fixed sudo environment issues:
📁 Files Added/Modified
GitHub Actions Workflows
.github/workflows/release.yml
: Automated releases on tags.github/workflows/build.yml
: Build artifacts on push/PR.github/workflows/ci.yml
: Updated to use Makefile targetsDevelopment Tools
Makefile
: Core build, test, clean targetsscripts/build.sh
: Local cross-platform build scriptmain.go
: Added version variable for build-time injection.gitignore
: Ignore local build directoryEnvironment Preservation
environment/sudo.go
: Sudo detection and user environment restorationnetwork/linux.go
: Updated to restore user environmentnetwork/macos.go
: Updated to restore user environmentDocumentation
RELEASES.md
: Focused release process documentation🎯 Key Design Decisions
Unix-Only Focus
Simplified Tooling
Environment Handling
🧪 Testing
📦 Usage After Merge
For Users
tar -xzf jail-*.tar.gz && chmod +x jail && sudo mv jail /usr/local/bin/
For Developers
make build
,make test
,make clean
make build-all
or./scripts/build.sh
git tag v1.0.0 && git push origin v1.0.0
For Sudo Users
sudo jail --allow "github.com" -- curl https://github.com
This provides a complete development and release pipeline with proper environment handling! 🎉