-
Notifications
You must be signed in to change notification settings - Fork 3
/
run.sh
executable file
·62 lines (54 loc) · 1.65 KB
/
run.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
#!/bin/bash
# The first argument is the action (test or publish)
ACTION=$1
# The second argument is the target (core, flutter, or example)
TARGET=$2
CURRENT_DIR=$(pwd)
test_target() {
cd $CURRENT_DIR # for "all" tests, we need to be in the root directory
if [ "$1" == "core" ]; then
echo "testing core"
cd packages/lite_ref_core &&
flutter test --coverage --timeout 5s
elif [ "$1" == "flutter" ]; then
echo "testing flutter"
cd packages/lite_ref &&
flutter test --coverage --timeout 5s
elif [ "$1" == "all" ]; then
test_target "core" &&
test_target "flutter"
else
echo -e "unknown test \"$1\" \nValid tests are: core, all"
fi
}
publish_target() {
cp README.md packages/lite_ref/README.md &&
if [ "$1" == "core" ]; then
echo "publishing core"
cd packages/lite_ref_core &&
dart pub publish
elif [ "$1" == "flutter" ]; then
echo "publishing flutter"
cd packages/lite_ref &&
dart pub publish
else
echo -e "unknown package \"$1\" \nValid packages are: core, flutter, lint"
fi
}
deps() {
cd $CURRENT_DIR/packages/lite_ref &&
flutter pub get &&
cd $CURRENT_DIR/examples/counter &&
flutter pub get &&
cd $CURRENT_DIR/examples/flutter_example &&
flutter pub get
}
if [ "$ACTION" == "test" ]; then
test_target $TARGET
elif [ "$ACTION" == "pub" ]; then
publish_target $TARGET
elif [ "$ACTION" == "deps" ]; then
deps
else
echo -e "Unknown action \"$ACTION\" \nValid actions are: test, publish"
fi