diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..bf5b78d --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,37 @@ +## Summary + + +## Changes + +- +- +- + +## Type of Change + +- [ ] New feature (non-breaking change adding functionality) +- [ ] Bug fix (non-breaking change fixing an issue) +- [ ] Breaking change (fix or feature causing existing functionality to change) +- [ ] Documentation update +- [ ] Performance improvement +- [ ] Security patch +- [ ] Refactoring + +## Testing + + +## Screenshots (if applicable) + + +## Checklist +- [ ] Code follows project style guidelines +- [ ] Self-review completed +- [ ] Comments added for complex logic +- [ ] Documentation updated +- [ ] No new warnings introduced +- [ ] Tests added/updated and passing +- [ ] All CI checks pass + +## Related Issues + + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1701ea5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,88 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + name: Test on Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run linting with ruff + run: | + ruff check autorca_core + + - name: Check code formatting with black + run: | + black --check autorca_core + + - name: Run type checking with mypy + run: | + mypy autorca_core || true + + - name: Run tests with coverage + run: | + pytest --cov=autorca_core --cov-report=xml --cov-report=term + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + if: matrix.python-version == '3.12' + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + flags: unittests + name: codecov-umbrella + fail_ci_if_error: false + + lint: + name: Code Quality Checks + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run ruff linter + run: | + ruff check --output-format=github autorca_core + + - name: Check formatting + run: | + black --check --diff autorca_core + + - name: Check import sorting (if isort configured) + run: | + pip install isort + isort --check-only --diff autorca_core || true + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..aa3c654 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: Release + +on: + push: + tags: + - 'v*.*.*' + +permissions: + contents: write + +jobs: + release: + name: Create Release + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Build package + run: python -m build + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + files: dist/* + generate_release_notes: true + draft: false + prerelease: false + + - name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags/v') + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + twine upload dist/* || echo "PyPI upload failed or already exists" + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..6842ff5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,180 @@ +# Contributing to AutoRCA-Core + +Thank you for your interest in contributing to AutoRCA-Core! This document provides guidelines and instructions for contributing. + +## Development Setup + +### Prerequisites + +- Python 3.10 or higher +- Git +- pip + +### Setting Up Your Development Environment + +1. **Fork and clone the repository** + +```bash +git clone https://github.com/nik-kale/AutoRCA-Core.git +cd AutoRCA-Core +``` + +2. **Create a virtual environment** + +```bash +python -m venv venv +source venv/bin/activate # On Windows: venv\Scripts\activate +``` + +3. **Install development dependencies** + +```bash +pip install -e ".[dev]" +``` + +4. **Verify installation** + +```bash +autorca --help +pytest +``` + +## Development Workflow + +### Creating a Feature Branch + +```bash +git checkout -b / +``` + +Branch types: +- `feat/` - New features +- `fix/` - Bug fixes +- `docs/` - Documentation changes +- `refactor/` - Code refactoring +- `perf/` - Performance improvements +- `test/` - Test additions/updates +- `chore/` - Maintenance tasks + +### Making Changes + +1. **Write clean, well-documented code** + - Follow PEP 8 style guidelines + - Add docstrings to functions and classes + - Comment complex logic + +2. **Add tests** + - Unit tests for new functionality + - Integration tests for complex features + - Maintain or improve test coverage + +3. **Run quality checks** + +```bash +# Format code +black autorca_core + +# Check linting +ruff check autorca_core + +# Run type checking +mypy autorca_core + +# Run tests +pytest --cov=autorca_core +``` + +### Committing Changes + +Use conventional commit messages: + +``` +: + +[optional body] +``` + +Examples: +- `feat: add Anthropic Claude LLM integration` +- `fix: resolve glob pattern bug in file loading` +- `docs: update README with installation instructions` + +### Submitting a Pull Request + +1. **Push your branch** + +```bash +git push origin / +``` + +2. **Create a Pull Request** + - Use the PR template provided + - Fill out all sections completely + - Link related issues + - Ensure all CI checks pass + +3. **Address review feedback** + - Respond to all comments + - Make requested changes + - Re-request review when ready + +## Code Quality Standards + +### Style Guidelines + +- **Line length**: 100 characters max +- **Imports**: Standard library → third-party → local, alphabetically sorted +- **Type hints**: Use where helpful, especially for public APIs +- **Docstrings**: Google-style format + +### Testing Guidelines + +- **Coverage**: Aim for >80% test coverage +- **Test naming**: `test__` +- **Assertions**: Use descriptive messages +- **Fixtures**: Reuse common test data + +### Documentation Guidelines + +- **README**: Keep up-to-date with examples +- **Docstrings**: Explain purpose, args, returns, raises +- **Comments**: Explain "why", not "what" +- **Examples**: Provide working code samples + +## Project Structure + +``` +AutoRCA-Core/ +├── autorca_core/ # Main package +│ ├── cli/ # Command-line interface +│ ├── ingestion/ # Data loading +│ ├── model/ # Data models +│ ├── graph_engine/ # Graph construction +│ ├── reasoning/ # RCA logic +│ └── outputs/ # Report generation +├── tests/ # Test suite +├── examples/ # Example data and scripts +└── docs/ # Documentation +``` + +## Getting Help + +- **Issues**: [GitHub Issues](https://github.com/nik-kale/AutoRCA-Core/issues) +- **Discussions**: [GitHub Discussions](https://github.com/nik-kale/AutoRCA-Core/discussions) +- **Email**: nik@example.com + +## Code of Conduct + +- Be respectful and inclusive +- Welcome newcomers and help them learn +- Focus on constructive feedback +- Assume good intentions + +## License + +By contributing, you agree that your contributions will be licensed under the MIT License. + +--- + +Thank you for contributing to AutoRCA-Core! 🚀 +