Skip to content

Commit 91c1663

Browse files
authored
Improve CI: cargo cranky + pinned wasm-bindgen-cli (#17)
* Use cargo cranky cargo cranky (https://github.com/ericseppanen/cargo-cranky) is a new tool that passes lints specified in a Cranky.toml to cargo clippy. This is a possible solution to rust-lang/cargo#5034 * Use pinned version of wasm-bindgen-cli * Add bacon.toml for https://github.com/Canop/bacon
1 parent 5a4dd36 commit 91c1663

File tree

9 files changed

+178
-121
lines changed

9 files changed

+178
-121
lines changed

.cargo/config.toml

-100
This file was deleted.

.github/workflows/rust.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ jobs:
9292
command: fmt
9393
args: --all -- --check
9494

95-
clippy:
96-
name: Clippy
95+
cranky:
96+
name: cargo cranky
9797
runs-on: ubuntu-latest
9898
steps:
9999
- uses: actions/checkout@v2
@@ -103,11 +103,11 @@ jobs:
103103
toolchain: 1.62.0
104104
override: true
105105
- run: sudo apt-get update && sudo apt-get install libgtk-3-dev
106-
- run: rustup component add clippy
106+
- run: cargo install cargo-cranky
107107
- uses: actions-rs/cargo@v1
108108
with:
109-
command: clippy
110-
args: --all-features -- -D warnings
109+
command: cranky
110+
args: --workspace --all-targets --all-features -- -D warnings
111111

112112
cargo-deny:
113113
name: cargo deny
@@ -143,5 +143,5 @@ jobs:
143143
toolchain: 1.62.0
144144
override: true
145145
- run: rustup target add wasm32-unknown-unknown
146-
- run: cargo install wasm-bindgen-cli
146+
- run: ./crates/re_viewer/setup_web.sh
147147
- run: ./crates/re_viewer/wasm_bindgen_check.sh

Cargo.lock

+12-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cranky.toml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# https://github.com/ericseppanen/cargo-cranky
2+
# cargo install cargo-cranky && cargo cranky
3+
4+
deny = [
5+
"unsafe_code",
6+
]
7+
8+
warn = [
9+
"clippy::all",
10+
"clippy::await_holding_lock",
11+
"clippy::char_lit_as_u8",
12+
"clippy::checked_conversions",
13+
"clippy::dbg_macro",
14+
"clippy::debug_assert_with_mut_call",
15+
"clippy::disallowed_methods",
16+
"clippy::disallowed_script_idents",
17+
"clippy::doc_markdown",
18+
"clippy::empty_enum",
19+
"clippy::enum_glob_use",
20+
"clippy::equatable_if_let",
21+
"clippy::exit",
22+
"clippy::expl_impl_clone_on_copy",
23+
"clippy::explicit_deref_methods",
24+
"clippy::explicit_into_iter_loop",
25+
"clippy::fallible_impl_from",
26+
"clippy::filter_map_next",
27+
"clippy::flat_map_option",
28+
"clippy::float_cmp_const",
29+
"clippy::fn_params_excessive_bools",
30+
"clippy::fn_to_numeric_cast_any",
31+
"clippy::from_iter_instead_of_collect",
32+
"clippy::if_let_mutex",
33+
"clippy::implicit_clone",
34+
"clippy::imprecise_flops",
35+
"clippy::index_refutable_slice",
36+
"clippy::inefficient_to_string",
37+
"clippy::invalid_upcast_comparisons",
38+
"clippy::iter_not_returning_iterator",
39+
"clippy::large_digit_groups",
40+
"clippy::large_stack_arrays",
41+
"clippy::large_types_passed_by_value",
42+
"clippy::let_unit_value",
43+
"clippy::linkedlist",
44+
"clippy::lossy_float_literal",
45+
"clippy::macro_use_imports",
46+
"clippy::manual_ok_or",
47+
"clippy::map_err_ignore",
48+
"clippy::map_flatten",
49+
"clippy::map_unwrap_or",
50+
"clippy::match_on_vec_items",
51+
"clippy::match_same_arms",
52+
"clippy::match_wild_err_arm",
53+
"clippy::match_wildcard_for_single_variants",
54+
"clippy::mem_forget",
55+
"clippy::mismatched_target_os",
56+
"clippy::missing_enforced_import_renames",
57+
"clippy::missing_safety_doc",
58+
"clippy::mut_mut",
59+
"clippy::mutex_integer",
60+
"clippy::needless_borrow",
61+
"clippy::needless_continue",
62+
"clippy::needless_for_each",
63+
"clippy::needless_pass_by_value",
64+
"clippy::negative_feature_names",
65+
"clippy::nonstandard_macro_braces",
66+
"clippy::option_option",
67+
"clippy::path_buf_push_overwrite",
68+
"clippy::ptr_as_ptr",
69+
"clippy::rc_mutex",
70+
"clippy::ref_option_ref",
71+
"clippy::rest_pat_in_fully_bound_structs",
72+
"clippy::same_functions_in_if_condition",
73+
"clippy::semicolon_if_nothing_returned",
74+
"clippy::single_match_else",
75+
"clippy::str_to_string",
76+
"clippy::string_add_assign",
77+
"clippy::string_add",
78+
"clippy::string_lit_as_bytes",
79+
"clippy::string_to_string",
80+
"clippy::todo",
81+
"clippy::trailing_empty_array",
82+
"clippy::trait_duplication_in_bounds",
83+
"clippy::unimplemented",
84+
"clippy::unnecessary_wraps",
85+
"clippy::unnested_or_patterns",
86+
"clippy::unused_self",
87+
"clippy::useless_transmute",
88+
"clippy::verbose_file_reads",
89+
"clippy::zero_sized_map_values",
90+
"future_incompatible",
91+
"nonstandard_style",
92+
"rust_2018_idioms",
93+
"rustdoc::missing_crate_level_docs",
94+
"semicolon_in_expressions_from_macros",
95+
"trivial_numeric_casts",
96+
"unused_extern_crates",
97+
"unused_import_braces",
98+
# "clippy::cloned_instead_of_copied",
99+
# "clippy::missing_errors_doc",
100+
# "clippy::mod_module_files",
101+
# "trivial_casts",
102+
# "unused_qualifications",
103+
]
104+
105+
allow = [
106+
]

bacon.toml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This is a configuration file for the bacon tool
2+
# More info at https://github.com/Canop/bacon
3+
4+
default_job = "cranky"
5+
6+
[jobs]
7+
8+
[jobs.cranky]
9+
command = ["cargo", "cranky", "--all-targets", "--all-features", "--color", "always"]
10+
need_stdout = false
11+
watch = ["tests", "benches", "examples"]
12+
13+
[jobs.test]
14+
command = ["cargo", "test", "--color", "always"]
15+
need_stdout = true
16+
watch = ["tests"]
17+
18+
[jobs.doc]
19+
command = ["cargo", "doc", "--color", "always", "--all-features", "--no-deps"]
20+
need_stdout = false
21+
22+
# if the doc compiles, then it opens in your browser and bacon switches
23+
# to the previous job
24+
[jobs.doc-open]
25+
command = ["cargo", "doc", "--color", "always", "--all-features", "--no-deps", "--open"]
26+
need_stdout = false
27+
on_success = "back" # so that we don't open the browser at each change
28+
29+
# You can run your application and have the result displayed in bacon,
30+
# *if* it makes sense for this crate. You can run an example the same
31+
# way. Don't forget the `--color always` part or the errors won't be
32+
# properly parsed.
33+
[jobs.run]
34+
command = ["cargo", "run", "--color", "always"]
35+
need_stdout = true
36+
37+
# You may define here keybindings that would be specific to
38+
# a project, for example a shortcut to launch a specific job.
39+
# Shortcuts to internal functions (scrolling, toggling, etc.)
40+
# should go in your personal prefs.toml file instead.
41+
[keybindings]
42+
i = "job:initial"
43+
c = "job:cranky"
44+
d = "job:doc-open"
45+
t = "job:test"
46+
r = "job:run"

check.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22
# This scripts runs various CI-like checks in a convenient way.
33
set -eux
44

5+
cargo install cargo-cranky # Uses lints defined in Cranky.toml. See https://github.com/ericseppanen/cargo-cranky
6+
57
RUSTFLAGS="-D warnings"
68
RUSTDOCFLAGS="-D warnings" # https://github.com/emilk/egui/pull/1454
79

810
cargo build --all-features
911
cargo check --workspace --all-targets --all-features
1012
cargo check -p re_viewer --all-features --lib --target wasm32-unknown-unknown
1113
cargo fmt --all -- --check
12-
cargo clippy --workspace --all-targets --all-features -- -D warnings -W clippy::all
14+
cargo cranky --workspace --all-targets --all-features -- -D warnings
1315
cargo test --workspace --all-targets --all-features
1416
cargo test --workspace --doc --all-features
1517

crates/re_viewer/build_web.sh

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ set -eu
33
script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
44
cd "$script_path/../.."
55

6+
./crates/re_viewer/setup_web.sh
7+
68
OPEN=false
79
FAST=false
810

crates/re_viewer/setup_web.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ cd "$script_path/../.."
55

66
# Pre-requisites:
77
rustup target add wasm32-unknown-unknown
8-
cargo install wasm-bindgen-cli
9-
cargo update -p wasm-bindgen
8+
cargo install wasm-bindgen-cli --version 0.2.82
109

1110
# Required by build_web.sh:
1211
packagesNeeded='binaryen jq'

0 commit comments

Comments
 (0)