-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
121 lines (101 loc) · 3.63 KB
/
Copy pathjustfile
File metadata and controls
121 lines (101 loc) · 3.63 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
export RUSTFLAGS := "-Awarnings"
cwd := `pwd`
root-features := "derive,prost,proto,request,template,serde,chrono,tokio,tonic,fs,postgres,mysql"
workspace-excludes := "bookstore-api,bookstore-service"
exclude-flags := "--exclude " + replace(workspace-excludes, ",", " --exclude ")
format:
just --fmt --unstable
cargo fmt
find ./ -iname *.proto | xargs clang-format -style=Google -i
check:
#!/usr/bin/env bash
set -euxo pipefail
cargo check --workspace --no-default-features {{ exclude-flags }}
cargo check --workspace --features "{{ root-features }}" {{ exclude-flags }} --tests
cargo check --workspace --features "{{ root-features }}" {{ exclude-flags }} --examples
cargo check --workspace --features wasm --exclude bomboni_fs {{ exclude-flags }}
cargo check --target wasm32-unknown-unknown -p bomboni_wasm_core
cargo check --target wasm32-unknown-unknown -p bomboni_wasm --features derive,js
cargo check --target wasm32-unknown-unknown -p bomboni_wasm_derive
cargo check --target wasm32-unknown-unknown -p bomboni_common --features wasm,js
examples=(
grpc/bookstore/bookstore-api
grpc/bookstore/bookstore-service
)
for example in "${examples[@]}"; do
cd "{{ cwd }}/examples/${example}"
if [[ "${example}" == *"api"* ]]; then
cargo check --features server
cargo check --features client
else
cargo check
fi
done
integrations=(
request-individual-crates
request-root-crate
)
for integration in "${integrations[@]}"; do
cd "{{ cwd }}/integrations/${integration}"
cargo check
done
lint:
#!/usr/bin/env bash
set -euxo pipefail
cargo fmt --all -- --check
disallow=(
warnings
unsafe_code
trivial_casts
trivial_numeric_casts
missing_docs
unused_extern_crates
unused_import_braces
unused_qualifications
clippy::clone_on_ref_ptr
clippy::all
clippy::correctness
clippy::suspicious
clippy::complexity
clippy::perf
clippy::style
clippy::pedantic
clippy::nursery
clippy::missing_errors_doc
clippy::missing_panics_doc
)
allow=(
unused_braces
unused_imports
missing_docs
clippy::module_name_repetitions
clippy::cast_possible_truncation
clippy::cast_possible_wrap
clippy::must_use_candidate
clippy::cast_sign_loss
clippy::too_many_lines
clippy::needless_pass_by_value
clippy::struct_excessive_bools
clippy::struct_field_names
clippy::doc_markdown
)
cargo clippy --workspace --no-default-features \
-- ${disallow[@]/#/-D } ${allow[@]/#/-A }
cargo clippy --workspace --all-features \
-- ${disallow[@]/#/-D } ${allow[@]/#/-A }
test:
# TODO: Figure out the best way to test feature matrix
cargo test --workspace --features "{{ root-features }},testing" {{ exclude-flags }} -- --nocapture
cargo test --workspace --doc --features "{{ root-features }},testing" {{ exclude-flags }} -- --nocapture
cargo test --workspace --no-default-features --features testing {{ exclude-flags }} -- --nocapture
cargo test --workspace --doc --no-default-features --features testing {{ exclude-flags }} -- --nocapture
cd "{{ cwd }}/integrations/request-individual-crates"
cargo test
cd "{{ cwd }}/integrations/request-root-crate"
cargo test
docs:
cargo doc --workspace --all-features --no-deps
docs-open:
cargo doc --workspace --all-features --no-deps --open
clean:
cargo clean