summaryrefslogtreecommitdiff
path: root/scripts/log_binary_size.sh
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-11-18 15:51:35 +0100
committerKonstantin Käfer <mail@kkaefer.com>2016-11-22 17:33:25 +0100
commitba2e44d4d72aa31246aa9ed06a655a446f885f12 (patch)
treefc6c88cbf880191f25eaafe7ed47852fdb1fd4cd /scripts/log_binary_size.sh
parent66e6946b8c22fca826fde9f08c89cff056a1d6f4 (diff)
downloadqtlocation-mapboxgl-ba2e44d4d72aa31246aa9ed06a655a446f885f12.tar.gz
[build] publish binary size statistics to S3
Diffstat (limited to 'scripts/log_binary_size.sh')
-rwxr-xr-xscripts/log_binary_size.sh26
1 files changed, 16 insertions, 10 deletions
diff --git a/scripts/log_binary_size.sh b/scripts/log_binary_size.sh
index 5de9438c53..3c55be15f1 100755
--- a/scripts/log_binary_size.sh
+++ b/scripts/log_binary_size.sh
@@ -2,16 +2,10 @@
set -e
set -o pipefail
+set -u
-function filesize {
- if [ `uname -s` = 'Darwin' ]; then
- stat -f%z $1
- else
- stat --printf=%s $1
- fi
-}
+# Logs metrics on binary size to CloudWatch
-# Uploads build metrics to CloudWatch
FILE=$1
DIMENSIONS=$2
@@ -20,16 +14,28 @@ if [ -z "${DIMENSIONS}" ]; then
exit 1
fi
+function filesize {
+ if [ `uname -s` = 'Darwin' ]; then
+ stat -f%z $1
+ else
+ stat --printf=%s $1
+ fi
+}
+
if [ -f "${FILE}" ]; then
SIZE=`filesize ${FILE}`
- echo "* Reporting `LC_NUMERIC=en_US printf "%'10.f\n" ${SIZE}` bytes for '${DIMENSIONS}' (${FILE})"
- if [ ${CLOUDWATCH} ]; then
+ if [ ${CLOUDWATCH:-} ]; then
+ echo "* Reporting `LC_NUMERIC=en_US printf "%'10.f\n" ${SIZE}` bytes for '${DIMENSIONS}' (${FILE})"
aws --region us-east-1 cloudwatch put-metric-data \
--namespace "Mapbox/GL" \
--metric-name "BinarySize" \
--unit "Bytes" \
--value ${SIZE} \
--dimensions "${DIMENSIONS}"
+
+ ./scripts/publish_binary_size.sh "${DIMENSIONS}"
+ else
+ echo "* Measured `LC_NUMERIC=en_US printf "%'10.f\n" ${SIZE}` bytes for '${DIMENSIONS}' (${FILE})"
fi
else
echo "* File '${FILE}' does not exist"