|
1 | 1 | # commit-guardian |
| 2 | + |
| 3 | +Tiny, fast starter for **Always‑Green** Python repositories: a clean package skeleton with |
| 4 | +local gates (**ruff, black, pytest, mypy**) and GitHub Actions (**Linux + optional Windows**) wired |
| 5 | +as required checks, plus CodeQL. It keeps your default branch green and your PRs friction‑free. |
| 6 | + |
| 7 | +[](https://github.com/CoderDeltaLAN/commit-guardian/actions/workflows/ci.yml) |
| 8 | +[](https://github.com/CoderDeltaLAN/commit-guardian/actions/workflows/codeql.yml) |
| 9 | +[](LICENSE) |
| 10 | +[](https://www.paypal.com/donate/?hosted_button_id=YVENCBNCZWVPW) |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +## Why |
| 17 | + |
| 18 | +Green builds are non‑negotiable. This repo shows a compact, reproducible setup that |
| 19 | +mirrors CI locally and gates PRs with the exact same checks. You get reliable signals, |
| 20 | +clean history, and painless reviews. |
| 21 | + |
| 22 | +## What It Includes |
| 23 | + |
| 24 | +- **Package skeleton** under `src/commit_guardian`, versioned and importable. |
| 25 | +- **Static quality gates**: `ruff`, `black`, `pytest`, and `mypy`. |
| 26 | +- **GitHub Actions CI**: Linux matrix (3.11, 3.12) and **optional** Windows job. |
| 27 | +- **CodeQL security** analysis. |
| 28 | +- **Branch protection friendly** job names designed for required checks. |
| 29 | + |
| 30 | +## How It Works |
| 31 | + |
| 32 | +1. Run the local gate before pushing (same tools and configuration as CI). |
| 33 | +2. Open a pull request; CI and CodeQL run automatically. |
| 34 | +3. With required checks enabled, the PR can **auto‑merge** when everything is green. |
| 35 | + |
| 36 | +## Installation (from source) |
| 37 | + |
| 38 | +```bash |
| 39 | +# inside project root |
| 40 | +pip install . |
| 41 | +# or with Poetry |
| 42 | +poetry build && pip install dist/*.whl |
| 43 | +``` |
| 44 | + |
| 45 | +> The package exports a minimal API you can import to verify installation. |
| 46 | +
|
| 47 | +## Quick Start |
| 48 | + |
| 49 | +```bash |
| 50 | +# lint + format checks |
| 51 | +poetry run ruff check . |
| 52 | +poetry run black --check . |
| 53 | + |
| 54 | +# run tests and types |
| 55 | +PYTHONPATH=src poetry run pytest -q |
| 56 | +poetry run mypy . |
| 57 | +``` |
| 58 | + |
| 59 | +Python import sanity: |
| 60 | + |
| 61 | +```bash |
| 62 | +python - <<'PY' |
| 63 | +import importlib; m = importlib.import_module("commit_guardian") |
| 64 | +print("import OK:", getattr(m, "__version__", "unknown")) |
| 65 | +PY |
| 66 | +``` |
| 67 | + |
| 68 | +## Local Developer Workflow |
| 69 | + |
| 70 | +1. Create a branch. |
| 71 | +2. Run the **local gate** (commands above). Fix until green. |
| 72 | +3. Push and open a PR. Enable auto‑merge if your repository policy allows. |
| 73 | +4. Keep commits **small and atomic**; use **Conventional Commits** for clarity. |
| 74 | + |
| 75 | +## CLI / API |
| 76 | + |
| 77 | +This template ships a tiny module and CLI entry point stub. Typical usage is |
| 78 | +to import in tests or expand with your own commands. |
| 79 | + |
| 80 | +```python |
| 81 | +from commit_guardian import __version__, ping |
| 82 | +assert callable(ping) |
| 83 | +``` |
| 84 | + |
| 85 | +```bash |
| 86 | +# if you add a console_script entry point, expose CLI here |
| 87 | +# commit-guardian --help |
| 88 | +``` |
| 89 | + |
| 90 | +## CI (GitHub Actions) |
| 91 | + |
| 92 | +- Linux matrix on Python **3.11** and **3.12**. |
| 93 | +- Windows job marked **optional** to avoid blocking merges on OS‑specific glitches. |
| 94 | +- All CI steps mirror the local gate to prevent “works‑on‑my‑machine” surprises. |
| 95 | + |
| 96 | +Snippet used in CI: |
| 97 | + |
| 98 | +```yaml |
| 99 | +- run: python -m pip install -U pip |
| 100 | +- run: pip install ruff black pytest mypy |
| 101 | +- run: ruff check . |
| 102 | +- run: black --check . |
| 103 | +- run: pytest -q |
| 104 | +- run: mypy . |
| 105 | +``` |
| 106 | +
|
| 107 | +## Project Status & Roadmap |
| 108 | +
|
| 109 | +- ✅ Clean packaging and import sanity. |
| 110 | +- ✅ Always‑Green CI with required checks and CodeQL. |
| 111 | +- 🚧 Extend CLI, add real commands and richer examples. |
| 112 | +- 🚧 Optional job fan‑out (e.g., wheels, coverage upload). |
| 113 | +
|
| 114 | +## Security |
| 115 | +
|
| 116 | +If you discover a security issue, please report it privately. Avoid filing public issues |
| 117 | +with sensitive details. A basic CodeQL workflow is already enabled. |
| 118 | +
|
| 119 | +## Contributing |
| 120 | +
|
| 121 | +Use **Poetry** locally and keep PRs small: |
| 122 | +```bash |
| 123 | +poetry install --no-interaction |
| 124 | +poetry run ruff check . --fix |
| 125 | +poetry run ruff format . |
| 126 | +poetry run black . |
| 127 | +PYTHONPATH=src poetry run pytest -q |
| 128 | +poetry run mypy . |
| 129 | +``` |
| 130 | + |
| 131 | +--- |
| 132 | + |
| 133 | +## 🔍 SEO Keywords |
| 134 | + |
| 135 | +always green ci, python package template, ruff black pytest mymy, github actions python, |
| 136 | +code quality automation, codeql security scan, branch protection, required status checks, |
| 137 | +clean code workflow, python project skeleton |
| 138 | + |
| 139 | +## 💖 Donations & Sponsorship |
| 140 | + |
| 141 | +Open‑source takes time. If this template saves you hours, consider supporting continued |
| 142 | +maintenance and polish. Thank you! |
| 143 | +[](https://www.paypal.com/donate/?hosted_button_id=YVENCBNCZWVPW) |
| 144 | + |
| 145 | +## 👤 Author |
| 146 | + |
| 147 | +**CoderDeltaLAN (Yosvel)** |
| 148 | + |
| 149 | +GitHub: https://github.com/CoderDeltaLAN |
| 150 | + |
| 151 | +## 📄 License |
| 152 | + |
| 153 | +Released under the **MIT License**. See the bundled `LICENSE` file for details. |
0 commit comments