summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmkiley <jordan.kiley@mapbox.com>2019-03-04 12:56:57 -0800
committerjmkiley <jordan.kiley@mapbox.com>2019-03-11 12:54:50 -0700
commitcb18d61c2831ae8072335ebf8b369996ca01b3c8 (patch)
tree4585fa3e50ddc603554fec6849c3934d7e626c03
parentd44c1123ffd722215e79ecd6e6ae4eed965cd255 (diff)
downloadqtlocation-mapboxgl-cb18d61c2831ae8072335ebf8b369996ca01b3c8.tar.gz
[ios] Check whether file exists, add gzip
-rwxr-xr-xplatform/ios/scripts/code-coverage.sh16
1 files changed, 13 insertions, 3 deletions
diff --git a/platform/ios/scripts/code-coverage.sh b/platform/ios/scripts/code-coverage.sh
index 04cb712eae..00f64432c0 100755
--- a/platform/ios/scripts/code-coverage.sh
+++ b/platform/ios/scripts/code-coverage.sh
@@ -4,7 +4,16 @@ set -e
set -o pipefail
# Get code coverage, then convert it to JSON.
-cov_result=build/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport
+cov_result="";
+if [ -f build/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport ]; then
+ cov_result=build/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport
+elif [ -f build/ios/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport ]; then
+ cov_result=build/ios/ios/Logs/Test/*.xcresult/*_Test/*.xccovreport
+else
+ echo "Coverage file does not exist"
+ exit 1
+fi
+
xcrun xccov view $cov_result --json > output.json
#
@@ -16,13 +25,14 @@ cov=$(printf "%.2f" $(echo "$percentage*100" | bc -l))
#
# Create a formatted JSON file with the current coverage.
#
-file_name="ios-coverage-$(TZ=UTC date +"%Y-%m-%d-$CIRCLE_SHA1")"
+file_name="ios-coverage-$(TZ=UTC date +"%Y-%m-%d")"
cat <<EOF > $file_name.json
{ "current-coverage" : $cov }
EOF
echo $cov
echo $file_name
+gzip -f $file_name.json
#
# upload to AWS
#
@@ -30,4 +40,4 @@ echo $file_name
if [ -z `which aws` ]; then
brew install awscli
fi
-aws s3 cp $file_name.json s3://mapbox-loading-dock/raw/mobile.coverage/ \ No newline at end of file
+aws s3 cp $file_name.json.gz s3://mapbox-loading-dock/raw/mobile.coverage/ \ No newline at end of file