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: enable codecov action #422

Merged
merged 2 commits into from
Mar 29, 2025
Merged

ci: enable codecov action #422

merged 2 commits into from
Mar 29, 2025

Conversation

JounQin
Copy link
Collaborator

@JounQin JounQin commented Mar 29, 2025

Summary by CodeRabbit

  • Chores
    • Improved our continuous integration process for better clarity and efficiency.
    • Introduced a new code quality tracking step to enhance code coverage reporting.
    • Streamlined configuration settings by removing outdated parameters.
    • Renamed job steps for better clarity and consolidated processes into a single step.
  • Tests
    • Enhanced test output clarity by updating test descriptions to include dynamic variables.
    • Set a timeout for test execution to improve reliability.

Copy link

changeset-bot bot commented Mar 29, 2025

⚠️ No Changeset found

Latest commit: e9f77bd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@JounQin JounQin requested a review from Copilot March 29, 2025 13:56
Copy link

coderabbitai bot commented Mar 29, 2025

Walkthrough

The changes modify the CI workflow file by renaming the job from default to ci, removing Node.js version 16 from the strategy matrix, and deleting an environment variable. The job step previously named Build and Typecov has been renamed to Build, Lint and Test, consolidating commands for building, linting, and testing. Additionally, a new job step named Codecov has been introduced, utilizing the codecov/codecov-action@v5 action. In the test file, a constant TIMEOUT has been added, and the test description has been updated for clarity.

Changes

File(s) Change Summary
.github/workflows/ci.yml Renamed job from default to ci, removed Node.js version 16, renamed job step from Build and Typecov to Build, Lint and Test, added Codecov step using codecov/codecov-action@v5, and deleted the environment variable YARN_IGNORE_NODE.
tests/e2e/e2e.spec.ts Modified test case description to use dynamic string with dirName, removed argument from toMatchSnapshot() method, and added constant TIMEOUT = 30_000.

Sequence Diagram(s)

sequenceDiagram
    participant CI as CI Workflow
    participant Build as Build, Lint and Test Step
    participant Codecov as Codecov Step
    participant Node as Node.js Environment

    CI->>Build: Start build process
    Node-->>CI: Check Node.js version
    alt Node.js version != 16
        Build->>Codecov: Trigger Codecov step (codecov-action@v5)
        Codecov-->>CI: Return code coverage results
    else Node.js version 16
        Build-->>CI: Skip Codecov step
    end
Loading

Poem

I'm a rabbit on a coding spree,
Hopping through workflows with glee,
Renamed jobs make the path so clear,
With Codecov stepping in, no fear,
I celebrate each change with a joyful cheer! 🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

tests/e2e/e2e.spec.ts

