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

[NoMongo] Fix : CodeCov GitHub Action #3271

Merged
merged 6 commits into from
Jan 14, 2025
Merged

Conversation

varshith257
Copy link
Member

@varshith257 varshith257 commented Jan 14, 2025

What kind of change does this PR introduce?

Issue Number:

Fixes #3269
Snapshots/Videos:

If relevant, did you update the documentation?

Summary

Does this PR introduce a breaking change?

Summary by CodeRabbit

  • Chores
    • Enhanced GitHub Actions workflow for improved code coverage reporting.
    • Added direct uploads for Jest and Vitest coverage reports to Codecov.
    • Removed the intermediate coverage report merging step.
    • Introduced a combined coverage upload step to streamline reporting.
    • Updated minimum coverage requirement from 0.0 to 90.0.

Copy link
Contributor

coderabbitai bot commented Jan 14, 2025

Warning

Rate limit exceeded

@varshith257 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 13 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b2fee63 and 9da9478.

📒 Files selected for processing (1)
  • .github/workflows/pull-request.yml (1 hunks)

Walkthrough

The pull request modifies the GitHub Actions workflow configuration in pull-request.yml, focusing on code coverage reporting. The changes introduce separate steps for uploading Jest and Vitest coverage reports to Codecov, replacing the previous method of merging coverage reports. This update aims to streamline the coverage reporting process by directly uploading individual test framework reports and adding a combined coverage upload step.

Changes

File Change Summary
.github/workflows/pull-request.yml - Added "Upload Jest Coverage to Codecov" step
- Added "Upload Vitest Coverage to Codecov" step
- Removed "Merge Coverage Reports" step
- Added "Upload Combined Coverage to Codecov" step
- Updated minimum coverage requirement from 0.0 to 90.0

Assessment against linked issues

