Skip to content
Permalink
Browse files

Fix uploading coverage report. Add report on per PR basis. (#3395)

Summary:
Supply AWS keys to fix coverage build which got broken after migration from Travis.

Documentation:
n/a
Pull Request resolved: #3395

Test Plan: CI

Differential Revision: D16692406

Pulled By: rdzhabarov

fbshipit-source-id: 8abed31d2ded9f6c35ef7c5b678918106459b1d3
  • Loading branch information...
rdzhabarov authored and facebook-github-bot committed Aug 7, 2019
1 parent 51c1de4 commit 8a24288247caf19837ff109879f3ef3f9b4bd687
Showing with 8 additions and 12 deletions.
  1. +1 −1 .circleci/config.yml
  2. +6 −10 .circleci/run_coverage.sh
  3. +1 −1 cmake/modules/CoverageSupport.cmake
@@ -66,7 +66,7 @@ linux_default: &linux_default
name: Test
no_output_timeout: "1h"
command: |
docker exec -e CIRCLE_BRANCH=${CIRCLE_BRANCH} -e CIRCLE_JOB=${CIRCLE_JOB} -u jenkins $(cat .docker_pid) .circleci/test.sh
docker exec -e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} -e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} -e CIRCLE_BRANCH=${CIRCLE_BRANCH} -e CIRCLE_JOB=${CIRCLE_JOB} -u jenkins $(cat .docker_pid) .circleci/test.sh
jobs:
DEBUG:
@@ -8,15 +8,11 @@ if [ ! -f "${COVERAGE_FILE}" ]; then
fi

# Upload coverage only on master branch.
if [ "${CIRCLE_BRANCH}" == "master" ]; then
echo "INFO: Uploading coverage to S3."
echo "INFO: Uploading coverage to S3."

BRANCH_NAME="${CIRCLE_BRANCH}"
COVERAGE_DIR="$(dirname "${COVERAGE_FILE}")"
UPLOAD_LOCATION="fb-glow-assets/coverage/coverage-${BRANCH_NAME}"
BRANCH_NAME="${CIRCLE_BRANCH}"
COVERAGE_DIR="$(dirname "${COVERAGE_FILE}")"
UPLOAD_LOCATION="fb-glow-assets/coverage/coverage-${BRANCH_NAME}"

aws s3 cp "${COVERAGE_DIR}" "s3://${UPLOAD_LOCATION}" --recursive --acl public-read
echo "INFO: Coverage report for branch '${BRANCH_NAME}': https://fb-glow-assets.s3.amazonaws.com/coverage/coverage-${BRANCH_NAME}/index.html"
else
echo "WARNING: Coverage cannot be uploaded to s3 for PR from a fork, branch: ${CIRCLE_BRANCH}."
fi
aws s3 cp "${COVERAGE_DIR}" "s3://${UPLOAD_LOCATION}" --recursive --acl public-read
echo "INFO: Coverage report for branch '${BRANCH_NAME}': https://fb-glow-assets.s3.amazonaws.com/coverage/coverage-${BRANCH_NAME}/index.html"
@@ -50,7 +50,7 @@ if(GLOW_USE_COVERAGE)
COMMAND ${LCOV_PATH} --no-checksum --directory . --capture --output-file glow_coverage.info

# Ignore not related files.
COMMAND ${LCOV_PATH} --remove glow_coverage.info '*v1*' '/usr/*' '*tests/*' '*llvm_install*' --output-file ${PROJECT_BINARY_DIR}/glow_coverage_result.info
COMMAND ${LCOV_PATH} --remove glow_coverage.info '*v1*' '/usr/*' '*tests/*' '*llvm_install*' 'build/*' --output-file ${PROJECT_BINARY_DIR}/glow_coverage_result.info

# Generate HTML report based on the profiles.
COMMAND ${GENHTML_PATH} -o glow_coverage ${PROJECT_BINARY_DIR}/glow_coverage_result.info

0 comments on commit 8a24288

Please sign in to comment.
You can’t perform that action at this time.