Skip to content

Commit

Permalink
Fix Codecov.io Coverage Upload for Branch Builds (#3524)
Browse files Browse the repository at this point in the history
Testing the following undocumented option:
```yml
codecov:
  allow_coverage_offsets: true
```

Suggested by Codecov.io support [here](https://community.codecov.io/t/unable-to-determine-a-parent-commit-to-compare-against-in-base-branch-after-squash-and-merge/2480/15?u=mdemoret-nv) to fix the linked issue with missing base reports.

Authors:
  - Michael Demoret (@mdemoret-nv)

Approvers:
  - AJ Schmidt (@ajschmidt8)
  - John Zedlewski (@JohnZed)

URL: #3524
  • Loading branch information
mdemoret-nv authored Feb 24, 2021
1 parent 6f06d4b commit 6dfff66
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
17 changes: 13 additions & 4 deletions ci/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,19 @@ fi

if [ -n "${CODECOV_TOKEN}" ]; then

# NOTE: The code coverage upload needs to work for both PR builds and normal
# branch builds (aka `branch-0.XX`). Ensure the following settings to the
# codecov CLI will work with and without a PR
gpuci_logger "Uploading Code Coverage to codecov.io"

# Directory containing reports
REPORT_DIR="${WORKSPACE}/python/cuml"

# Base name to use in Codecov UI
CODECOV_NAME="${OS},py${PYTHON},cuda${CUDA}"
CODECOV_NAME=${JOB_BASE_NAME:-"${OS},py${PYTHON},cuda${CUDA}"}

# Codecov args needed by both calls
EXTRA_CODECOV_ARGS=""
EXTRA_CODECOV_ARGS="-c"

# Save the OS PYTHON and CUDA flags
EXTRA_CODECOV_ARGS="${EXTRA_CODECOV_ARGS} -e OS,PYTHON,CUDA"
Expand All @@ -264,8 +267,14 @@ if [ -n "${CODECOV_TOKEN}" ]; then
EXTRA_CODECOV_ARGS="${EXTRA_CODECOV_ARGS} -C ${REPORT_HASH}"
fi

# Append the PR ID. This is needed when running the build inside docker
EXTRA_CODECOV_ARGS="${EXTRA_CODECOV_ARGS} -P ${PR_ID} -c"
# Append the PR ID. This is needed when running the build inside docker for
# PR builds
if [ -n "${PR_ID}" ]; then
EXTRA_CODECOV_ARGS="${EXTRA_CODECOV_ARGS} -P ${PR_ID}"
fi

# Set the slug since this does not work in jenkins.
export CODECOV_SLUG="${PR_AUTHOR:-"rapidsai"}/cuml"

# Upload the two reports with separate flags. Delete the report on success
# to prevent further CI steps from re-uploading
Expand Down
6 changes: 6 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ coverage:
comment:
behavior: new

# Suggested workaround to fix "missing base report" issue when using Squash and
# Merge Strategy in GitHub. See this comment from CodeCov support about this
# undocumented option:
# https://community.codecov.io/t/unable-to-determine-a-parent-commit-to-compare-against-in-base-branch-after-squash-and-merge/2480/15
codecov:
allow_coverage_offsets: true

0 comments on commit 6dfff66

Please sign in to comment.