summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJordan Kiley <jmkiley@users.noreply.github.com>2019-03-13 12:58:24 -0700
committerGitHub <noreply@github.com>2019-03-13 12:58:24 -0700
commitfb0b0d5a2bb89a6a7d5137e0c610e2c5105c26d3 (patch)
treec21d8cc0cbd9aadf63f9c245b7cc79e8533af4ed /scripts
parent979433eddb5a8f2180aba134befb08b222718bc8 (diff)
downloadqtlocation-mapboxgl-fb0b0d5a2bb89a6a7d5137e0c610e2c5105c26d3.tar.gz
[ios] Generate iOS code coverage for metrics (#14015)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/code-coverage.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/code-coverage.sh b/scripts/code-coverage.sh
new file mode 100755
index 0000000000..d6866f61b8
--- /dev/null
+++ b/scripts/code-coverage.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+#
+# This script takes three values: $1 should be a decimal value reflecting the
+# percentage of lines covered, with a maximum value of 100.0, $2 is
+# the platform the percentage pertains to (iOS or Android), and $3 is the
+# test scheme being run (on iOS, this is currently CI).
+#
+
+# Check that platform input values are valid.
+
+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
+
+# Create a formatted JSON file that contains 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":"$3","created_at":"$current_date"}
+EOF
+gzip -f $file_name
+
+if [ -z `which aws` ]; then
+ brew install awscli
+fi
+
+aws s3 cp $file_name.gz s3://mapbox-loading-dock/raw/mobile.codecoverage/$current_date/
+echo $
+