blob: 7448df71fd79b2d3a86dc45e84887085a308c061 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
|