Skip to content

Commit

Permalink
Add check.sh for running CI-like checks locally.
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Feb 17, 2024
1 parent a89014a commit ef861c2
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ env:
# This is required to enable the web_sys clipboard API which egui_web uses
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html
RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings
RUSTDOCFLAGS: -D warnings
RUSTFLAGS: --cfg=web_sys_unstable_apis --deny warnings
RUSTDOCFLAGS: --deny warnings

jobs:
check_native:
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features -- -D warnings -W clippy::all
args: --all-targets --all-features -- --deny warnings -W clippy::all

doc:
name: cargo doc
Expand Down
28 changes: 28 additions & 0 deletions check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# This scripts runs various CI-like checks in a convenient way.

set -eu
script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
cd "$script_path"
set -x

export RUSTFLAGS="--deny warnings"

# https://github.com/ericseppanen/cargo-cranky/issues/8
export RUSTDOCFLAGS="--deny warnings --deny rustdoc::missing_crate_level_docs"

typos # cargo install typos-cli

cargo fmt --all -- --check
cargo cranky --quiet --all-targets --all-features -- --deny warnings
cargo test --quiet --all-targets --all-features
cargo test --quiet --doc --all-features # checks all doc-tests

cargo cranky --quiet --lib --target wasm32-unknown-unknown --all-features

cargo doc --quiet --no-deps --all-features
cargo doc --quiet --document-private-items --no-deps --all-features

cargo deny --all-features --log-level error check

echo "All checks passed!"
2 changes: 2 additions & 0 deletions example_eframe/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Example application using [`eframe`].
mod app;

pub use app::DemoApp;
Expand Down
2 changes: 1 addition & 1 deletion example_eframe/src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl WebHandle {
.start(
canvas_id,
eframe::WebOptions::default(),
Box::new(|_cc| Box::new(DemoApp::default())),
Box::new(|_cc| Box::<DemoApp>::default()),
)
.await
}
Expand Down

0 comments on commit ef861c2

Please sign in to comment.