-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
174 lines (137 loc) · 5.62 KB
/
justfile
File metadata and controls
174 lines (137 loc) · 5.62 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# tally Development Commands
set shell := ["bash", "-euo", "pipefail", "-c"]
set positional-arguments := true
# List available recipes
default:
@just --list
# ---------------------------------------------------------------------------
# Private guards
# ---------------------------------------------------------------------------
[private]
_require cmd install_hint:
@command -v {{ cmd }} &>/dev/null || { echo "{{ cmd }} not installed — run: {{ install_hint }}"; exit 1; }
[private]
_require-nightly:
@rustup run nightly rustfmt --version &>/dev/null || { echo "nightly toolchain required — run: rustup toolchain install nightly --component rustfmt"; exit 1; }
# ---------------------------------------------------------------------------
# Build & Test
# ---------------------------------------------------------------------------
[group('build')]
build:
cargo build --all-targets
[group('test')]
test:
cargo test --all-targets
[group('test')]
test-doc:
cargo test --doc --all-features
# ---------------------------------------------------------------------------
# Quality Checks
# ---------------------------------------------------------------------------
[group('check')]
check: check-fmt check-clippy check-deny
[group('check')]
check-fmt: _require-nightly
rustup run nightly cargo fmt --all -- --check
[group('check')]
check-clippy:
cargo clippy --all-targets --all-features -- -D warnings
[group('check')]
check-deny: (_require "cargo-deny" "cargo install cargo-deny --locked")
cargo deny check advisories licenses bans
[group('check')]
check-toml: (_require "taplo" "cargo install taplo-cli --locked")
taplo fmt --check
[group('check')]
lint: check
# ---------------------------------------------------------------------------
# Formatting
# ---------------------------------------------------------------------------
[group('format')]
fmt: _require-nightly
rustup run nightly cargo fmt --all
[group('format')]
fmt-toml: (_require "taplo" "cargo install taplo-cli --locked")
taplo fmt
[group('format')]
fmt-all: fmt fmt-toml
# ---------------------------------------------------------------------------
# Development
# ---------------------------------------------------------------------------
[group('dev')]
dev: (_require "cargo-watch" "cargo install cargo-watch --locked")
cargo watch -x check -x 'test --lib'
[group('dev')]
install-hooks: (_require "lefthook" "brew install lefthook")
lefthook install
[group('dev')]
clean:
cargo clean
# ---------------------------------------------------------------------------
# Coverage
# ---------------------------------------------------------------------------
# Coverage recipes export LLVM tool paths explicitly because Homebrew Rust
# installs llvm-tools-preview in a location cargo-llvm-cov can't auto-detect.
_llvm-env := ```
sysroot=$(rustup run stable rustc --print sysroot 2>/dev/null || true)
if [ -n "$sysroot" ]; then
bin="$sysroot/lib/rustlib/$(rustc -vV | grep host | cut -d' ' -f2)/bin"
[ -f "$bin/llvm-cov" ] && echo "LLVM_COV=$bin/llvm-cov LLVM_PROFDATA=$bin/llvm-profdata" || echo ""
fi
```
[group('test')]
coverage: (_require "cargo-llvm-cov" "cargo install cargo-llvm-cov --locked")
{{ _llvm-env }} cargo llvm-cov --all-targets --summary-only
[group('test')]
coverage-html: (_require "cargo-llvm-cov" "cargo install cargo-llvm-cov --locked")
{{ _llvm-env }} cargo llvm-cov --all-targets --html --open
[group('test')]
coverage-json: (_require "cargo-llvm-cov" "cargo install cargo-llvm-cov --locked")
{{ _llvm-env }} cargo llvm-cov --all-targets --codecov --output-path codecov.json
# ---------------------------------------------------------------------------
# CI
# ---------------------------------------------------------------------------
[group('ci')]
ci: check-fmt check-clippy build check-deny test test-doc
@echo ""
@echo "All CI jobs passed."
# ---------------------------------------------------------------------------
# Setup
# ---------------------------------------------------------------------------
[group('setup')]
setup:
#!/usr/bin/env bash
echo "Installing development tools..."
rustup component add clippy
rustup toolchain install nightly --component rustfmt
cargo install cargo-watch cargo-deny cargo-nextest cargo-llvm-cov git-cliff --locked
rustup component add llvm-tools-preview --toolchain stable
if command -v brew &>/dev/null; then
brew install taplo lefthook
else
cargo install taplo-cli --locked
fi
echo "Done. Run 'just check' to verify."
# ---------------------------------------------------------------------------
# Release
# ---------------------------------------------------------------------------
[group('release')]
changelog: (_require "git-cliff" "cargo install git-cliff --locked")
git-cliff --config cliff.toml
[group('release')]
changelog-unreleased: (_require "git-cliff" "cargo install git-cliff --locked")
git-cliff --config cliff.toml --unreleased
[group('release')]
release version: (_require "git-cliff" "cargo install git-cliff --locked")
#!/usr/bin/env bash
set -euo pipefail
echo "Preparing release {{ version }}..."
# Update version in Cargo.toml
sed -i '' "s/^version = \".*\"/version = \"{{ version }}\"/" Cargo.toml
cargo check
# Generate full changelog
git-cliff --config cliff.toml --tag "v{{ version }}" -o CHANGELOG.md
git add Cargo.toml Cargo.lock CHANGELOG.md
git commit -m "chore(release): prepare v{{ version }}"
git tag -a "v{{ version }}" -m "Release v{{ version }}"
echo "Release v{{ version }} prepared. Push with: git push origin develop --tags"