Skip to content

Commit c5ee35e

Browse files
CramBLandrei-ng
authored andcommitted
add convenience test script for checking if CI would pass
1 parent 1f483f5 commit c5ee35e

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

test.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
set -euxo pipefail
3+
4+
need() {
5+
if ! command -v "$1" > /dev/null 2>&1; then
6+
echo "need $1 (command not found)"
7+
exit 1
8+
fi
9+
}
10+
11+
cargo clippy -- -D warnings
12+
cargo fmt --all -- --check
13+
14+
FEATURE_SETS=(
15+
"--features=alloc,std,ubx_proto23"
16+
"--no-default-features --features=alloc,ubx_proto23"
17+
"--no-default-features --features=ubx_proto23"
18+
"--no-default-features --features=ubx_proto27"
19+
)
20+
21+
for features in "${FEATURE_SETS[@]}"; do
22+
cargo build ${features}
23+
cargo test ${features}
24+
done
25+
26+
# Examples - using a subshell to isolate directory changes
27+
(
28+
cd examples || exit 1
29+
cargo build --release
30+
cargo fmt --all -- --check
31+
cargo clippy --all-targets -- -D warnings
32+
cargo hack check --rust-version --workspace
33+
)
34+
35+
36+
need cargo-hack
37+
cargo hack check --rust-version --workspace
38+
(
39+
cd examples || exit 1
40+
cargo hack check --rust-version --workspace
41+
)

0 commit comments

Comments
 (0)