-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #336 from suleymanakbas91/codecov
OCPVE-286: Introduce code coverage tooling
- Loading branch information
Showing
35 changed files
with
90 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
codecov: | ||
notify: | ||
require_ci_to_pass: no | ||
wait_for_ci: no | ||
|
||
coverage: | ||
precision: 2 | ||
round: down | ||
range: "20...100" | ||
|
||
status: | ||
project: no | ||
patch: no | ||
changes: no | ||
|
||
parsers: | ||
gcov: | ||
branch_detection: | ||
conditional: yes | ||
loop: yes | ||
method: no | ||
macro: no | ||
|
||
comment: | ||
layout: "reach,diff,flags,tree" | ||
behavior: default | ||
require_changes: no | ||
|
||
ignore: | ||
- "test/**/*" | ||
- "**/mocks" | ||
- "**/zz_generated*.go" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
REPO_ROOT=$(git rev-parse --show-toplevel) | ||
CI_SERVER_URL=https://prow.svc.ci.openshift.org/view/gcs/origin-ci-test | ||
COVER_PROFILE=${COVER_PROFILE:-coverage.out} | ||
JOB_TYPE=${JOB_TYPE:-"local"} | ||
|
||
# Configure the git refs and job link based on how the job was triggered via prow | ||
if [[ "${JOB_TYPE}" == "presubmit" ]]; then | ||
echo "detected PR code coverage job for #${PULL_NUMBER}" | ||
REF_FLAGS="-P ${PULL_NUMBER} -C ${PULL_PULL_SHA}" | ||
JOB_LINK="${CI_SERVER_URL}/pr-logs/pull/${REPO_OWNER}_${REPO_NAME}/${PULL_NUMBER}/${JOB_NAME}/${BUILD_ID}" | ||
elif [[ "${JOB_TYPE}" == "postsubmit" ]]; then | ||
echo "detected branch code coverage job for ${PULL_BASE_REF}" | ||
REF_FLAGS="-B ${PULL_BASE_REF} -C ${PULL_BASE_SHA}" | ||
JOB_LINK="${CI_SERVER_URL}/logs/${JOB_NAME}/${BUILD_ID}" | ||
elif [[ "${JOB_TYPE}" == "local" ]]; then | ||
echo "coverage report available at ${COVER_PROFILE}" | ||
exit 0 | ||
else | ||
echo "${JOB_TYPE} jobs not supported" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Configure certain internal codecov variables with values from prow. | ||
export CI_BUILD_URL="${JOB_LINK}" | ||
export CI_BUILD_ID="${JOB_NAME}" | ||
export CI_JOB_ID="${BUILD_ID}" | ||
|
||
if [[ "${JOB_TYPE}" != "local" ]]; then | ||
if [[ -z "${ARTIFACT_DIR:-}" ]] || [[ ! -d "${ARTIFACT_DIR}" ]] || [[ ! -w "${ARTIFACT_DIR}" ]]; then | ||
echo '${ARTIFACT_DIR} must be set for non-local jobs, and must point to a writable directory' >&2 | ||
exit 1 | ||
fi | ||
curl -sS https://codecov.io/bash -o "${ARTIFACT_DIR}/codecov.sh" | ||
bash <(cat "${ARTIFACT_DIR}/codecov.sh") -Z -K -f "${COVER_PROFILE}" -r "${REPO_OWNER}/${REPO_NAME}" ${REF_FLAGS} | ||
else | ||
bash <(curl -s https://codecov.io/bash) -Z -K -f "${COVER_PROFILE}" -r "${REPO_OWNER}/${REPO_NAME}" ${REF_FLAGS} | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.