-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun.sh
executable file
·67 lines (53 loc) · 2.11 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
63
64
65
66
67
#!/bin/bash
set -e
set -x
function absolute_path {
[[ $1 = /* ]] && echo "$1" || echo "$(pwd)/${1#./}"
}
PARENT_DIRECTORY=$(dirname $(absolute_path "$0"))
ROOT_DIRECTORY=$(dirname "${PARENT_DIRECTORY}")
DASHBOARD_DIRECTORY="$ROOT_DIRECTORY/dashboard"
JEKYLL_DIRECTORY="$ROOT_DIRECTORY/dashboard_box/jekyll"
JEKYLL_BIN=${JEKYLL_BIN:-"/usr/local/bin/jekyll"}
DATA_DIRECTORY="$JEKYLL_DIRECTORY/_data"
FLUTTER_DIRECTORY="$ROOT_DIRECTORY/flutter"
SCRIPTS_DIRECTORY="$ROOT_DIRECTORY/dashboard_box"
GSUTIL=${GSUTIL:-"/Users/$USER/google-cloud-sdk/bin/gsutil"}
(cd ${ROOT_DIRECTORY}/dashboard_box; pub get)
# Run performance benchmarks
dart $SCRIPTS_DIRECTORY/bin/build.dart $ROOT_DIRECTORY
ANALYSIS="{ \"flutter_analyze_flutter_repo\": $(cat $DATA_DIRECTORY/analyzer_cli__analysis_time.json), "
ANALYSIS="${ANALYSIS} \"analysis_server_mega_gallery\": $(cat $DATA_DIRECTORY/analyzer_server__analysis_time.json) }"
echo $ANALYSIS > "$DATA_DIRECTORY/analysis.json"
BUILD_INFO_FILE="$DATA_DIRECTORY/build.json"
echo "{" > ${BUILD_INFO_FILE}
echo "\"build_timestamp\": \"$(date)\"," >> ${BUILD_INFO_FILE}
echo "\"dart_version\": \"$(dart --version 2>&1 | sed "s/\"/'/g")\"" >> ${BUILD_INFO_FILE}
echo "}" >> ${BUILD_INFO_FILE}
if [[ -d tmp ]]; then
rm -rf tmp
fi
$JEKYLL_BIN build --config $JEKYLL_DIRECTORY/_config_prod.yml --source $JEKYLL_DIRECTORY --destination tmp/
if [[ -d current ]]; then
TIMESTAMP=$(date +"%y-%m-%d-%H%M%S")
mv current $TIMESTAMP
fi
mv tmp current
if [[ "$UPLOAD_DASHBOARD_DATA" == "yes" ]]; then
$GSUTIL -m rsync -d -R -p $DASHBOARD_DIRECTORY gs://flutter-dashboard
$GSUTIL -m acl ch -R -g 'google.com:R' gs://flutter-dashboard/current
$GSUTIL -m acl ch -R -u '[email protected]:R' gs://flutter-dashboard/current
set +e
shopt -s nullglob
for f in $DATA_DIRECTORY/*.json ; do
if [[ ( "$f" == *analysis.json ) || ( "$f" == *summaries.json )]] ; then
continue
fi
dart ${ROOT_DIRECTORY}/dashboard_box/bin/firebase_uploader.dart $f
done
set -e
fi
echo "-----------------------------------------"
echo "Build finished on $(date)"
echo "-----------------------------------------"
echo