Skip to content

Commit ab5acb1

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 f536881 commit ab5acb1

4 files changed

Lines changed: 156 additions & 6 deletions

File tree

.dod.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Definition of Done, shown by `tbdflow commit` before each commit.
2+
checklist:
3+
- "`./gradlew :cobs:testDebugUnitTest` passes."
4+
- "`./gradlew :cobs:assembleRelease` builds the .aar."
5+
- "New behaviour is covered by tests (golden vectors for codec changes)."
6+
- "The library 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_kt/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: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,48 @@ non-negotiable:
3737
change the algorithms, re-run a byte-for-byte comparison against the reference.
3838
- New behaviour needs new tests.
3939

40-
## Commits and pull requests
40+
## Git workflow: Trunk-Based Development with tbdflow
4141

42-
- Write clear, imperative commit messages.
43-
- Commits and tags in this repository are **SSH-signed**; please sign your
44-
commits and include a sign-off (`git commit -s`) certifying the
45-
[DCO](https://developercertificate.org/).
46-
- Keep pull requests focused.
42+
This project uses [Trunk-Based Development](https://trunkbaseddevelopment.com/):
43+
small, frequent changes integrated into `main` (the trunk) rather than
44+
long-lived branches. We use the [`tbdflow`](https://github.com/cladam/tbdflow)
45+
CLI (`cargo install tbdflow`) so the safe path is the easy path.
46+
47+
`tbdflow commit` pulls `main`, creates a Conventional Commit, and pushes:
48+
49+
```console
50+
tbdflow commit --type fix --scope framing -m "guard against oversized frames"
51+
```
52+
53+
For a change that needs review, use a short-lived branch and merge it back
54+
quickly: `tbdflow branch --type feat --name my-change`, then `tbdflow complete`.
55+
Other helpers: `tbdflow sync`, `tbdflow radar`, `tbdflow changelog`,
56+
`tbdflow undo`.
57+
58+
Two committed files drive this workflow:
59+
60+
- **`.tbdflow.yml`** -- workflow + commit-message lint rules (trunk branch,
61+
allowed Conventional Commit types, lowercase scope/subject, 72-char subject).
62+
- **`.dod.yml`** -- the Definition of Done checklist shown before each commit
63+
(unit tests, `.aar` build, conformance). Bypass for a trivial change with
64+
`--no-verify`.
65+
66+
Commits and tags are **SSH-signed** (`tbdflow commit` respects the repo's
67+
signing config); include a sign-off (`-s`) certifying the
68+
[DCO](https://developercertificate.org/). Keep pull requests focused.
69+
70+
## Conventional Commits
71+
72+
Every commit message follows
73+
[Conventional Commits](https://www.conventionalcommits.org):
74+
`type(scope): short imperative subject`. Allowed **types**: `build`, `chore`,
75+
`ci`, `docs`, `feat`, `fix`, `perf`, `refactor`, `revert`, `style`, `test`. The
76+
subject is lowercase, imperative, and has no trailing period; breaking changes
77+
use `!` (`feat!:`) or a `BREAKING CHANGE:` footer.
78+
79+
This is enforced locally by `tbdflow commit` and in CI by the **Commit lint**
80+
workflow (`.github/workflows/commit-lint.yml`), which checks every commit in a
81+
pull request.
4782

4883
## Releasing
4984

0 commit comments

Comments
 (0)