Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
67 lines (53 loc) · 2.08 KB
/
Copy pathJustfile
File metadata and controls
67 lines (53 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
59
60
61
62
63
64
65
66
# `check` is the definition of green. CI runs it and nothing else, so a gate
# added here is picked up there without a second edit.
set shell := ["bash", "-euo", "pipefail", "-c"]
default:
@just --list
# Everything a change owes before it is handed over.
check: rust-fmt-check rust-clippy rust-test rust-doc deny
rust-fmt-check:
cargo fmt --all -- --check
rust-clippy:
cargo clippy --workspace --all-targets -- -D warnings
rust-test:
cargo test --workspace
# The rustdoc is the documentation, so a warning in it (a broken link) fails.
rust-doc:
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps
deny:
cargo deny check
# One worktree per issue, cut from a freshly fetched origin/main.
worktree-new type slug:
git fetch origin
git worktree add .worktrees/{{slug}} -b {{type}}/{{slug}} origin/main
cd .worktrees/{{slug}} && just branch-check
# Refuses main, and a branch that does not contain origin/main.
branch-check:
#!/usr/bin/env bash
set -euo pipefail
branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$branch" = "main" ]; then
echo "branch-check: on main; cut a branch with 'just worktree-new'" >&2
exit 1
fi
if git rev-parse --verify --quiet origin/main >/dev/null; then
git merge-base --is-ancestor origin/main HEAD || {
echo "branch-check: $branch does not contain origin/main; rebase or recut" >&2
exit 1
}
fi
echo "branch-check: $branch ok"
# Commit messages on this branch carry no AI attribution (CONTRIBUTING.md).
commit-msg-check:
#!/usr/bin/env bash
set -euo pipefail
range="origin/main..HEAD"
git rev-parse --verify --quiet origin/main >/dev/null || range="HEAD"
if git log --format=%B "$range" | grep -inE '^(co-authored-by|signed-off-by):|generated with'; then
echo "commit-msg-check: attribution lines found in $range" >&2
exit 1
fi
echo "commit-msg-check: $range ok"
# The gate before a hand-over: run it after the last commit, over the tree
# that is actually handed over.
pre-push: branch-check commit-msg-check check