From 3af7385b295056cc310984da8a3be57d0a369361 Mon Sep 17 00:00:00 2001 From: gerchowl Date: Sat, 18 Apr 2026 21:35:12 +0200 Subject: [PATCH] ci: tighten release pipeline + enforce conventional-commit format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three coordinated tightenings for the release pipeline post-3.0: 1. **Disable rs-materials in release-please** until crates.io publish enables (#43). While the publish path is gated behind `CRATES_IO_PUBLISH_ENABLED`, release-please tracking rs-materials produces only false-bump Release PRs (#50, #55) — every push to main re-opens them. Removing the package entry stops the inflation. Re-add when #43 lands, with `bump-minor-pre-major: true` to keep pre-1.0 versioning sane. 2. **Wire commitizen as commit-msg hook.** The .githooks/commit-msg script invoked `pre-commit run --hook-stage commit-msg` but no commit-msg-stage hooks were configured — the standard in docs/COMMIT_MESSAGE_STANDARD.md was documentation-only with zero enforcement. Add commitizen pinned to v4.13.9. Conventional-commit format is now validated at commit time. 3. **Document the scope taxonomy.** Multi-package monorepo benefits from per-package scopes: (py) — py-materials Python package (rs) — rs-materials Rust crate (data) — TOML data shared between py + rs (vis) — vis subsystem (Python, mat-vis-client integration) (deps) — dependency bumps (ci) — CI / release pipeline (docs) — documentation Documented in COMMIT_MESSAGE_STANDARD.md with rationale linking to the cross-cutting-bump issues (#50, #55). Scope membership is social convention; format is enforced by commitizen. Refs: #43 --- .pre-commit-config.yaml | 9 +++++++++ .release-please-manifest.json | 3 +-- docs/COMMIT_MESSAGE_STANDARD.md | 18 ++++++++++++++++++ pyproject.toml | 11 +++++++++++ release-please-config.json | 7 ------- 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 272b1d5..c94db36 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -83,6 +83,15 @@ repos: hooks: - id: typos + # Conventional-commit message validation. Runs at commit-msg stage so the + # message format (`type(scope)!: subject` + optional body + Refs) is + # checked before the commit lands. Spec lives in docs/COMMIT_MESSAGE_STANDARD.md. + - repo: https://github.com/commitizen-tools/commitizen + rev: 4fbeae7861663ecf4b4989211eba41c1a3fb1227 # v4.13.9 + hooks: + - id: commitizen + stages: [commit-msg] + # Generated README must match tests/test_readme_examples.py. # Drift blocks commit — regenerate with `python scripts/generate_readme.py`. # The script uses only stdlib (ast, re, textwrap), so `language: python` diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0eaa7b2..d4f6f29 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,4 +1,3 @@ { - ".": "3.0.0", - "mat-rs": "0.2.0" + ".": "3.0.0" } diff --git a/docs/COMMIT_MESSAGE_STANDARD.md b/docs/COMMIT_MESSAGE_STANDARD.md index b715234..2e4e4c5 100644 --- a/docs/COMMIT_MESSAGE_STANDARD.md +++ b/docs/COMMIT_MESSAGE_STANDARD.md @@ -48,6 +48,24 @@ Only the following types are allowed: Any other type (e.g. `feature`, `bugfix`, or emoji-based prefixes) is **not** allowed. +## Approved scopes + +The `(scope)` is **optional** but recommended in this multi-package monorepo. A correctly-attributed scope makes Release PR review faster, prevents cross-cutting commits from triggering false bumps in unrelated packages (see [#50](https://github.com/MorePET/mat/issues/50), [#55](https://github.com/MorePET/mat/issues/55)), and makes the CHANGELOG self-documenting. + +| Scope | Meaning | Example | +|-------|---------|---------| +| `(py)` | py-materials Python package code | `feat(py): add Material.melting_point_qty` | +| `(rs)` | rs-materials Rust crate code | `feat(rs)!: rename MaterialDb to Catalog` | +| `(data)` | TOML data files (shared between py + rs via symlinks) | `fix(data): correct stainless density to 8.0 g/cm³` | +| `(vis)` | The vis subsystem (Python-side, mat-vis-client integration) | `feat(vis): expose .mtlx() façade` | +| `(deps)` | Dependency bumps (typically from dependabot) | `build(deps): bump mat-vis-client to 0.5.0` | +| `(ci)` | CI workflows, release pipeline, automation | `ci: gate crates.io publish on repo var` | +| `(docs)` | Documentation only | `docs(migration): add v3-to-v4 stub` | + +**No scope** is acceptable for cross-cutting work that genuinely touches multiple packages — but **prefer splitting into per-scope commits** when possible. Squash-merging a multi-scope PR collapses these distinctions and can mislead release tooling (the rationale documented in [issue #50](https://github.com/MorePET/mat/issues/50)). + +Scopes are validated for *format* (alphanumeric + hyphens) by the commit-msg hook (commitizen), not for *membership* in the table above — the table is a strong convention enforced socially via review. + ## Refs line and traceability The `Refs:` line provides mandatory traceability to issues, requirements, risks, or SOPs. Only one `Refs:` line is allowed; it must be the last non-empty line of the message. diff --git a/pyproject.toml b/pyproject.toml index c729522..8e7bc43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,6 +76,17 @@ target-version = "py311" [tool.ruff.lint] select = ["E", "F", "W", "I"] +# Commitizen — conventional-commit message validation at commit-msg stage +# (configured via .pre-commit-config.yaml). Using the default +# `cz_conventional_commits` rule set; the project's allowed types and the +# scope taxonomy are documented in docs/COMMIT_MESSAGE_STANDARD.md and +# enforced socially via review (commitizen permits any scope by default). +[tool.commitizen] +name = "cz_conventional_commits" +version = "3.0.0" +tag_format = "v$version" +update_changelog_on_bump = false + [dependency-groups] dev = [ "ruff>=0.15.10", diff --git a/release-please-config.json b/release-please-config.json index fb99ed5..1138472 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -26,13 +26,6 @@ "path": "src/pymat/__init__.py" } ] - }, - "mat-rs": { - "release-type": "rust", - "package-name": "rs-materials", - "component": "rs-materials", - "include-component-in-tag": true, - "tag-separator": "/" } } }