-
Notifications
You must be signed in to change notification settings - Fork 8
/
ci.sh
38 lines (30 loc) · 765 Bytes
/
ci.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
#!/bin/env bash
set -e
function test_dir() {
if test -f Makefile; then
echo -e "\033[33m=== start build $1 ===\033[0;39m"
make clean && make
echo -e "\033[32m=== finish build $1 ===\033[0;39m"
fi
}
function test_multiple_dir() {
local dir=$1
for sub in $(ls ./); do
local subpath="$dir/$sub"
if test -d "$sub"; then
( cd "$sub" && test_multiple_dir "$subpath" )
elif test -f $sub; then
if [[ "$sub" == *Makefile ]]; then
test_dir "$dir"
fi
fi
done
}
function main() {
local dir="${1:-chapter*}"
echo $dir
for i in $(find $dir -maxdepth 0 -type d); do
( cd $i && test_multiple_dir "$i")
done
}
main "$@"