[build] add binary size logging to Linux Release builds

This commit is contained in:
Konstantin Käfer
2016-11-07 18:38:01 +01:00
committed by John Firebaugh
parent c78c97f346
commit 223a95a74f
5 changed files with 97 additions and 36 deletions

View File

@@ -49,6 +49,8 @@ script:
after_script:
- ccache --show-stats
- ./platform/linux/scripts/after_script.sh ${TRAVIS_JOB_NUMBER}
after_success:
- ./platform/linux/scripts/after_success.sh
matrix:
include:

View File

@@ -7,42 +7,6 @@
"Type": "AWS::IAM::User",
"Properties": {
"Policies": [
{
"PolicyName": "list-testing-old",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:ListBucket"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::mapbox-gl-testing"
]
}
]
}
},
{
"PolicyName": "build-testing-old",
"PolicyDocument": {
"Statement": [
{
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::mapbox-gl-testing/*"
]
}
]
}
},
{
"PolicyName": "list-testing",
"PolicyDocument": {
@@ -148,6 +112,24 @@
}
]
}
},
{
"PolicyName": "cloudwatch-metrics",
"PolicyDocument": {
"Statement": [
{
"Action": [
"cloudwatch:PutMetricData",
"cloudwatch:GetMetricData",
"cloudwatch:GetMetricStatistics"
],
"Effect": "Allow",
"Resource": [
"*"
]
}
]
}
}
]
}
@@ -179,6 +161,24 @@
}
]
}
},
{
"PolicyName": "cloudwatch-metrics",
"PolicyDocument": {
"Statement": [
{
"Action": [
"cloudwatch:PutMetricData",
"cloudwatch:GetMetricData",
"cloudwatch:GetMetricStatistics"
],
"Effect": "Allow",
"Resource": [
"*"
]
}
]
}
}
]
}

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [ "${TRAVIS_PULL_REQUEST_BRANCH:-${TRAVIS_BRANCH}}" = "master" ] && [ "${BUILDTYPE}" = "Release" ]; then
CLOUDWATCH=true platform/linux/scripts/metrics.sh
else
echo "Not logging binary size for branch or Debug build"
fi

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e
set -o pipefail
# Generate stripped version
ARCH=$(uname -m)
RENDER=build/linux-${ARCH}/Release/mbgl-render
strip -s -x "${RENDER}" -o "${RENDER}-stripped"
# Track individual architecture
scripts/log_binary_size.sh "${RENDER}-stripped" "Platform=Linux,Compiler=${_CC},Arch=${ARCH}"

37
scripts/log_binary_size.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -e
set -o pipefail
function filesize {
if [ `uname -s` = 'Darwin' ]; then
stat -f%z $1
else
stat --printf=%s $1
fi
}
# Uploads build metrics to CloudWatch
FILE=$1
DIMENSIONS=$2
if [ -z "${DIMENSIONS}" ]; then
echo "* No dimensions specified for '${FILE}'"
exit 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
aws --region us-east-1 cloudwatch put-metric-data \
--namespace "Mapbox/GL" \
--metric-name "BinarySize" \
--unit "Bytes" \
--value ${SIZE} \
--dimensions "${DIMENSIONS}"
fi
else
echo "* File '${FILE}' does not exist"
exit 1
fi