Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Tweak our code coverage profile behavior #14967

Merged
merged 23 commits into from
Feb 2, 2024

Conversation

mattlord
Copy link
Contributor

@mattlord mattlord commented Jan 16, 2024

Description

This PR makes the following changes:

  1. Adds a repo/project level codecov configuration file (./codecov.yml) to tweak the settings based on our early experiences
  2. Adds the -coverpkg=vitess.io/vitess/go/... flag to our go test invocation to better calculate package level coverage when testing is done across packages
  3. Adds the -covermode=atomic flag to our go test invocation to support parallel work
  4. Increases the GitHub Actions runner size for the code coverage workflow to match what we use for the unit race workflows as the the code coverage workflow — which has, now cross package, coverage profiling enabled — is also heavier than the basic unit test workflows and processes were often getting killed
  5. Modifies the codecov GitHub Actions workflow params so that the output is verbose and if we fail to upload the report it causes the workflow to fail
  6. Moves the codecov GitHub Actions workflow from using v3 of the action to v4. This replaces the previous universal-uploader with usage of the codecov CLI. The issue we had seen was that once we enabled the cross package coverage, we saw this error when uploading the report:
    Could not read coverage file (coverage.out): Error: There was an error reading the coverage file: Error: Cannot create a string longer than 0x1fffffe8 characters

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Copy link
Contributor

vitess-bot bot commented Jan 16, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Jan 16, 2024
@github-actions github-actions bot added this to the v19.0.0 milestone Jan 16, 2024
@mattlord mattlord added Type: Internal Cleanup Component: Build/CI Type: CI/Build and removed NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required Type: Internal Cleanup NeedsWebsiteDocsUpdate What it says labels Jan 16, 2024
As processes seem to be getting killed

Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord removed the NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work label Jan 16, 2024
@mattlord mattlord marked this pull request as ready for review January 16, 2024 18:07
@mattlord mattlord requested review from dbussink and systay January 16, 2024 18:07
@mattlord mattlord changed the title Tweak our code coverage profile behavior CI: Tweak our code coverage profile behavior Jan 16, 2024
The report.xml file in git seemed to be causing codecov
issues.

Signed-off-by: Matt Lord <[email protected]>
codecov.yml Outdated
- "go/test/endtoend"
- "go/*/endtoend"
- "go/vt/*/endtoend"
- "go/cmd/vttestserver" # This relies on end-to-end test packages
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we exclude all cached_size.go files as well as generated code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added here: 56f139f

Please let me know if you think we should remove any of the added ignore lines. Thanks!

Copy link
Member

@harshit-gangal harshit-gangal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed earlier, can we disable codecov comments on the file changes.

@mattlord
Copy link
Contributor Author

As discussed earlier, can we disable codecov comments on the file changes.

This page notes how we can toggle them on and off in the PR's Changed Files view, as well as how we can disable them entirely: https://docs.codecov.com/docs/github-checks#hiding-annotations-in-the-files-view

Do you think that we should disable them globally or make it more well known how to toggle them on and off during PR review? I'm OK either way. You can also see the untested lines in a better UI when you view the commit in codecov using the link added to main codecov PR comment. For example (click on a file): https://app.codecov.io/gh/vitessio/vitess/pull/15096

Signed-off-by: Matt Lord <[email protected]>
It would only pass if:
  - You had a snap-private-tmp sub-dir in /tmp
  - You did not have permissions to read it

Signed-off-by: Matt Lord <[email protected]>
Copy link

codecov bot commented Jan 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (aecf793) 47.80% compared to head (c2fe9d2) 70.63%.
Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main   #14967       +/-   ##
===========================================
+ Coverage   47.80%   70.63%   +22.82%     
===========================================
  Files        1155     1375      +220     
  Lines      240308   182222    -58086     
===========================================
+ Hits       114890   128715    +13825     
+ Misses     116846    53507    -63339     
+ Partials     8572        0     -8572     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@frouioui frouioui self-requested a review February 1, 2024 15:24
Copy link
Contributor

@ajm188 ajm188 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we should ignore generated protobuf stuff, too; otherwise lgtm!

codecov.yml Show resolved Hide resolved
- "go/mysql/collations/supported.go" # Code generated by makecolldata

comment: # https://docs.codecov.com/docs/pull-request-comments
hide_project_coverage: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just stating for posterity that i'm good with this given that https://docs.codecov.com/docs/github-checks#hiding-annotations-in-the-files-view exists

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had no idea this existed, but tested and approved
image

Makefile Outdated Show resolved Hide resolved
Copy link
Member

@frouioui frouioui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a bunch @mattlord

Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord merged commit 6e7645c into vitessio:main Feb 2, 2024
102 checks passed
@mattlord mattlord deleted the codecov_tweaks branch February 2, 2024 01:58
@mattlord mattlord mentioned this pull request Feb 10, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants