This guide explains how to contribute to the Climate project, from setting up your development environment to getting your changes merged.
- Development Setup
- Development Workflow
- Branch Naming
- Commit Guidelines
- Pull Request Process
- CI/CD Pipeline
- Release Process
- Python 3.10 or higher
- Node.js 18 or higher
- Docker and Docker Compose
- Git
-
Clone the repository:
git clone https://github.com/Jss-on/climagent.git cd climate
-
Set up frontend:
cd web-frontend npm install
-
Set up backend:
cd backend python -m venv venv source venv/bin/activate # On Windows: .\venv\Scripts\activate pip install -r requirements.txt
-
Set up pre-commit hooks:
pip install pre-commit pre-commit install
a. Update your local main branches:
git checkout alpha
git pull origin alpha
b. Create a feature branch:
git checkout -b feature/your-feature-name
a. Keep your branch up to date:
git checkout alpha
git pull origin alpha
git checkout feature/your-feature-name
git rebase alpha
b. Run local tests:
# Frontend
cd web-frontend
npm run lint
npm test
# Backend
cd backend
flake8
pytest
c. Commit your changes:
git add .
git commit -m "feat: your descriptive commit message"
a. Ensure your branch is up to date:
git checkout alpha
git pull origin alpha
git checkout feature/your-feature-name
git rebase alpha
b. Run all checks:
# Frontend
cd web-frontend
npm run lint
npm test
# Backend
cd backend
flake8
pytest
c. Push your changes:
git push origin feature/your-feature-name
Follow these patterns for branch names:
- Features:
feature/descriptive-name
- Bug fixes:
fix/issue-description
- Hotfixes:
hotfix/critical-issue
- Releases:
release/vX.Y.Z
Examples:
feature/user-authentication
fix/login-validation
hotfix/security-vulnerability
release/v1.2.0
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(auth): add user authentication system
fix(ui): correct button alignment in dashboard
docs: update API documentation
-
Create Pull Request
- Create PR from your feature branch to
alpha
- Fill out the PR template completely
- Link related issues
- Create PR from your feature branch to
-
PR Title Format
type(scope): description
Example:
feat(auth): implement OAuth2 authentication
-
PR Description
- Describe the changes
- List any breaking changes
- Include testing instructions
- Add screenshots for UI changes
-
Review Process
- Address reviewer comments
- Keep the PR updated with the target branch
- Ensure all checks pass
-
Merging
- Squash and merge to keep history clean
- Delete the feature branch after merging
Our pipeline runs these checks:
-
On Push to Feature Branch
- Linting
- Unit tests
- Build check
-
On PR to Alpha
- All above checks
- Integration tests
- Version bump check
-
On Merge to Alpha
- All above checks
- Staging deployment
- Version bump (alpha)
-
On PR to Prod
- All above checks
- Production readiness check
-
On Merge to Prod
- All above checks
- Version bump (release)
- Production deployment
a. Create release branch:
git checkout alpha
git pull origin alpha
git checkout -b release/vX.Y.Z
b. Update version:
./scripts/version.sh bump minor release/vX.Y.Z
git add version.txt CHANGELOG.md
git commit -m "chore: bump version to vX.Y.Z"
git push origin release/vX.Y.Z
c. Create PR to prod branch
a. Create hotfix branch from prod:
git checkout prod
git pull origin prod
git checkout -b hotfix/issue-description
b. Fix the issue and update version:
./scripts/version.sh bump patch hotfix/issue-description
git add version.txt CHANGELOG.md
git commit -m "fix: critical issue description"
git push origin hotfix/issue-description
c. Create PR to prod branch