Objective Addressed Explanation
Correct Code Coverage calculations being reflected in the charting (#3269)
Migration of CodeCov reporting for Jest and Vitest (#3269)
Eliminate incorrect merging of coverage reports (#3269)

Possibly related PRs

Suggested reviewers

  • palisadoes
  • AVtheking
  • gautam-divyanshu

Poem

🐰 Coverage rabbits hop and leap,
Through Jest and Vitest, metrics we keep!
No more merging, reports now fly free,
Codecov dancing with agility!
Hop, hop, hooray for clean CI! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

@varshith257 varshith257 added the ignore-sensitive-files-pr The contributor has a legitimate reason for editiing protected files label Jan 14, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/pull-request.yml (1)

254-275: Good architectural decision to upload coverage reports separately.

The approach of uploading Jest and Vitest coverage reports separately is better than merging them because:

  1. It provides granular coverage data for each testing framework
  2. It avoids potential format compatibility issues
  3. It simplifies debugging coverage issues
🧰 Tools
🪛 actionlint (1.7.4)

256-256: the runner of "codecov/codecov-action@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


271-271: the runner of "codecov/codecov-action@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)

[error] 275-275: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 394d0e1 and fc7ce34.

📒 Files selected for processing (1)
  • .github/workflows/pull-request.yml (1 hunks)
🧰 Additional context used
📓 Learnings (2)
📓 Common learnings
Learnt from: prayanshchh
PR: PalisadoesFoundation/talawa-admin#2457
File: .github/workflows/pull-request.yml:0-0
Timestamp: 2024-11-26T07:19:31.226Z
Learning: When merging coverage reports from Jest and Vitest, ensure both testing frameworks output coverage in the same format (e.g., 'lcov') and use a compatible tool like 'lcov-result-merger' to combine the reports, as 'nyc merge' may not handle the different coverage formats correctly.
.github/workflows/pull-request.yml (1)
Learnt from: prayanshchh
PR: PalisadoesFoundation/talawa-admin#2457
File: .github/workflows/pull-request.yml:0-0
Timestamp: 2024-11-26T07:19:31.226Z
Learning: When merging coverage reports from Jest and Vitest, ensure both testing frameworks output coverage in the same format (e.g., 'lcov') and use a compatible tool like 'lcov-result-merger' to combine the reports, as 'nyc merge' may not handle the different coverage formats correctly.
🪛 actionlint (1.7.4)
.github/workflows/pull-request.yml

256-256: the runner of "codecov/codecov-action@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


271-271: the runner of "codecov/codecov-action@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 yamllint (1.35.1)
.github/workflows/pull-request.yml

[error] 275-275: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Test Application
  • GitHub Check: Check Python Code Style
  • GitHub Check: Analyse Code With CodeQL (javascript)

.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.24%. Comparing base (394d0e1) to head (9da9478).
Report is 3 commits behind head on develop-postgres.

Additional details and impacted files
@@                  Coverage Diff                  @@
##           develop-postgres    #3271       +/-   ##
=====================================================
+ Coverage              8.49%   90.24%   +81.75%     
=====================================================
  Files                   309      330       +21     
  Lines                  7832     8492      +660     
  Branches               1730     1875      +145     
=====================================================
+ Hits                    665     7664     +6999     
+ Misses                 7093      598     -6495     
- Partials                 74      230      +156     
Flag Coverage Δ
combined 90.24% <ø> (?)
jest 8.49% <ø> (?)
vitest 90.24% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/pull-request.yml (1)

254-276: Ensure consistent configuration between Jest and Vitest coverage uploads.

The coverage upload steps have inconsistencies in their configuration:

  1. Different versions of codecov-action (v3 vs v4)
  2. Inconsistent token usage (missing vs present)
  3. Reversed conditions for execution

Consider standardizing the configuration between the two steps to ensure consistent behavior and maintainability. The steps should:

  1. Use the same version of codecov-action (v4)
  2. Both include authentication tokens
  3. Have logically correct and consistent conditions
🧰 Tools
🪛 actionlint (1.7.4)

256-256: the runner of "codecov/codecov-action@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc7ce34 and 38fcd66.

📒 Files selected for processing (1)
  • .github/workflows/pull-request.yml (1 hunks)
🧰 Additional context used
📓 Learnings (2)
📓 Common learnings
Learnt from: prayanshchh
PR: PalisadoesFoundation/talawa-admin#2457
File: .github/workflows/pull-request.yml:0-0
Timestamp: 2024-11-26T07:19:31.226Z
Learning: When merging coverage reports from Jest and Vitest, ensure both testing frameworks output coverage in the same format (e.g., 'lcov') and use a compatible tool like 'lcov-result-merger' to combine the reports, as 'nyc merge' may not handle the different coverage formats correctly.
.github/workflows/pull-request.yml (1)
Learnt from: prayanshchh
PR: PalisadoesFoundation/talawa-admin#2457
File: .github/workflows/pull-request.yml:0-0
Timestamp: 2024-11-26T07:19:31.226Z
Learning: When merging coverage reports from Jest and Vitest, ensure both testing frameworks output coverage in the same format (e.g., 'lcov') and use a compatible tool like 'lcov-result-merger' to combine the reports, as 'nyc merge' may not handle the different coverage formats correctly.
🪛 actionlint (1.7.4)
.github/workflows/pull-request.yml

256-256: the runner of "codecov/codecov-action@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Check Python Code Style
  • GitHub Check: Test Application
  • GitHub Check: Analyse Code With CodeQL (javascript)
  • GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (2)
.github/workflows/pull-request.yml (2)

269-276: ⚠️ Potential issue

Fix condition logic for Vitest coverage upload.

The condition for Vitest coverage upload seems reversed. It should upload when no files have changed.

Apply this diff to fix the condition:

       - name: Upload Vitest Coverage to Codecov
-        if: steps.changed-files.outputs.any_changed == 'true'
+        if: steps.changed-files.outputs.only_changed != 'true'
         uses: codecov/codecov-action@v4
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           files: ./coverage/vitest/lcov.info
           flags: vitest
           fail_ci_if_error: true

Likely invalid or redundant comment.


254-261: ⚠️ Potential issue

Update codecov-action version and fix condition logic for Jest coverage upload.

The Jest coverage upload step needs the following improvements:

  1. Update to the latest version of codecov-action
  2. Add token for authentication
  3. Fix the condition logic (should upload when TypeScript files change)

Apply this diff to fix the issues:

       - name: Upload Jest Coverage to Codecov
-        if: steps.changed-files.outputs.only_changed != 'true'
+        if: steps.changed-files.outputs.any_changed == 'true'
-        uses: codecov/codecov-action@v3
+        uses: codecov/codecov-action@v4
         with:
+          token: ${{ secrets.CODECOV_TOKEN }}
           files: ./coverage/jest/lcov.info
           flags: jest
           fail_ci_if_error: true

Likely invalid or redundant comment.

🧰 Tools
🪛 actionlint (1.7.4)

256-256: the runner of "codecov/codecov-action@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 14, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/pull-request.yml (1)

283-283: Fix trailing spaces.

Remove trailing spaces at the end of line 283.

-  
+
🧰 Tools
🪛 yamllint (1.35.1)

[error] 283-283: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38fcd66 and 66a4529.

📒 Files selected for processing (1)
  • .github/workflows/pull-request.yml (1 hunks)
🧰 Additional context used
📓 Learnings (2)
📓 Common learnings
Learnt from: prayanshchh
PR: PalisadoesFoundation/talawa-admin#2457
File: .github/workflows/pull-request.yml:0-0
Timestamp: 2024-11-26T07:19:31.226Z
Learning: When merging coverage reports from Jest and Vitest, ensure both testing frameworks output coverage in the same format (e.g., 'lcov') and use a compatible tool like 'lcov-result-merger' to combine the reports, as 'nyc merge' may not handle the different coverage formats correctly.
.github/workflows/pull-request.yml (1)
Learnt from: prayanshchh
PR: PalisadoesFoundation/talawa-admin#2457
File: .github/workflows/pull-request.yml:0-0
Timestamp: 2024-11-26T07:19:31.226Z
Learning: When merging coverage reports from Jest and Vitest, ensure both testing frameworks output coverage in the same format (e.g., 'lcov') and use a compatible tool like 'lcov-result-merger' to combine the reports, as 'nyc merge' may not handle the different coverage formats correctly.
🪛 yamllint (1.35.1)
.github/workflows/pull-request.yml

[error] 283-283: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Test Application
  • GitHub Check: Check Python Code Style
  • GitHub Check: Analyse Code With CodeQL (javascript)
  • GitHub Check: Analyse Code With CodeQL (javascript)
🔇 Additional comments (4)
.github/workflows/pull-request.yml (4)

248-261: LGTM! Jest coverage configuration looks good.

The changes improve the test execution condition and add proper coverage upload configuration. The use of Jest-specific flags will help in distinguishing coverage metrics.


264-278: LGTM! Vitest coverage configuration looks good.

The changes maintain consistency with Jest configuration while properly segregating Vitest coverage metrics.


279-283: LGTM! Coverage merging configuration looks good.

The use of lcov-result-merger is the correct approach for combining coverage reports from different test frameworks, as it properly handles the lcov format from both Jest and Vitest.

🧰 Tools
🪛 yamllint (1.35.1)

[error] 283-283: trailing spaces

(trailing-spaces)


284-290: LGTM! Combined coverage upload configuration looks good.

The configuration properly identifies the combined report using the 'combined' flag and maintains consistent error handling.

coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 14, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
.github/workflows/pull-request.yml (1)

248-261: Improve Jest test configuration and coverage upload.

The Jest test configuration and coverage upload look good, but there are a few improvements to consider:

  1. The condition steps.changed-files.outputs.any_changed == 'true' is correct, as we want to run tests when files have changed.
  2. The coverage upload step correctly uses codecov-action@v4 with the required token.

Consider adding working-directory to the codecov action to ensure it runs from the correct directory:

       - name: Upload Jest Coverage to Codecov
         if: steps.changed-files.outputs.any_changed == 'true'
         uses: codecov/codecov-action@v4
         with:
           token: ${{ secrets.CODECOV_TOKEN }}
           files: ./coverage/jest/lcov.info
           flags: jest
+          working-directory: .
           fail_ci_if_error: true
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 66a4529 and b2fee63.

📒 Files selected for processing (1)
  • .github/workflows/pull-request.yml (2 hunks)
🧰 Additional context used
📓 Learnings (2)
📓 Common learnings
Learnt from: prayanshchh
PR: PalisadoesFoundation/talawa-admin#2457
File: .github/workflows/pull-request.yml:0-0
Timestamp: 2024-11-26T07:19:31.226Z
Learning: When merging coverage reports from Jest and Vitest, ensure both testing frameworks output coverage in the same format (e.g., 'lcov') and use a compatible tool like 'lcov-result-merger' to combine the reports, as 'nyc merge' may not handle the different coverage formats correctly.
.github/workflows/pull-request.yml (1)
Learnt from: prayanshchh
PR: PalisadoesFoundation/talawa-admin#2457
File: .github/workflows/pull-request.yml:0-0
Timestamp: 2024-11-26T07:19:31.226Z
Learning: When merging coverage reports from Jest and Vitest, ensure both testing frameworks output coverage in the same format (e.g., 'lcov') and use a compatible tool like 'lcov-result-merger' to combine the reports, as 'nyc merge' may not handle the different coverage formats correctly.
🪛 actionlint (1.7.4)
.github/workflows/pull-request.yml

277-277: input "gcov_ignore" is not defined in action "codecov/codecov-action@v4". available inputs are "codecov_yml_path", "commit_parent", "directory", "disable_file_fixes", "disable_safe_directory", "disable_search", "dry_run", "env_vars", "exclude", "fail_ci_if_error", "file", "files", "flags", "git_service", "handle_no_reports_found", "job_code", "name", "network_filter", "network_prefix", "os", "override_branch", "override_build", "override_build_url", "override_commit", "override_pr", "plugin", "plugins", "report_code", "root_dir", "slug", "token", "url", "use_legacy_upload_endpoint", "use_oidc", "verbose", "version", "working-directory"

(action)


291-291: input "gcov_ignore" is not defined in action "codecov/codecov-action@v4". available inputs are "codecov_yml_path", "commit_parent", "directory", "disable_file_fixes", "disable_safe_directory", "disable_search", "dry_run", "env_vars", "exclude", "fail_ci_if_error", "file", "files", "flags", "git_service", "handle_no_reports_found", "job_code", "name", "network_filter", "network_prefix", "os", "override_branch", "override_build", "override_build_url", "override_commit", "override_pr", "plugin", "plugins", "report_code", "root_dir", "slug", "token", "url", "use_legacy_upload_endpoint", "use_oidc", "verbose", "version", "working-directory"

(action)

🪛 yamllint (1.35.1)
.github/workflows/pull-request.yml

[error] 284-284: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Test Application
  • GitHub Check: Check Python Code Style
  • GitHub Check: Analyse Code With CodeQL (javascript)
  • GitHub Check: Analyse Code With CodeQL (javascript)

.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
@palisadoes
Copy link
Contributor

Is this ready to merge? It looks like it's reporting more reasonable values.

There is a similar new issue in the API that you could look at.

@varshith257
Copy link
Member Author

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ignore-sensitive-files-pr The contributor has a legitimate reason for editiing protected files
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants