diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-11-18 15:51:35 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-11-22 17:33:25 +0100 |
commit | ba2e44d4d72aa31246aa9ed06a655a446f885f12 (patch) | |
tree | fc6c88cbf880191f25eaafe7ed47852fdb1fd4cd /scripts/log_binary_size.sh | |
parent | 66e6946b8c22fca826fde9f08c89cff056a1d6f4 (diff) | |
download | qtlocation-mapboxgl-ba2e44d4d72aa31246aa9ed06a655a446f885f12.tar.gz |
[build] publish binary size statistics to S3
Diffstat (limited to 'scripts/log_binary_size.sh')
-rwxr-xr-x | scripts/log_binary_size.sh | 26 |
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" |