-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
73 lines (57 loc) · 2.01 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
#!/usr/bin/env just --justfile
@_default:
just --list
# Clean all build artifacts
clean:
cargo clean
rm -f Cargo.lock
update:
cargo +nightly -Z unstable-options update --breaking
cargo update
# Run cargo clippy
clippy:
cargo clippy --workspace --all-targets -- -D warnings
# Test code formatting
test-fmt:
cargo fmt --all -- --check
# Run cargo fmt
fmt:
cargo +nightly fmt -- --config imports_granularity=Module,group_imports=StdExternalCrate
# Build and open code documentation
docs:
cargo doc --no-deps --open
# Quick compile
check:
RUSTFLAGS='-D warnings' cargo check --workspace --all-targets
# Run all tests
test:
RUSTFLAGS='-D warnings' cargo test --workspace --all-targets
# Test documentation
test-doc:
cargo test --doc
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps
rust-info:
rustc --version
cargo --version
# Run all tests as expected by CI
ci-test: rust-info test-fmt clippy check test test-doc
# Run minimal subset of tests to ensure compatibility with MSRV
ci-test-msrv: rust-info check test
# Verify that the current version of the crate is not the same as the one published on crates.io
check-if-published:
#!/usr/bin/env bash
LOCAL_VERSION="$(grep '^version =' Cargo.toml | sed -E 's/version = "([^"]*)".*/\1/')"
echo "Detected crate version: $LOCAL_VERSION"
CRATE_NAME="$(grep '^name =' Cargo.toml | head -1 | sed -E 's/name = "(.*)"/\1/')"
echo "Detected crate name: $CRATE_NAME"
PUBLISHED_VERSION="$(cargo search ${CRATE_NAME} | grep "^${CRATE_NAME} =" | sed -E 's/.* = "(.*)".*/\1/')"
echo "Published crate version: $PUBLISHED_VERSION"
if [ "$LOCAL_VERSION" = "$PUBLISHED_VERSION" ]; then
echo "ERROR: The current crate version has already been published."
exit 1
else
echo "The current crate version has not yet been published."
fi
# Run tests, and accept their results. Requires insta to be installed.
bless:
cargo insta test --accept --unreferenced=delete -p bindgen_helpers_tests