forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coverage_publish.sh
executable file
·33 lines (26 loc) · 967 Bytes
/
coverage_publish.sh
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
#!/bin/bash
# Do not ever set -x here, it is a security hazard as it will place the credentials below in the
# CircleCI logs.
set -e
if [ "${CIRCLECI}" != "true" ]; then
exit 0
fi
# available for master builds
if [ -z "$CIRCLE_PR_NUMBER" ]
then
echo "Uploading coverage report..."
[[ -z "${ENVOY_BUILD_DIR}" ]] && ENVOY_BUILD_DIR=/build
COVERAGE_FILE="${ENVOY_BUILD_DIR}/envoy/generated/coverage/coverage.html"
if [ ! -f "${COVERAGE_FILE}" ]; then
echo "ERROR: Coverage file not found."
exit 1
fi
BRANCH_NAME="${CIRCLE_BRANCH}"
COVERAGE_DIR="$(dirname "${COVERAGE_FILE}")"
S3_LOCATION="lyft-envoy/coverage/report-${BRANCH_NAME}"
pip install awscli --upgrade
aws s3 cp "${COVERAGE_DIR}" "s3://${S3_LOCATION}" --recursive --acl public-read --quiet --sse
echo "Coverage report for branch '${BRANCH_NAME}': https://s3.amazonaws.com/${S3_LOCATION}/coverage.html"
else
echo "Coverage report will not be uploaded for this build."
fi