Contributing to GoliteFlow
Thank you for your interest in contributing to GoliteFlow! This document provides guidelines and information for contributors.
๐ Table of Contents
- Getting Started
- Development Setup
- Contributing Process
- Code Style Guidelines
- Testing Guidelines
- Documentation Guidelines
- Release Process
Getting Started
Prerequisites
- Go 1.19 or later
- Git
- Basic understanding of Go development
- Familiarity with YAML and workflow orchestration
Development Setup
-
Fork the Repository
# Fork on GitHub, then clone your fork git clone https://github.com/YOUR_USERNAME/goliteflow.git cd goliteflow
-
Add Upstream Remote
git remote add upstream https://github.com/sintakaridina/goliteflow.git
-
Install Dependencies
go mod tidy
-
Verify Setup
go test ./... go build ./cmd/goliteflow
Contributing Process
1. Create a Feature Branch
# Make sure you're on main and up to date
git checkout main
git pull upstream main
# Create your feature branch
git checkout -b feature/your-feature-name
2. Make Your Changes
- Write clean, idiomatic Go code
- Follow existing code style and patterns
- Add comprehensive tests
- Update documentation as needed
3. Test Your Changes
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run specific package tests
go test ./internal/parser
# Format your code
go fmt ./...
# Lint your code
go vet ./...
# Build to ensure everything compiles
go build ./cmd/goliteflow
4. Commit Your Changes
# Stage your changes
git add .
# Commit with a descriptive message
git commit -m "feat: add new workflow validation feature
- Add validation for workflow dependencies
- Include comprehensive test coverage
- Update documentation with examples"
5. Push and Create Pull Request
# Push your branch
git push origin feature/your-feature-name
# Create a Pull Request on GitHub
๐ Commit Message Guidelines
We follow the Conventional Commits specification:
Format
<type>[optional 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(parser): add support for custom task timeouts
fix(executor): resolve memory leak in task runner
docs: update README with new examples
test(scheduler): add tests for cron validation
Testing Guidelines
Test Requirements
- Unit Tests: All new functionality must have unit tests
- Integration Tests: Test component interactions
- Edge Cases: Test error conditions and edge cases
- Coverage: Maintain or improve test coverage
Test Structure
func TestFunctionName(t *testing.T) {
tests := []struct {
name string
input InputType
expected ExpectedType
wantErr bool
}{
{
name: "valid input",
input: validInput,
expected: expectedOutput,
wantErr: false,
},
{
name: "invalid input",
input: invalidInput,
expected: nil,
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result, err := FunctionName(tt.input)
if (err != nil) != tt.wantErr {
t.Errorf("FunctionName() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(result, tt.expected) {
t.Errorf("FunctionName() = %v, want %v", result, tt.expected)
}
})
}
}
Test Data
- Use
testdata/
directory for test configuration files - Keep test data minimal and focused
- Include both valid and invalid test cases
Code Style Guidelines
Go Code Style
- Follow Effective Go guidelines
- Use
gofmt
for formatting - Use
golint
for style checking - Keep functions small and focused
- Use meaningful variable and function names
Documentation
- Add comments for all exported functions, types, and variables
- Use complete sentences in comments
- Include examples for complex functions
- Update README.md for user-facing changes
Error Handling
// Good
if err != nil {
return fmt.Errorf("failed to parse config: %w", err)
}
// Avoid
if err != nil {
return err
}
Logging
// Use structured logging
logger.Info("workflow started", "workflow", workflowName, "tasks", len(tasks))
// Avoid
logger.Info("workflow started")
๐ Documentation Guidelines
README Updates
When adding new features:
- Update the feature list
- Add usage examples
- Update installation instructions if needed
- Add new configuration options
API Documentation
- Document all exported functions and types
- Include parameter descriptions
- Provide usage examples
- Update API reference when adding new functions
Examples
- Add examples for new features
- Update existing examples if behavior changes
- Include both simple and complex examples
- Test all examples before submitting
Bug Reports
Before Submitting
- Check existing issues to avoid duplicates
- Try to reproduce the issue
- Gather relevant information (OS, Go version, etc.)
Bug Report Template
**Bug Description**
A clear description of the bug.
**Steps to Reproduce**
1. Go to '...'
2. Run command '...'
3. See error
**Expected Behavior**
What you expected to happen.
**Actual Behavior**
What actually happened.
**Environment**
- OS: [e.g., Windows 10, macOS 12, Ubuntu 20.04]
- Go Version: [e.g., 1.19.3]
- GoliteFlow Version: [e.g., v1.0.0]
**Additional Context**
Any other relevant information.
Feature Requests
Before Submitting
- Check existing feature requests
- Consider if the feature aligns with project goals
- Think about implementation complexity
Feature Request Template
**Feature Description**
A clear description of the feature.
**Use Case**
Why is this feature needed? What problem does it solve?
**Proposed Solution**
How would you like this feature to work?
**Alternatives Considered**
Other solutions you've considered.
**Additional Context**
Any other relevant information.
Code Review Process
For Contributors
- Self-Review: Review your own code before submitting
- Address Feedback: Respond to reviewer comments promptly
- Update Tests: Add tests for any new functionality
- Update Documentation: Keep docs in sync with code changes
For Reviewers
- Be Constructive: Provide helpful, specific feedback
- Test Changes: Run tests and verify functionality
- Check Style: Ensure code follows project guidelines
- Approve Promptly: Donโt let PRs sit without review
Pull Request Guidelines
PR Template
## Description
Brief description of changes.
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tests pass locally
- [ ] New tests added for new functionality
- [ ] Manual testing completed
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes (or clearly documented)
PR Requirements
- Title: Clear, descriptive title
- Description: Detailed description of changes
- Tests: All tests must pass
- Documentation: Update docs for user-facing changes
- Breaking Changes: Clearly document any breaking changes
Release Process
Version Numbering
We follow Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
Release Checklist
- All tests pass
- Documentation updated
- CHANGELOG.md updated
- Version bumped in go.mod
- Release notes prepared
- GitHub release created
Community Guidelines
Be Respectful
- Use welcoming and inclusive language
- Be respectful of differing viewpoints
- Accept constructive criticism gracefully
- Focus on whatโs best for the community
Be Collaborative
- Help others when you can
- Share knowledge and experience
- Be patient with newcomers
- Work together toward common goals
Getting Help
- GitHub Issues: For bugs and feature requests
- GitHub Discussions: For questions and general discussion
- Code Review: Ask questions in PR comments
Recognition
Contributors will be recognized in:
- CONTRIBUTORS.md file
- Release notes
- Project documentation