feat: standards, shared CI and release tooling for NAPALM drivers
STANDARDS.md binds every repository in the NAPALM org: one default branch, Conventional Commits, the device-types contract, test-driven development, clean-code limits, a quality ratchet for existing code, packaging rules and releases by tag to PyPI. napalm-standard holds what a tool can check: the conformance check (with release rules on a tag), the quality ratchet (ported from netOrk's quality_ratchet.py), and the Gitea release from the CHANGELOG section. .gitea/workflows/driver.yml is the CI every driver calls; template/ is a new driver's starting point and passes the check as it is.
This commit is contained in:
commit
db6b2e4ea7
37 files changed
+2894
No files matched your search
@@ -0,0 +1,57 @@
|
||||
# driver-standard
|
||||
|
||||
The rules every driver in the `NAPALM` org follows, and the tools that hold them.
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| [STANDARDS.md](STANDARDS.md) | Repository usage, the contract, TDD, clean code, the quality ratchet, packaging, releases |
|
||||
| `.gitea/workflows/driver.yml` | The CI every driver calls: conformance, lint, types, tests, lowest versions, security, build, publish |
|
||||
| `napalm-standard` | The command line that CI runs: `check`, `ratchet`, `notes`, `release`, `package` |
|
||||
| [template/](template/) | A new driver's starting point; it meets the standard as it is |
|
||||
|
||||
## Using it in a driver
|
||||
|
||||
`.gitea/workflows/ci.yml`:
|
||||
|
||||
```yaml
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
driver:
|
||||
uses: NAPALM/driver-standard/.gitea/workflows/driver.yml@main
|
||||
with:
|
||||
standard-ref: main
|
||||
secrets:
|
||||
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
||||
```
|
||||
|
||||
Inputs: `pre-install` (pip specs installed first, e.g. a dependency not on PyPI
|
||||
yet), `python-versions` (JSON list), `pypi-url` (`https://test.pypi.org/legacy/`
|
||||
for a dry run), `standard-ref` (keep it equal to the `@ref` of the `uses:` line).
|
||||
|
||||
Locally:
|
||||
|
||||
```bash
|
||||
pip install "napalm-standard @ git+https://git.netork.io/NAPALM/driver-standard.git"
|
||||
napalm-standard check # does this repo meet the standard?
|
||||
napalm-standard ratchet # is it within its quality baseline?
|
||||
napalm-standard ratchet --write # record the baseline after an improvement
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
|
||||
.venv/bin/pytest
|
||||
.venv/bin/ruff format --check . && .venv/bin/ruff check . && .venv/bin/mypy napalm_standard
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Apache-2.0
|
||||
Reference in new issue
Block a user