Oops! Something went wrong! :(

ESLint: 9.23.0

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@1stg/eslint-config' imported from /eslint.config.js
at packageResolve (node:internal/modules/esm/resolve:839:9)
at moduleResolve (node:internal/modules/esm/resolve:908:18)
at defaultResolve (node:internal/modules/esm/resolve:1038:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:557:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:525:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:246:38)
at ModuleJob._link (node:internal/modules/esm/module_job:126:49)


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cb4f85f and e9f77bd.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml (2 hunks)
  • tests/e2e/e2e.spec.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
tests/e2e/e2e.spec.ts (1)
Learnt from: JounQin
PR: import-js/eslint-import-resolver-typescript#422
File: tests/e2e/e2e.spec.ts:57-57
Timestamp: 2025-03-29T14:42:26.615Z
Learning: In Jest tests, including dynamic identifiers like directory names in the test description (e.g., `it(\`should exec eslint successfully > ${dirName}\`, ...)`) rather than as a parameter to `.toMatchSnapshot()` is a valid approach that improves logging clarity and makes test failures easier to identify.
🔇 Additional comments (6)
tests/e2e/e2e.spec.ts (2)

7-7: Good addition of a timeout constant.

Defining a constant for the test timeout is a good practice that makes it easier to manage and adjust timeouts across multiple tests if needed.


31-60: Improved test description with directory name inclusion.

Moving the directory name from the snapshot parameter to the test description improves logging clarity and makes test failures easier to identify in reports.

The timeout parameter addition is also a good practice for these types of tests that might run longer than Jest's default timeout.

.github/workflows/ci.yml (4)

12-12: Improved job naming for clarity.

Changing the job name from default to ci makes the workflow more semantic and clearer about its purpose.


16-19: Node.js version matrix updated.

Node.js 16 has been removed from the test matrix, which is reasonable as it's approaching end-of-life.


38-41: Workflow sequence improvement.

The workflow now correctly runs yarn build before linting and testing, which ensures that any build artifacts needed for tests are available. Using run-p to run lint, test, and typecov in parallel is an efficiency improvement.


45-48: Successfully integrated Codecov.

The addition of the Codecov action meets the PR objective of enabling code coverage reporting as part of the CI process.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aims to enhance the CI workflow by enabling a Codecov action to collect coverage reports alongside linting and testing. Key changes include renaming the job from “default” to “ci”, removing an existing environment variable block, and adding a new Codecov step with its corresponding configuration.

Comments suppressed due to low confidence (2)

.github/workflows/ci.yml:48

  • Verify if the condition 'if: ${{ matrix.node != 16}}' for the Codecov step is intended, as it may inadvertently skip coverage reporting for Node.js 16.
      - name: Codecov

.github/workflows/ci.yml:12

  • [nitpick] The job name 'ci' is generic; consider a more descriptive name like 'lint-test-coverage' to reflect the combined responsibilities of the job.
  ci:

Copy link

codesandbox-ci bot commented Mar 29, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link

pkg-pr-new bot commented Mar 29, 2025

Open in Stackblitz

npm i https://pkg.pr.new/eslint-import-resolver-typescript@422

commit: e9f77bd

Copy link
Contributor

github-actions bot commented Mar 29, 2025

size-limit report 📦

Path Size
lib/index.js 1.35 KB (0%)

Copy link

codecov bot commented Mar 29, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@JounQin JounQin requested a review from Copilot March 29, 2025 14:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances continuous integration by updating the CI workflow for improved code quality tracking and code coverage reporting. Key changes include:

  • Adding a new "ci" job with updated Node.js matrices.
  • Consolidating build, lint, and test commands into a single step.
  • Introducing a dedicated Codecov step using codecov/codecov-action@v5.
Comments suppressed due to low confidence (2)

.github/workflows/ci.yml:38

  • [nitpick] Consider splitting the combined build, lint, and test commands into separate steps to make it easier to pinpoint which phase fails during the CI process.
      - name: Build, Lint and Test

.github/workflows/ci.yml:45

  • It may be beneficial to add a condition (for example, if: success()) to the Codecov step to ensure that coverage is uploaded only after successful build, lint, and test steps.
      - name: Codecov

Copy link

@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/ci.yml (1)

38-42: Consolidated Build, Lint, and Test Step
Renaming the step to "Build, Lint and Test" and combining yarn build with yarn run-p lint test typecov provides a streamlined workflow. Double-check that the combined commands report errors clearly if one of the steps (build, lint, test, or typecov) fails.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2502a93 and 5964453.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest
🔇 Additional comments (3)
.github/workflows/ci.yml (3)

12-12: Job Renaming to "ci"
Renaming the job from default to ci improves clarity by explicitly indicating the enhanced CI configuration, aligning with the PR objectives.


16-19: Updated Node.js Version Strategy Matrix
Removing Node.js version 16 and listing only versions 18, 20, and 22 helps ensure modern environment support and reduces maintenance overhead. Confirm that all project dependencies are compatible with these versions.


45-49: Addition of Codecov Integration
The new "Codecov" step uses codecov/codecov-action@v5 correctly and integrates code coverage reporting into the CI workflow. Ensure that the secret CODECOV_TOKEN is properly set in your repository settings to make this step functional.

@JounQin JounQin force-pushed the ci/codecov branch 2 times, most recently from 7faf6c4 to 5b53978 Compare March 29, 2025 14:27
Copy link

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🛑 Comments failed to post (1)
tests/e2e/e2e.spec.ts (1)

53-53: 💡 Verification agent

🧩 Analysis chain

Fix snapshot mismatch error.

Removing the dirName parameter from toMatchSnapshot() is causing snapshot mismatches in the CI pipeline. The static analysis indicates a mismatch for the "dotInclude" snapshot.

- ).toMatchSnapshot()
+ ).toMatchSnapshot(dirName)

Or alternatively, update the snapshots by running:


🏁 Script executed:

yarn test -u

Length of output: 233


🏁 Script executed:

#!/bin/bash
# Verify if there are snapshot files using the old format
find tests/e2e/__snapshots__ -type f -name "*.snap" | xargs grep -l "should exec eslint successfully >" || echo "No matching snapshots found"

Length of output: 146


Critical Snapshot Mismatch Fix

After verifying the snapshot update process and reviewing the existing snapshot files, it’s clear that removing the dirName parameter from toMatchSnapshot() has led to a snapshot mismatch error in CI. Our investigation shows:

  • The command to update snapshots (yarn test -u) failed due to a missing node_modules state file. This indicates that the environment isn’t set up for updating snapshots as-is (consider running yarn install beforehand).
  • The verification script found the legacy snapshot in tests/e2e/__snapshots__/e2e.spec.ts.snap, confirming that the snapshot expects the dirName parameter.

Action required:

  • Revert the code change by reintroducing the dirName parameter:
    - ).toMatchSnapshot()
    + ).toMatchSnapshot(dirName)
  • Alternatively, if you prefer updating the snapshots instead, ensure that dependencies are installed (e.g., run yarn install) before executing yarn test -u.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      ).toMatchSnapshot(dirName)
🧰 Tools
🪛 GitHub Check: Lint and Test with Node.js 22 on windows-latest

[failure] 53-53: tests/e2e/e2e.spec.ts > e2e cases > should exec eslint successfully > dotInclude
Error: Snapshot e2e cases > should exec eslint successfully > dotInclude 2 mismatched
❯ tests/e2e/e2e.spec.ts:53:9

