Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .evergreen/generated_configs/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ functions:
- github_pr_number
- github_pr_head_branch
- github_author
- is_patch
- branch_name
type: test

# Upload coverage
Expand Down
2 changes: 2 additions & 0 deletions .evergreen/scripts/generate_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,8 @@ def create_upload_coverage_codecov_func():
"github_pr_number",
"github_pr_head_branch",
"github_author",
"is_patch",
"branch_name",
]
args = [
".evergreen/scripts/upload-codecov.sh",
Expand Down
47 changes: 31 additions & 16 deletions .evergreen/scripts/upload-codecov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,49 @@ ROOT=$(dirname "$(dirname $HERE)")
pushd $ROOT > /dev/null
export FNAME=coverage.xml

if [ -z "${github_pr_number:-}" ]; then
echo "This is not a PR, not running codecov"
if [ -n "${is_patch:-}" ]; then
echo "This is a patch build, not running codecov"
exit 0
fi

if [ ! -f ".coverage" ]; then
echo "There are no XML test results, not running codecov"
echo "There are no coverage results, not running codecov"
exit 0
fi

echo "Uploading..."
printf 'pr: %s\n' "$github_pr_number"
printf 'sha: %s\n' "$github_commit"
printf 'branch: %s:%s\n' "$github_author" "$github_pr_head_branch"
printf 'flag: %s-%s\n' "$build_variant" "$task_name"
printf 'file: %s\n' "$FNAME"
uv tool run --with "coverage[toml]" coverage xml
uv tool run --from codecov-cli codecovcli upload-process \
--report-type coverage \
--disable-search \
--fail-on-error \
--git-service github \
--token ${CODECOV_TOKEN} \
--pr ${github_pr_number} \
--sha ${github_commit} \
--branch "${github_author}:${github_pr_head_branch}" \
--flag "${build_variant}-${task_name}" \
--file $FNAME

codecov_args=(
upload-process
--report-type coverage
--disable-search
--fail-on-error
--git-service github
--token "${CODECOV_TOKEN}"
--sha "${github_commit}"
--flag "${build_variant}-${task_name}"
--file "${FNAME}"
)

if [ -n "${github_pr_number:-}" ]; then
printf 'branch: %s:%s\n' "$github_author" "$github_pr_head_branch"
printf 'pr: %s\n' "$github_pr_number"

uv tool run --from codecov-cli codecovcli \
"${codecov_args[@]}" \
--pr "${github_pr_number}" \
--branch "${github_author}:${github_pr_head_branch}"
else
printf 'branch: %s\n' "$branch_name"

uv tool run --from codecov-cli codecovcli \
"${codecov_args[@]}" \
--branch "${branch_name}"
fi
echo "Uploading...done."

popd > /dev/null
Loading