Skip to content

Commit 4f0fc80

Browse files
committed
chore: adopt trunk-based development with tbdflow
Adds .tbdflow.yml, .dod.yml, a Commit lint CI check, and workflow docs.
1 parent dba31f5 commit 4f0fc80

4 files changed

Lines changed: 160 additions & 9 deletions

File tree

.dod.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Definition of Done, shown by `tbdflow commit` before each commit.
2+
checklist:
3+
- "`dart format .` produces no changes."
4+
- "`dart analyze` reports no issues."
5+
- "`dart test` passes."
6+
- "New behaviour is covered by tests (golden vectors for codec changes)."
7+
- "CHANGELOG.md is updated for user-visible changes."
8+
- "The package still conforms to the firechip/cobs-conformance vectors."

.github/workflows/commit-lint.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Commit lint
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
conventional-commits:
12+
name: Conventional Commits
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
- name: Check commit subjects follow Conventional Commits
19+
env:
20+
BASE: ${{ github.event.pull_request.base.sha }}
21+
HEAD: ${{ github.event.pull_request.head.sha }}
22+
run: |
23+
types='build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test'
24+
pattern="^(${types})(\([a-z0-9._/-]+\))?!?: .+"
25+
fail=0
26+
for sha in $(git rev-list --no-merges "$BASE..$HEAD"); do
27+
subject=$(git log -1 --format=%s "$sha")
28+
if printf '%s' "$subject" | grep -qE "$pattern"; then
29+
echo "ok: $subject"
30+
else
31+
echo "::error::Not a Conventional Commit: $subject"
32+
fail=1
33+
fi
34+
done
35+
if [ "$fail" -ne 0 ]; then
36+
echo "Commit subjects must be Conventional Commits: type(scope): subject"
37+
echo "Allowed types: ${types//|/, }"
38+
exit 1
39+
fi

.tbdflow.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
main_branch_name: main
2+
release_url_template: https://github.com/firechip/cobs_codec/releases/tag/{{version}}
3+
stale_branch_threshold_days: 1
4+
monorepo:
5+
enabled: false
6+
project_dirs: []
7+
issue_handling:
8+
strategy: branch-name
9+
review:
10+
enabled: false
11+
default_reviewers: []
12+
strategy: github-issue
13+
workflow: null
14+
rules: []
15+
labels:
16+
pending: review-pending
17+
concern: review-concern
18+
accepted: review-accepted
19+
dismissed: review-dismissed
20+
concern_blocks_status: false
21+
radar:
22+
enabled: false
23+
level: file
24+
on_sync: true
25+
on_commit: off
26+
ignore_patterns:
27+
- '*.lock'
28+
- '*-lock.*'
29+
- CHANGELOG.md
30+
ci_check:
31+
enabled: false
32+
branch_types:
33+
fix: fix/
34+
refactor: refactor/
35+
feature: feature_
36+
ci: ci/
37+
release: release_
38+
docs: docs/
39+
chore: chore/
40+
feat: feat/
41+
automatic_tags:
42+
release_prefix: v
43+
lint:
44+
conventional_commit_type:
45+
enabled: true
46+
allowed_types:
47+
- build
48+
- chore
49+
- ci
50+
- docs
51+
- feat
52+
- fix
53+
- perf
54+
- refactor
55+
- revert
56+
- style
57+
- test
58+
issue_key_missing:
59+
enabled: false
60+
pattern: ^[A-Z]+-\d+$
61+
scope:
62+
enabled: true
63+
enforce_lowercase: true
64+
subject_line_rules:
65+
max_length: 72
66+
enforce_lowercase: true
67+
no_period: true
68+
body_line_rules:
69+
max_line_length: 80
70+
leading_blank: true

CONTRIBUTING.md

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,49 @@ non-negotiable:
6262
- Keep the public surface minimal; add internal code under `lib/src/` and export
6363
deliberately from `lib/cobs_codec.dart`.
6464

65-
## Commits and pull requests
66-
67-
- Write clear, imperative commit messages (e.g. "Fix decoder backpressure on
68-
delimiter-less runs").
69-
- Commits and tags in this repository are **SSH-signed**; please sign your
70-
commits (`git config gpg.format ssh` and set `user.signingkey`) and include a
71-
sign-off (`git commit -s`) certifying the [DCO](https://developercertificate.org/).
72-
- Keep pull requests focused; update `CHANGELOG.md` under an `## Unreleased`
73-
heading for user-visible changes.
65+
## Git workflow: Trunk-Based Development with tbdflow
66+
67+
This project uses [Trunk-Based Development](https://trunkbaseddevelopment.com/):
68+
small, frequent changes integrated into `main` (the trunk) rather than
69+
long-lived branches. We use the [`tbdflow`](https://github.com/cladam/tbdflow)
70+
CLI (`cargo install tbdflow`) so the safe path is the easy path.
71+
72+
`tbdflow commit` pulls `main`, creates a Conventional Commit, and pushes:
73+
74+
```console
75+
tbdflow commit --type fix --scope decoder -m "handle backpressure on idle links"
76+
```
77+
78+
For a change that needs review, use a short-lived branch and merge it back
79+
quickly: `tbdflow branch --type feat --name my-change`, then `tbdflow complete`.
80+
Other helpers: `tbdflow sync`, `tbdflow radar`, `tbdflow changelog`,
81+
`tbdflow undo`.
82+
83+
Two committed files drive this workflow:
84+
85+
- **`.tbdflow.yml`** -- workflow + commit-message lint rules (trunk branch,
86+
allowed Conventional Commit types, lowercase scope/subject, 72-char subject).
87+
- **`.dod.yml`** -- the Definition of Done checklist shown before each commit
88+
(format, analyze, test, changelog, conformance). Bypass for a trivial change
89+
with `--no-verify`.
90+
91+
Commits and tags are **SSH-signed** (`tbdflow commit` respects the repo's
92+
signing config); include a sign-off (`-s`) certifying the
93+
[DCO](https://developercertificate.org/). Keep pull requests focused and update
94+
`CHANGELOG.md` under an `## Unreleased` heading for user-visible changes.
95+
96+
## Conventional Commits
97+
98+
Every commit message follows
99+
[Conventional Commits](https://www.conventionalcommits.org):
100+
`type(scope): short imperative subject`. Allowed **types**: `build`, `chore`,
101+
`ci`, `docs`, `feat`, `fix`, `perf`, `refactor`, `revert`, `style`, `test`. The
102+
subject is lowercase, imperative, and has no trailing period; breaking changes
103+
use `!` (`feat!:`) or a `BREAKING CHANGE:` footer.
104+
105+
This is enforced locally by `tbdflow commit` and in CI by the **Commit lint**
106+
workflow (`.github/workflows/commit-lint.yml`), which checks every commit in a
107+
pull request.
74108

75109
## Reporting bugs
76110

0 commit comments

Comments
 (0)