CI/CD Pipeline¶
Continuous integration and deployment setup.
GitHub Actions Workflow¶
Location: .github/workflows/ci.yml
Jobs¶
1. Test Job¶
Runs on multiple platforms and Python versions:
- Platforms: Ubuntu, Windows, macOS
- Python: 3.8, 3.9, 3.10, 3.11, 3.12
Steps:
- Checkout code
- Setup Python with pip cache
- Install dependencies
- Run unit tests with coverage
- Run quick training test
- Upload coverage to Codecov
2. Lint Job¶
Code quality checks:
- Black: Code formatting
- isort: Import sorting
- flake8: Linting
- mypy: Type checking (continue-on-error)
3. Integration Job¶
Integration tests:
- Full integration test suite
- Experiment script validation
4. Documentation Job¶
Build documentation:
- Sphinx HTML build
- Check for broken links
5. Package Job¶
Build and validate package:
- Build wheel and source distribution
- Check with twine
- Upload artifacts
6. Notification Job¶
Final status check:
- ✅ All checks passed
- ❌ Some checks failed
Running CI Locally¶
Quick Test¶
# Run what CI runs
pytest tests/unit/ -v --cov=src/ga_trees
black --check src/ tests/ scripts/
isort --check-only src/ tests/ scripts/
flake8 src/ tests/ scripts/
Full CI Simulation¶
# Install dev dependencies
pip install -e .[dev]
# Run all checks
pytest tests/ -v --cov=src/ga_trees --cov-report=html
black src/ tests/ scripts/
isort src/ tests/ scripts/
flake8 src/ tests/
mypy src/
Pre-commit Hooks¶
Setup:
Hooks run automatically on commit:
- Trailing whitespace removal
- End-of-file fixer
- YAML validation
- Black formatting
- isort import sorting
- flake8 linting
- mypy type checking
Manual run:
Code Coverage¶
Target: 80%+ coverage
Generate report: