-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathjustfile
164 lines (132 loc) · 4.44 KB
/
justfile
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
export RUSTFLAGS := "-D warnings"
export RUSTDOCFLAGS := "-D warnings"
[private]
default:
just -l --unsorted
###########
### RUN ###
###########
# Run (local) CI
ci: (ci_impl "" "" ) \
(ci_impl "" " --all-features") \
(ci_impl " --release" "" ) \
(ci_impl " --release" " --all-features")
[private]
ci_impl mode features: (check_impl mode features) (test_impl mode features)
# Check syntax, formatting, clippy, deny, semver, ...
check: (check_impl "" "" ) \
(check_impl "" " --all-features") \
(check_impl " --release" "" ) \
(check_impl " --release" " --all-features")
[private]
check_impl mode features: (cargo_check mode features) \
(cargo_hack mode) \
cargo_fmt \
(cargo_clippy mode features) \
cargo_deny \
cargo_semver
[private]
cargo_check mode features:
cargo check --workspace --all-targets{{ mode }}{{ features }}
cargo doc --no-deps --document-private-items --keep-going{{ mode }}{{ features }}
[private]
cargo_hack mode: install_cargo_hack
cargo hack check --workspace --all-targets{{ mode }}
[private]
cargo_fmt: install_rust_nightly install_rust_nightly_fmt
cargo +nightly fmt --check
[private]
cargo_clippy features mode: install_cargo_clippy
cargo clippy --workspace --all-targets{{ features }}{{ mode }}
[private]
cargo_deny: install_cargo_deny
cargo deny check
[private]
cargo_semver: install_cargo_semver_checks
cargo semver-checks check-release --only-explicit-features -p imap-next
# Test multiple configurations
test: (test_impl "" "" ) \
(test_impl "" " --all-features") \
(test_impl " --release" "" ) \
(test_impl " --release" " --all-features")
[private]
test_impl mode features: (cargo_test mode features)
[private]
cargo_test features mode:
cargo test --workspace --all-targets{{ features }}{{ mode }}
# Audit advisories, bans, licenses, and sources
audit: cargo_deny
# Measure test coverage
coverage: install_rust_llvm_tools_preview install_cargo_grcov
mkdir -p target/coverage
RUSTFLAGS="-Cinstrument-coverage" LLVM_PROFILE_FILE="coverage-%m-%p.profraw" cargo test -p imap-next -p integration-test --all-features
grcov . \
--source-dir . \
--binary-path target/debug \
--branch \
--keep-only 'src/**' \
--output-types "lcov" \
--llvm > target/coverage/coverage.lcov
# TODO: Create files in `target/coverage` only.
rm *.profraw
rm integration-test/*.profraw
# Check MSRV
check_msrv: install_rust_1_74
cargo +1.74 check --workspace --all-targets --all-features
cargo +1.74 test --workspace --all-targets --all-features
# Check minimal dependency versions
check_minimal_dependency_versions: install_rust_nightly
cargo +nightly update -Z minimal-versions
cargo check --workspace --all-targets --all-features
cargo test --workspace --all-targets --all-features
cargo update
###############
### INSTALL ###
###############
# Install required tooling (ahead of time)
install: install_rust_1_74 \
install_rust_nightly \
install_rust_nightly_fmt \
install_rust_llvm_tools_preview \
install_cargo_clippy \
install_cargo_deny \
install_cargo_fuzz \
install_cargo_grcov \
install_cargo_hack \
install_cargo_semver_checks
[private]
install_rust_1_74:
# Fix issue
rustup update --no-self-update 1.74
rustup set profile minimal
# rustup toolchain install 1.74 --profile minimal
[private]
install_rust_nightly:
# Fix issue
rustup update --no-self-update nightly
rustup set profile minimal
# rustup toolchain install nightly --profile minimal
[private]
install_rust_nightly_fmt:
rustup component add --toolchain nightly rustfmt
[private]
install_rust_llvm_tools_preview:
rustup component add llvm-tools-preview
[private]
install_cargo_clippy:
rustup component add clippy
[private]
install_cargo_deny:
cargo install --locked cargo-deny
[private]
install_cargo_fuzz: install_rust_nightly
cargo install cargo-fuzz
[private]
install_cargo_grcov:
cargo install grcov
[private]
install_cargo_hack:
cargo install --locked cargo-hack
[private]
install_cargo_semver_checks:
cargo install --locked cargo-semver-checks