- Go 1.25+
- Docker and Docker Compose
- Git
- Recommended: direnv for automatic environment setup
- Clone the repository:
git clone https://github.com/netresearch/ofelia.git
cd ofelia- Recommended: Install direnv for automatic environment setup:
# Install direnv (see https://direnv.net/docs/installation.html)
# macOS: brew install direnv
# Ubuntu: sudo apt install direnv
# Then add to your shell config (.bashrc, .zshrc, etc.):
eval "$(direnv hook bash)" # or zsh, fish, etc.
# Allow the .envrc file
direnv allowThe .envrc file automatically:
- ✅ Verifies Go 1.25+ installation
- ✅ Checks required tools (golangci-lint, gosec, docker)
- ✅ Enforces Git hooks setup - prevents commits without hooks
- ✅ Sets up development aliases and environment variables
- ✅ Provides auto-install option for Git hooks
- Install Git hooks for linting enforcement (if not using direnv auto-install):
make setup
# or
./scripts/install-hooks.sh # legacy wrapperThis installs lefthook (Go-native git hooks) with fast parallel execution (~4-6s typical), automatically running all linters before each commit to ensure code quality and consistency with the CI pipeline.
The project uses lefthook (Go-native) for fast, parallel git hooks to enforce code quality standards and development workflow best practices.
Runs automatically before each commit (~4-6s with parallel execution):
- go mod tidy - Dependency hygiene check
- go vet - Static analysis for common Go programming errors
- gofmt - Go code formatting validation
- golangci-lint - Comprehensive linting with 45+ enabled rules
- golangci-lint (extra) - Additional quality linters (gci, wrapcheck, etc.)
- gosec - Security vulnerability scanning
- Secret detection - Prevents hardcoded credentials in code files
Validates commit message format:
- Minimum length - At least 10 characters required
- Conventional commits - Recommends
type(scope): messageformat- Types:
feat,fix,docs,style,refactor,test,chore,perf,ci,build,revert - Example:
feat(core): add new scheduler algorithm
- Types:
- WIP protection - Blocks WIP commits to main/master branches
Runs before pushing to remote (~10-30s depending on test suite):
- Full test suite - Runs all tests with race detection (
go test -race ./...) - Protected branches - Warns when pushing to main/master/production
- Quick lint - Fast go vet check on changed files
Runs after checking out a branch:
- Dependency changes - Reminds to run
go mod downloadif go.mod changed - Hook installation - Reminds to run
make setupif hooks not installed
Runs after merging branches:
- Dependency updates - Automatically runs
go mod downloadif dependencies changed - Build reminder - Suggests running tests after dependency updates
Configuration: All hooks are defined in lefthook.yml in the project root.
Performance: Pre-commit hooks use parallel execution (~4-6s), pre-push includes full test suite (~10-30s).
These hooks mirror the GitHub CI pipeline, ensuring consistency between local development and CI/CD.
# Show all available commands
make help
# Build the binary
make build
# Build cross-platform binaries
make packages
# Build Docker image
make docker-build
# Build and run Docker container
make docker-run# Run all tests
make test
# Run tests with race detection
make test-race
# Run benchmark tests
make test-benchmark
# Generate coverage report
make test-coverage
# Generate HTML coverage report (opens in browser)
make test-coverage-html
# Continuously run tests (requires 'watch' command)
make test-watchCurrent test coverage: 60.1% (target: 60%+ maintained)
The project maintains high code quality through:
- Comprehensive linting: 45+ golangci-lint rules enabled
- Security scanning: gosec integration for vulnerability detection
- Test coverage: Maintained above 60%
- Pre-commit hooks: Automatic quality enforcement
All code must pass the comprehensive quality checks:
# Show all available commands
make help
# Complete development workflow
make dev-setup # Set up development environment
make dev-check # Run all development checks
make precommit # Pre-commit validation
# Individual quality checks
make fmt # Format Go code
make fmt-check # Check if code is formatted
make vet # Run go vet
make lint # Run golangci-lint
make lint-fix # Run golangci-lint with auto-fix
make lint-full # Complete linting suite (matches CI)
make gci-fix # Fix import grouping/formatting
make security-check # Run gosec security analysis
make tidy # Tidy Go modules- Create a feature branch:
git checkout -b feature/your-feature - Make your changes following existing code patterns
- Ensure tests pass:
make test - Ensure linters pass:
make lint(or rely on pre-commit hook) - Create a pull request
Quality Enforcement:
- The pre-commit hook automatically prevents commits that don't meet quality standards
.envrc(direnv) enforces proper development environment setup- CI/CD pipeline mirrors local linting for consistency
Development Workflow Tips:
- Use
gci-fixalias to fix import formatting quickly - Use
lint-fixalias to auto-fix many linting issues - Use
test-coveragealias to generate HTML coverage reports - The
.envrcprovides immediate feedback on environment issues
- Core: Job execution engine and scheduling
- CLI: Configuration management and command interface
- Web: HTTP API and web interface
- Config: Input validation and sanitization
- Metrics: Prometheus monitoring integration
- Logging: Structured logging with context
See Project Index for detailed architecture documentation.