diff options
author | jmkiley <jordan.kiley@mapbox.com> | 2019-03-07 14:58:25 -0800 |
---|---|---|
committer | jmkiley <jordan.kiley@mapbox.com> | 2019-03-11 12:54:51 -0700 |
commit | bf79d1d8a1f03da100d50e92e6fdf2c0a1bcccde (patch) | |
tree | 9bd8d554d2963d23ff62a633d510c31f22a83a22 | |
parent | 2aa49f9fc1fdda968ae71f15ddfd9c7729b45f92 (diff) | |
download | qtlocation-mapboxgl-bf79d1d8a1f03da100d50e92e6fdf2c0a1bcccde.tar.gz |
[build] check aws exit code
-rwxr-xr-x | scripts/code-coverage.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/code-coverage.sh b/scripts/code-coverage.sh new file mode 100755 index 0000000000..84e4a52481 --- /dev/null +++ b/scripts/code-coverage.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +# +# Check whether the script input values are valid. +# +# Check that platform is "ios" or "android". +if [[ ! $2 = "ios" && ! $2 = "android" ]]; then + echo "$2 does not match either 'ios' or 'android'. Platform must be specified for coverage report." + exit 1 +fi + +# +# Check whether a scheme was specified. +# +scheme="" +if [ -z $3 ]; then + echo "Scheme was not specified" +else + scheme=$3 +fi + + +# +# Create a formatted JSON file with the current coverage. +# +current_date=$(TZ=UTC date +"%Y-%m-%d") +file_name=$2_coverage.json +cat <<EOF > $file_name + {"code_coverage":$1,"platform":"$2","sdk":"maps","scheme":"$scheme","created_at":"$current_date"} +EOF +echo $file_name +gzip -f $file_name + +# +# upload to AWS +# +if [ -z `which aws` ]; then + brew install awscli +fi + +# If this is being executed by CI, upload the file to AWS. +if [ ! -z $CIRCLE_SHA]; then + aws s3 cp $file_name.gz s3://mapbox-loading-dock/raw/mobile.codecoverage/$current_date/ + echo $ +fi + |