-
Notifications
You must be signed in to change notification settings - Fork 7
/
x.sh
executable file
·107 lines (96 loc) · 2.15 KB
/
x.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
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
100
101
102
103
104
105
106
107
#!/usr/bin/env bash
# Colors.
readonly WHITE="\033[1;97m" GREEN="\033[1;92m" RED="\033[1;91m" YELLOW="\033[1;93m" BLUE="\033[1;94m" OFF="\033[0m" TITLE="==============================================================>"
# Logging.
title() {
printf "\n${BLUE}${TITLE}${WHITE} %s${OFF}\n" "$1"
}
fail() {
printf "${RED}${TITLE}${WHITE} %s${OFF}\n" "$1"
exit 1
}
ok() {
printf "${GREEN}${TITLE}${WHITE} %s${OFF}\n" "$1"
}
finish() {
printf "\n\n\n${GREEN}${TITLE}${WHITE} %s${OFF}\n" "Festival Build OK."
}
# Help message.
help() {
echo "./x.sh [ARG]"
echo ""
echo "Lint/test/build all packages in the Festival repo."
echo "Builds are done with --release mode."
echo ""
echo "Arguments:"
echo " c | clippy lint all packages"
echo " t | test test all packages"
echo " b | build build all packages"
echo " a | all do all the above"
echo " h | help print help"
}
# Clippy.
clippy() {
for i in {festival-gui,festivald,festival-cli}; do
title "Clippy [${i}]"
if cargo clippy -r -p ${i} -p shukusai --no-deps; then
ok "Clippy [${i}] OK"
else
fail "Clippy [${i}] FAIL"
fi
done
i=rpc
title "Clippy [${i}]"
if cargo clippy -r -p ${i} --no-deps; then
ok "Clippy [${i}] OK"
else
fail "Clippy [${i}] FAIL"
fi
}
# Test.
test() {
for i in {festival-gui,festivald,festival-cli}; do
title "Test [${i}]"
if cargo test -r -p ${i} -p shukusai; then
ok "Test [${i}] OK"
else
fail "Test [${i}] FAIL"
fi
done
# Special cases
for i in {'rpc','festival-gui -- --ignored --exact watch::watch::tests::signals','festival-cli -- --ignored'}; do
title "Test [${i}]"
if cargo test -r -p ${i}; then
ok "Test [${i}] OK"
else
fail "Test [${i}] FAIL"
fi
done
}
# Build.
build() {
for i in {festival-gui,festivald,festival-cli}; do
title "Build [${i}]"
if cargo build -r -p ${i} -p shukusai; then
ok "Build [${i}] OK"
else
fail "Build [${i}] FAIL"
fi
done
finish
ls -al --color=always target/release/festival{"",d,-cli}
}
# Do everything.
all() {
clippy
test
build
}
# Subcommands.
case $1 in
'a'|'all') all;;
'c'|'clippy') clippy;;
't'|'test') test;;
'b'|'build') build;;
*) help;;
esac