-
Notifications
You must be signed in to change notification settings - Fork 62
/
check_guides.sh
executable file
·51 lines (46 loc) · 1.22 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
#!/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
if [ $value = legacy ]; then
cat >> "$value/Cargo.toml" <<-EOF
futures = "0.3"
hyper = { version = "0.14", features = ["full"] }
hyper-tls = "0.5"
tokio = { version = "1", features = ["full"] }
EOF
cargo build --manifest-path "$value/Cargo.toml"
fi
if [ $value = stable ]; then
cat >> "$value/Cargo.toml" <<-EOF
hyper = { version = "1", features = ["full"] }
tokio = { version = "1", features = ["full"] }
http-body-util = "0.1"
hyper-util = { version = "0.1", features = ["full"] }
EOF
cargo build --manifest-path "$value/Cargo.toml"
fi
fi
test_file() {
echo "Testing: $f"
rustdoc --edition 2018 --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=$?
if [ "$s" != "0" ]; then
status=$s
fi
done
done
exit $status