From ba2e44d4d72aa31246aa9ed06a655a446f885f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Fri, 18 Nov 2016 15:51:35 +0100 Subject: [build] publish binary size statistics to S3 --- scripts/log_binary_size.sh | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'scripts/log_binary_size.sh') 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" -- cgit v1.2.1