Skip to content

Commit 8eb1b17

Browse files
oddgrdseanmonstar
authored andcommitted
ci: rewrite script to test master and legacy
1 parent 138b24b commit 8eb1b17

File tree

2 files changed

+43
-30
lines changed

2 files changed

+43
-30
lines changed

.github/workflows/check_guides.sh

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,49 @@
11
#!/bin/sh
22

3-
if [ ! -e tmp/Cargo.toml ]; then
4-
if [ ! -d tmp ]; then
5-
cargo new tmp
6-
else
7-
cargo init tmp
8-
fi
9-
cat >> tmp/Cargo.toml <<-EOF
10-
futures = "0.3"
11-
hyper = { version = "0.14", features = ["full"] }
12-
hyper-tls = "0.5"
13-
tokio = { version = "1", features = ["full"] }
3+
for value in legacy master
4+
do
5+
if [ ! -e "$value/Cargo.toml" ]; then
6+
if [ ! -d $value ]; then
7+
cargo new $value
8+
else
9+
cargo init $value
10+
fi
11+
if [ $value = legacy ]; then
12+
cat >> "$value/Cargo.toml" <<-EOF
13+
futures = "0.3"
14+
hyper = { version = "0.14", features = ["full"] }
15+
hyper-tls = "0.5"
16+
tokio = { version = "1", features = ["full"] }
1417
EOF
15-
cargo build --manifest-path tmp/Cargo.toml
16-
fi
17-
18-
test_file() {
19-
echo "Testing: $f"
20-
rustdoc --edition 2018 --test $1 -L tmp/target/debug/deps
21-
}
22-
23-
if [ -n "$1" ]; then
24-
test_file $1
25-
exit $?
26-
fi
18+
cargo build --manifest-path "$value/Cargo.toml"
19+
fi
20+
if [ $value = master ]; then
21+
cat >> "$value/Cargo.toml" <<-EOF
22+
hyper = { version = "1.0.0-rc.1", features = ["full"] }
23+
tokio = { version = "1", features = ["full"] }
24+
http-body-util = "0.1.0-rc.1"
25+
EOF
26+
cargo build --manifest-path "$value/Cargo.toml"
27+
fi
28+
fi
29+
test_file() {
30+
echo "Testing: $f"
31+
rustdoc --edition 2018 --test $1 -L "$value/target/debug/deps"
32+
}
2733

28-
status=0
29-
for f in `git ls-files | grep '\.md$'`; do
30-
test_file $f
31-
s=$?
32-
if [ "$s" != "0" ]; then
33-
status=$s
34+
if [ -n "$1" ]; then
35+
test_file $1
36+
exit $?
3437
fi
38+
39+
status=0
40+
for f in `git ls-files | grep "^_guides\/$value.*\.md$"`; do
41+
test_file $f
42+
s=$?
43+
if [ "$s" != "0" ]; then
44+
status=$s
45+
fi
46+
done
3547
done
3648

3749
exit $status

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Gemfile*
22
_site*
33
.sass-cache
4-
tmp/
4+
/legacy
5+
/master

0 commit comments

Comments
 (0)