Thank you for your interest in contributing to coderaft! This document provides guidelines and information for contributors.
- Code of Conduct
- Getting Started
- How to Contribute
- Development Setup
- Coding Standards
- Testing
- Continuous Integration
- Submitting Changes
- Reporting Issues
- Feature Requests
- Documentation
- Community
- License
This project adheres to a code of conduct that we expect all contributors to follow. Please read CODE_OF_CONDUCT.md before contributing.
Important: The
mainbranch is the source of truth for stable code. All install scripts pull directly frommainand build the binary. Keepmainstable — use feature branches for development and ensure CI passes before merging.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/coderaft.git cd coderaft - Add the upstream repository:
git remote add upstream https://github.com/itzcozi/coderaft.git
We welcome several types of contributions:
- 🐛 Bug fixes - Fix issues and improve reliability
- ✨ New features - Add functionality following our roadmap
- 📚 Documentation improvements - Keep docs accurate and helpful
- 🧪 Tests - Expand our comprehensive test suite
- 🔧 Code refactoring - Improve code quality and maintainability
- 🎨 UI/UX improvements - Enhance user experience
- ⚡ Performance optimizations - Make coderaft faster and more efficient
- 🛡️ Security enhancements - Improve security posture
Look for issues labeled with:
good first issue- Perfect for newcomershelp wanted- We'd love community helpdocumentation- Improve our docs
Cross-Platform Support: coderaft works on Linux, macOS, and Windows wherever Docker is available.
Required Software:
- Go 1.24 or later
- Docker (Docker Desktop on macOS/Windows)
- Git
-
Install dependencies:
make deps
-
Build the project:
make build
-
Run tests:
make test -
Run all quality checks:
make ci
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following our coding standards
-
Test your changes:
make ci
-
Commit your changes:
git add . git commit -m "feat: add your feature description"
-
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request on GitHub
- Follow standard Go formatting with
gofmt - Use
golangci-lintfor code quality - Write meaningful variable and function names
- Add comments for exported functions and types
- Keep functions small and focused (max 50 statements)
- Maintain cyclomatic complexity under 15
cmd/ # Main applications
internal/ # Private application code
docs/ # Documentation
scripts/ # Build and utility scripts
.github/ # GitHub workflows and templates
We follow the Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Examples:
feat(cli): add support for custom Docker registries
fix(config): resolve issue with JSON parsing
docs: update installation instructions
test(docker): add integration tests for container management
coderaft has a comprehensive test suite that includes:
- Unit tests for individual functions and components
- Integration tests for CLI commands and end-to-end functionality
- Security tests and vulnerability scanning
- Performance tests with race condition detection
test/
├── integration/ # End-to-end CLI tests
│ └── cli_test.go
internal/
├── commands/
│ ├── version_test.go # Version command tests
│ └── root_test.go # Project validation tests
├── config/
│ ├── config_test.go # Config struct tests
│ └── config_manager_test.go # File operations tests
├── docker/
│ └── client_test.go # Docker client tests
└── testutil/
├── testutil.go # Test helpers and utilities
└── testutil_test.go # Tests for test utilities
# Run all tests
make test
# Run tests with coverage
make test-coverage
# Run tests with race detection (Linux)
go test -race ./...
# Run specific test packages
go test ./internal/commands -v
go test ./internal/config -v
go test ./test/integration -v
# Generate coverage report
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html- Write unit tests for all new functions
- Include both success and failure cases
- Use table-driven tests when appropriate
- Mock external dependencies (Docker, filesystem)
- Aim for meaningful test coverage (not just percentage)
- Test CLI commands end-to-end
- Verify error messages and exit codes
- Handle OS-specific behavior gracefully
- Test argument validation and help text
Use the internal/testutil package for common operations:
import "coderaft/internal/testutil"
func TestMyFunction(t *testing.T) {
// Create test data
config := testutil.CreateTestConfig()
project := testutil.CreateTestProject("my-project")
// Use test assertions
testutil.AssertNoError(t, err)
testutil.AssertEqual(t, expected, actual)
testutil.AssertNotNil(t, result)
}- Fast: Unit tests should run quickly (< 100ms each)
- Isolated: Tests shouldn't depend on external services
- Deterministic: Tests should produce consistent results
- Clear: Test names should describe what they verify
- Comprehensive: Cover happy paths, edge cases, and error conditions
func TestFunctionName(t *testing.T) {
tests := []struct {
name string
input string
expected string
wantErr bool
}{
{
name: "valid input",
input: "test-project",
expected: "test-project",
wantErr: false,
},
{
name: "invalid input",
input: "invalid@project",
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result, err := FunctionName(tt.input)
if tt.wantErr {
testutil.AssertError(t, err, "")
return
}
testutil.AssertNoError(t, err)
testutil.AssertEqual(t, tt.expected, result)
})
}
}The project uses GitHub Actions for automated testing and quality assurance:
Runs on every push and pull request:
- Multi-version testing (Go 1.21, 1.22)
- Comprehensive test suite with race detection
- Cross-platform builds (Linux, macOS, Windows)
- Code linting with golangci-lint
- Security scanning with gosec and govulncheck
- Coverage reporting with Codecov integration
Ensures stability on supported Linux runners:
- Ubuntu testing
- Daily scheduled runs for regression detection
- Binary execution verification
Detailed test coverage analysis:
- Atomic coverage mode for accuracy
- HTML and text reports generation
- Coverage trend tracking
- PR coverage comments
Rich reporting in GitHub Actions:
- Test result summaries
- Coverage percentage display
- Markdown-formatted reports
All pull requests must pass:
- ✅ All tests (unit + integration)
- ✅ Linting checks (golangci-lint)
- ✅ Security scans (gosec, govulncheck)
- ✅ Linux builds
- ✅ Code coverage maintained or improved
Run the same checks locally before pushing:
# Full quality check suite
make quality
# Individual checks
make test # Run all tests
make test-coverage # Generate coverage
make lint # Code linting
make security # Security scanning
make fmt # Code formattingThe CI system automatically:
- Runs tests on multiple Go versions
- Builds binaries for all target platforms
- Scans for vulnerabilities in dependencies
- Checks code formatting and style
- Validates documentation changes
- Generates coverage reports
- Creates build artifacts
- Check the logs in GitHub Actions tab
- Run tests locally to reproduce the issue
- Fix the issue and push again
- Don't ignore CI failures - they indicate real problems
- Run tests locally before pushing
- Keep commits atomic and focused
- Write descriptive commit messages
- Update tests when changing functionality
- Check coverage to ensure new code is tested
Common CI issues and solutions:
# Reproduce locally
go test -v ./internal/package_name
# Check for race conditions (Linux)
go test -race ./...
# Run integration tests
go test -v ./test/integration# Run linter locally
make lint
# Auto-fix formatting issues
make fmt
# Check specific files
golangci-lint run ./internal/commands/# Generate local coverage report
make test-coverage
# View coverage by function
go tool cover -func=coverage.out
# Open HTML coverage report
open coverage.htmlcoderaft is designed to work on Linux, macOS, and Windows wherever Docker is available.
Platform Notes:
- Linux: Supports Debian, Ubuntu, Fedora, Arch, Alpine, and more
- macOS: Requires Docker Desktop for Mac
- Windows: Requires Docker Desktop for Windows
- Update documentation if needed
- Add tests for new functionality (unit and integration tests)
- Ensure all CI checks pass:
- ✅ Tests pass on all platforms
- ✅ Linting checks pass
- ✅ Security scans clear
- ✅ Builds succeed for all targets
- ✅ Coverage maintained or improved
- Update CHANGELOG.md if applicable
- Request review from maintainers
Before submitting your PR, run these commands locally:
# Run full test suite
make test
# Check code quality
make lint
# Verify security
make security
# Ensure proper formatting
make fmt
# Generate coverage report
make test-coverage- Title: Use a descriptive title following conventional commits
- Description:
- Explain what changes you made and why
- Reference any related issues
- Include screenshots for UI changes
- List any breaking changes
Your PR description should include:
## Description
Brief description of changes and motivation
## Type of Change
- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that causes existing functionality to change)
- [ ] Documentation update
- [ ] Test improvement
- [ ] Refactoring (no functional changes)
## Testing
- [ ] Unit tests pass locally (`go test ./internal/...`)
- [ ] Integration tests pass locally (`go test ./test/...`)
- [ ] Added unit tests for new functionality
- [ ] Added integration tests if applicable
- [ ] All CI checks pass (tests, linting, security)
- [ ] Coverage maintained or improved
## Code Quality
- [ ] Code follows Go formatting (`make fmt`)
- [ ] Linting passes (`make lint`)
- [ ] Security scans pass (`make security`)
- [ ] No race conditions (`go test -race ./...`)
## Documentation
- [ ] Updated relevant documentation
- [ ] Added code comments for complex logic
- [ ] Updated CHANGELOG.md if applicable
- [ ] README updated if needed
## Checklist
- [ ] Self-review completed
- [ ] No breaking changes (or clearly documented)
- [ ] Related issues referenced
- [ ] Screenshots included for UI changesWhen reporting bugs, please include:
- Clear title describing the issue
- Environment details:
- OS and version
- Go version
- Docker version
- coderaft version
- Steps to reproduce
- Expected behavior
- Actual behavior
- Error messages or logs
- Additional context
We welcome feature requests! Please:
- Check existing issues to avoid duplicates
- Describe the problem you're trying to solve
- Propose a solution if you have one
- Consider the scope - start small and iterate
- Be open to discussion about implementation
- API documentation: Inline code comments
- User guides: Markdown files in
docs/ - README updates: For setup and usage
- Changelog: Track notable changes
- Write clear, concise prose
- Include code examples
- Test all examples
- Keep documentation up-to-date with code changes (IMPORTANT)
- GitHub Issues: Bug reports, feature requests
- GitHub Discussions: General questions, ideas
- Pull Requests: Code review and discussion
- Check existing documentation
- Search GitHub issues
- Create a new issue with the
questionlabel - Join community discussions
By contributing to coderaft, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to coderaft! 🚀