@JounQin
Copy link
Collaborator Author

JounQin commented Mar 29, 2025

Revert the code change by reintroducing the dirName parameter

@coderabbitci Please retry, it shouldn't fail.

Copy link

coderabbitai bot commented Mar 29, 2025

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the current state of the e2e.spec.ts file
cat tests/e2e/e2e.spec.ts

Length of output: 1586


@JounQin I'll initiate a new review as requested. Thanks for making the changes.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b53978 and 3882e46.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml (2 hunks)
  • tests/e2e/e2e.spec.ts (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 20 on windows-latest
  • GitHub Check: Lint and Test with Node.js 22 on windows-latest
  • GitHub Check: Lint and Test with Node.js 18 on windows-latest
🔇 Additional comments (7)
tests/e2e/e2e.spec.ts (3)

7-7: Good addition of a timeout constant.

Externalizing the timeout value improves maintainability and makes the test configuration more explicit. The 20 second value is appropriate for E2E tests that may take longer to execute.


31-33: Great improvement to test description clarity.

Using a dynamic description that includes the directory name makes test output more informative, helping to quickly identify which specific case failed when running the test suite.


59-59: Good use of the timeout constant.

Setting an explicit timeout for E2E tests prevents premature test failures due to the default Jest timeout being too short. Using the constant ensures consistency.

.github/workflows/ci.yml (4)

12-12: Good job name improvement.

Renaming from "default" to "ci" makes the purpose of the job clearer and more descriptive.


17-19: Good removal of Node.js 16.

Removing Node.js 16 is appropriate as it reached end-of-life in September 2023. Focusing on more recent versions (18, 20, 22) ensures better maintainability and security.


38-41: Well-organized build, lint, and test step.

Consolidating the build, lint, and test steps simplifies the workflow. Using yarn run-p to run lint, test, and typecov in parallel is efficient and can reduce overall CI execution time.


45-48:

❓ Verification inconclusive

Successfully integrated Codecov.

The Codecov action is properly configured with a token from secrets. Using the latest v5 version of the action ensures you have the most recent features and security updates.

Would you like me to verify that coverage reports are being properly generated by the test commands?


🏁 Script executed:

#!/bin/bash
# Check package.json to verify test commands generate coverage reports
grep -A 10 '"test"' package.json

Length of output: 335


Codecov integration verified – please double-check your test setup for coverage generation.

  • The Codecov action in .github/workflows/ci.yml is correctly configured with a secret token and is set to the latest v5 version.
  • The package.json test script currently runs
    "test": "node tests/e2e/withJsExtension/test.cjs && vitest run"
    
    which doesn’t explicitly include flags or commands to generate a coverage report. If vitest’s configuration (e.g., in a vitest.config.ts file) is set to produce coverage reports, all is well—but if not, consider updating it so Codecov has the necessary artifacts.

@JounQin
Copy link
Collaborator Author

JounQin commented Mar 29, 2025

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

@coderabbitai You need to run yarn build first before linting and testing.

Copy link

coderabbitai bot commented Mar 29, 2025

Tip

For best results, initiate chat on the files or code changes.

@JounQin Thank you for sharing this important detail about the build process. I understand that yarn build needs to be executed before linting and testing in this repository. This makes sense as the linting and testing processes likely depend on artifacts generated during the build step. I'll keep this in mind for future reviews.


✏️ Learnings added
Learnt from: JounQin
URL: https://github.com/import-js/eslint-import-resolver-typescript/pull/422

Timestamp: 2025-03-29T14:40:45.829Z
Learning: In the eslint-import-resolver-typescript repository, `yarn build` must be run before linting and testing as the linting and testing processes depend on artifacts generated during the build step.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@JounQin
Copy link
Collaborator Author

JounQin commented Mar 29, 2025

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

@coderabbitai I've told you:

You need to run yarn build first before linting and testing.

Copy link

coderabbitai bot commented Mar 29, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the current state of the CI workflow file
cat .github/workflows/ci.yml

Length of output: 1033


@JounQin I see that your CI workflow already correctly runs yarn build before linting and testing:

- name: Build, Lint and Test
  run: |
    yarn build
    yarn run-p lint test typecov

I fully understand the importance of this sequence now - the build step generates necessary artifacts that the linting and testing processes depend on.

Are there specific tool issues you're encountering that I can help diagnose or fix? I'd be happy to look into any particular errors you're facing.

@JounQin
Copy link
Collaborator Author

JounQin commented Mar 29, 2025

@coderabbitai full review

Copy link

coderabbitai bot commented Mar 29, 2025

✅ Actions performed

Full review triggered.

@JounQin
Copy link
Collaborator Author

JounQin commented Mar 29, 2025

@coderabbitai full review

Copy link

coderabbitai bot commented Mar 29, 2025

✅ Actions performed

Full review triggered.

@JounQin JounQin merged commit ffb8ddf into master Mar 29, 2025
31 checks passed
@JounQin JounQin deleted the ci/codecov branch March 29, 2025 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant