-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathcheck_guides.sh
executable file
·54 lines (47 loc) · 1.15 KB
/
check_guides.sh
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
#!/bin/sh
for value in legacy stable; do
if [ ! -e "$value/Cargo.toml" ]; then
if [ ! -d "$value" ]; then
cargo new "$value"
else
cargo init "$value"
fi
case "$value" in
legacy)
cat >> "$value/Cargo.toml" <<-EOF
[dependencies]
futures = "0.3"
hyper = { version = "0.14", features = ["full"] }
hyper-tls = "0.5"
tokio = { version = "1", features = ["full"] }
EOF
;;
stable)
cat >> "$value/Cargo.toml" <<-EOF
[dependencies]
hyper = { version = "1", features = ["full"] }
tokio = { version = "1", features = ["full"] }
http-body-util = "0.1"
hyper-util = { version = "0.1", features = ["full"] }
tower = "0.4"
EOF
;;
esac
cargo build --manifest-path "$value/Cargo.toml"
fi
test_file() {
echo "Testing: $1"
rustdoc --edition 2021 --test "$1" -L "$value/target/debug/deps"
}
if [ -n "$1" ]; then
test_file "$1"
exit $?
fi
status=0
for f in $(git ls-files | grep "^_$value\/.*\.md$"); do
test_file "$f"
s=$?
((status == 0)) && status=$s
done
done
exit $status