-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck.sh
More file actions
executable file
·99 lines (83 loc) · 2.67 KB
/
check.sh
File metadata and controls
executable file
·99 lines (83 loc) · 2.67 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
#!/usr/bin/env bash
set -Eeuo pipefail
# Env variables:
# - NO_EXIT_ON_FAIL:
# when set to `true`, all checks will be performed regardless of failure.
NO_EXIT_ON_FAIL="${NO_EXIT_ON_FAIL:-false}"
comma_separated() {
local IFS=","
echo "$*"
}
all_features=(
"default"
"std"
"detect-color-support"
"custom-default-colors"
)
toolchains=(
stable
beta
nightly
"1.70.0"
)
( set -x; cargo +nightly fmt --all -- --check || $NO_EXIT_ON_FAIL )
(
set -x; cargo +nightly rustdoc --all-features -- \
-Z unstable-options --check -D warnings \
|| $NO_EXIT_ON_FAIL
)
for toolchain in "${toolchains[@]}"; do
export CARGO_TARGET_DIR="target/check-$toolchain"
num_features=${#all_features[@]}
num_combinations=$(echo "2^$num_features" | bc)
# iterate over all 2^num_features features combinations if required
# `j1` is used as a bitmask of the enabled features
for ((j1 = 0; j1 < num_combinations; j1++)); do
features_set=()
for ((j2 = 0; j2 < num_features; j2++)); do
mask=$(echo "2^$j2" | bc) # the mask of `j2`-th feature
if (( j1 & mask )); then
features_set+=(${all_features[$j2]})
fi
done
features=$(comma_separated "${features_set[@]}")
(
set -x
cargo "+$toolchain" clippy \
--no-default-features --features "${features}" \
-- -D warnings \
|| $NO_EXIT_ON_FAIL
cargo "+$toolchain" clippy --all-targets \
--no-default-features --features "${features}" \
-- -D warnings \
|| $NO_EXIT_ON_FAIL
cargo "+$toolchain" build \
--no-default-features --features "${features}" \
|| $NO_EXIT_ON_FAIL
cargo "+$toolchain" test --all-targets \
--no-default-features --features "${features}" \
|| $NO_EXIT_ON_FAIL
cargo "+$toolchain" build --release \
--no-default-features --features "${features}" \
|| $NO_EXIT_ON_FAIL
cargo "+$toolchain" test --release --all-targets \
--no-default-features --features "${features}" \
|| $NO_EXIT_ON_FAIL
)
done
(
set -x
cd ./tests/no-alloc
cargo +$toolchain clippy -- -D warnings
cargo +$toolchain build
)
if [[ $toolchain != "1.70.0" ]]; then
(
set -x
cd ./tests/no-std
cargo +$toolchain clippy -- -D warnings
cargo +$toolchain build
)
fi
done
( set -x; cargo deny --workspace --all-features check )