forked from flutter/codelabs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flutter_ci_script_shared.sh
executable file
·49 lines (39 loc) · 1.35 KB
/
flutter_ci_script_shared.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
function ci_codelabs () {
local channel="$1"
shift
# plugin_codelab is a special case since it's a plugin. Analysis doesn't seem to be working.
pushd $PWD
echo "== TESTING plugin_codelab on $channel"
cd ./plugin_codelab
dart format --output none --set-exit-if-changed .;
popd
local arr=("$@")
for CODELAB in "${arr[@]}"
do
echo "== Testing '${CODELAB}' on $channel"
declare -a PROJECT_PATHS=($(
find $CODELAB -not -path './flutter/*' -not -path './plugin_codelab/pubspec.yaml' -name pubspec.yaml -exec dirname {} \; | sort
))
for PROJECT in "${PROJECT_PATHS[@]}"
do
pushd "${PROJECT}"
echo "== Getting dependencies for ${PROJECT}"
for dir in `find . -name pubspec.yaml -exec dirname {} \;`; do
pushd $dir
flutter pub get
popd
done
echo "== Testing"
# Run the analyzer to find any static analysis issues.
dart analyze --fatal-infos
# Run the formatter on all the dart files to make sure everything's linted.
dart format --output none --set-exit-if-changed .
# Run the actual tests.
if [ -d "test" ]
then
flutter test
fi
popd
done
done
}