| 1 |
export RUSTFLAGS := "-D warnings" |
| 2 |
export RUSTDOCFLAGS := "-D warnings" |
| 3 |
|
| 4 |
[private] |
| 5 |
default: |
| 6 |
just -l --unsorted |
| 7 |
|
| 8 |
########### |
| 9 |
### RUN ### |
| 10 |
########### |
| 11 |
|
| 12 |
# Run (local) CI |
| 13 |
ci: (ci_impl "" "" ) \ |
| 14 |
(ci_impl "" " --all-features") \ |
| 15 |
(ci_impl " --release" "" ) \ |
| 16 |
(ci_impl " --release" " --all-features") |
| 17 |
|
| 18 |
[private] |
| 19 |
ci_impl mode features: (check_impl mode features) (test_impl mode features) |
| 20 |
|
| 21 |
# Check syntax, formatting, clippy, deny, semver, ... |
| 22 |
check: (check_impl "" "" ) \ |
| 23 |
(check_impl "" " --all-features") \ |
| 24 |
(check_impl " --release" "" ) \ |
| 25 |
(check_impl " --release" " --all-features") |
| 26 |
|
| 27 |
[private] |
| 28 |
check_impl mode features: (cargo_check mode features) \ |
| 29 |
(cargo_hack mode) \ |
| 30 |
cargo_fmt \ |
| 31 |
(cargo_clippy mode features) \ |
| 32 |
cargo_deny \ |
| 33 |
cargo_semver |
| 34 |
|
| 35 |
[private] |
| 36 |
cargo_check mode features: |
| 37 |
cargo check --workspace --all-targets{{ mode }}{{ features }} |
| 38 |
cargo doc --no-deps --document-private-items --keep-going{{ mode }}{{ features }} |
| 39 |
|
| 40 |
[private] |
| 41 |
cargo_hack mode: install_cargo_hack |
| 42 |
cargo hack check --workspace --all-targets{{ mode }} |
| 43 |
|
| 44 |
[private] |
| 45 |
cargo_fmt: install_rust_nightly install_rust_nightly_fmt |
| 46 |
cargo +nightly fmt --check |
| 47 |
|
| 48 |
[private] |
| 49 |
cargo_clippy features mode: install_cargo_clippy |
| 50 |
cargo clippy --workspace --all-targets{{ features }}{{ mode }} |
| 51 |
|
| 52 |
[private] |
| 53 |
cargo_deny: install_cargo_deny |
| 54 |
cargo deny check |
| 55 |
|
| 56 |
[private] |
| 57 |
cargo_semver: install_cargo_semver_checks |
| 58 |
cargo semver-checks check-release --only-explicit-features -p imap-next |
| 59 |
|
| 60 |
# Test multiple configurations |
| 61 |
test: (test_impl "" "" ) \ |
| 62 |
(test_impl "" " --all-features") \ |
| 63 |
(test_impl " --release" "" ) \ |
| 64 |
(test_impl " --release" " --all-features") |
| 65 |
|
| 66 |
[private] |
| 67 |
test_impl mode features: (cargo_test mode features) |
| 68 |
|
| 69 |
[private] |
| 70 |
cargo_test features mode: |
| 71 |
cargo test --workspace --all-targets{{ features }}{{ mode }} |
| 72 |
|
| 73 |
# Audit advisories, bans, licenses, and sources |
| 74 |
audit: cargo_deny |
| 75 |
|
| 76 |
# Measure test coverage |
| 77 |
coverage: install_rust_llvm_tools_preview install_cargo_grcov |
| 78 |
mkdir -p target/coverage |
| 79 |
RUSTFLAGS="-Cinstrument-coverage" LLVM_PROFILE_FILE="coverage-%m-%p.profraw" cargo test -p imap-next -p integration-test --all-features |
| 80 |
grcov . \ |
| 81 |
--source-dir . \ |
| 82 |
--binary-path target/debug \ |
| 83 |
--branch \ |
| 84 |
--keep-only 'src/**' \ |
| 85 |
--output-types "lcov" \ |
| 86 |
--llvm > target/coverage/coverage.lcov |
| 87 |
# TODO: Create files in `target/coverage` only. |
| 88 |
rm *.profraw |
| 89 |
rm integration-test/*.profraw |
| 90 |
|
| 91 |
# Check MSRV |
| 92 |
check_msrv: install_rust_1_85 |
| 93 |
cargo +1.85 check --workspace --all-targets --all-features |
| 94 |
cargo +1.85 test --workspace --all-targets --all-features |
| 95 |
|
| 96 |
# Check minimal dependency versions |
| 97 |
check_minimal_dependency_versions: install_rust_nightly |
| 98 |
cargo +nightly update -Z minimal-versions |
| 99 |
cargo check --workspace --all-targets --all-features |
| 100 |
cargo test --workspace --all-targets --all-features |
| 101 |
cargo update |
| 102 |
|
| 103 |
############### |
| 104 |
### INSTALL ### |
| 105 |
############### |
| 106 |
|
| 107 |
# Install required tooling (ahead of time) |
| 108 |
install: install_rust_1_85 \ |
| 109 |
install_rust_nightly \ |
| 110 |
install_rust_nightly_fmt \ |
| 111 |
install_rust_llvm_tools_preview \ |
| 112 |
install_cargo_clippy \ |
| 113 |
install_cargo_deny \ |
| 114 |
install_cargo_fuzz \ |
| 115 |
install_cargo_grcov \ |
| 116 |
install_cargo_hack \ |
| 117 |
install_cargo_semver_checks |
| 118 |
|
| 119 |
[private] |
| 120 |
install_rust_1_85: |
| 121 |
# Fix issue |
| 122 |
rustup update --no-self-update 1.85 |
| 123 |
rustup set profile minimal |
| 124 |
# rustup toolchain install 1.85 --profile minimal |
| 125 |
|
| 126 |
[private] |
| 127 |
install_rust_nightly: |
| 128 |
# Fix issue |
| 129 |
rustup update --no-self-update nightly |
| 130 |
rustup set profile minimal |
| 131 |
# rustup toolchain install nightly --profile minimal |
| 132 |
|
| 133 |
[private] |
| 134 |
install_rust_nightly_fmt: |
| 135 |
rustup component add --toolchain nightly rustfmt |
| 136 |
|
| 137 |
[private] |
| 138 |
install_rust_llvm_tools_preview: |
| 139 |
rustup component add llvm-tools-preview |
| 140 |
|
| 141 |
[private] |
| 142 |
install_cargo_clippy: |
| 143 |
rustup component add clippy |
| 144 |
|
| 145 |
[private] |
| 146 |
install_cargo_deny: |
| 147 |
cargo install --locked cargo-deny |
| 148 |
|
| 149 |
[private] |
| 150 |
install_cargo_fuzz: install_rust_nightly |
| 151 |
cargo install cargo-fuzz |
| 152 |
|
| 153 |
[private] |
| 154 |
install_cargo_grcov: |
| 155 |
cargo install grcov |
| 156 |
|
| 157 |
[private] |
| 158 |
install_cargo_hack: |
| 159 |
cargo install --locked cargo-hack |
| 160 |
|
| 161 |
[private] |
| 162 |
install_cargo_semver_checks: |
| 163 |
cargo install --locked cargo-semver-checks |
| 164 |
|