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

Add WASM testing #313

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add WASM testing #313

wants to merge 1 commit into from

Conversation

kamiazya
Copy link
Owner

@kamiazya kamiazya commented Aug 9, 2024

This pull request adds WASM testing to the project. The changes include the addition of test cases for parsing a string to an array synchronously in a WASM environment. These tests ensure the correct functionality of the parsing logic.

Summary by CodeRabbit

  • New Features

    • Introduced WebAssembly testing capabilities for the CSV toolbox, enhancing performance in CSV processing.
    • Added a new job for testing WebAssembly components in Node.js environments within the GitHub Actions workflow.
    • Created a new package.json file to support CommonJS module compatibility.
  • Bug Fixes

    • Refined the execution logic for the C++ setup in GitHub Actions to run exclusively on Linux.
  • Tests

    • Added new test suites for validating CSV parsing functionality in both Node.js and WebAssembly environments.
  • Chores

    • Updated project dependencies to support improved testing practices.

Copy link

changeset-bot bot commented Aug 9, 2024

🦋 Changeset detected

Latest commit: 1e8c058

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

coderabbitai bot commented Aug 9, 2024

Walkthrough

This update enhances the "web-csv-toolbox" project by introducing WebAssembly (WASM) testing capabilities and refining the GitHub Actions workflow. New tests for CSV parsing functionality ensure robust performance across environments, while modifications to configuration files improve project structure and module compatibility. The changes collectively elevate the project's efficiency and testing coverage.

Changes

File Path Change Summary
.changeset/modern-rice-own.md Added patch enabling WASM testing for CSV processing, improving performance and robustness.
.github/actions/setup/action.yaml Modified execution logic for "Setup C++" step to run only on Linux when skip-rust-setup is not true.
.github/workflows/.dynamic-tests.yaml Introduced test_wasm_nodejs job for WASM testing in Node.js; updated existing jobs to specify working directory and use wasm-pack.
web-csv-toolbox-wasm/Cargo.toml Updated crate-type to include rlib; added wasm-bindgen-test dependency for enhanced WASM testing capabilities.
web-csv-toolbox-wasm/package.json Created package.json to define the module type as CommonJS for Node.js compatibility.
web-csv-toolbox-wasm/tests/node.rs Added tests for parse_string_to_array_sync function to validate CSV parsing in a WASM context.
web-csv-toolbox-wasm/tests/web.rs Introduced tests for parse_string_to_array_sync function for WebAssembly environment to ensure correct parsing of CSV data.

Sequence Diagram(s)

sequenceDiagram
    participant A as Developer
    participant B as GitHub Actions
    participant C as Test Suite
    participant D as WebAssembly Module

    A->>B: Trigger CI/CD
    B->>C: Run tests (including WASM)
    C->>D: Execute `parse_string_to_array_sync`
    D-->>C: Return parsed data
    C-->>B: Report test results
    B-->>A: Notify build status
Loading

🐇 In the code, where data flows,
Through testing paths, our project grows.
With WASM speed, we leap and bound,
A toolbox strong, with tests profound.
Let's parse those strings, make errors rare,
A hop of joy, we dance and share! 🎉


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@kamiazya kamiazya linked an issue Aug 9, 2024 that may be closed by this pull request
@kamiazya kamiazya self-assigned this Aug 9, 2024
@kamiazya kamiazya requested a review from nagasawaryoya August 9, 2024 16:41
Copy link

codecov bot commented Aug 9, 2024

Bundle Report

Bundle size has no change ✅

Copy link

codspeed-hq bot commented Aug 9, 2024

CodSpeed Performance Report

Merging #313 will improve performances by ×2

Comparing add-wasm-tests (1e8c058) with main (1032118)

Summary

⚡ 1 improvements
✅ 6 untouched benchmarks

Benchmarks breakdown

Benchmark main add-wasm-tests Change
parseBinary.toArraySync(50 rows) 1,139.7 µs 561.3 µs ×2

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1032118 and 1e8c058.

Files ignored due to path filters (1)
  • web-csv-toolbox-wasm/Cargo.lock is excluded by !**/*.lock
Files selected for processing (7)
  • .changeset/modern-rice-own.md (1 hunks)
  • .github/actions/setup/action.yaml (1 hunks)
  • .github/workflows/.dynamic-tests.yaml (4 hunks)
  • web-csv-toolbox-wasm/Cargo.toml (2 hunks)
  • web-csv-toolbox-wasm/package.json (1 hunks)
  • web-csv-toolbox-wasm/tests/node.rs (1 hunks)
  • web-csv-toolbox-wasm/tests/web.rs (1 hunks)
Files skipped from review due to trivial changes (1)
  • web-csv-toolbox-wasm/package.json
Additional comments not posted (10)
.changeset/modern-rice-own.md (1)

1-5: Changeset looks good.

The changeset correctly documents the patch release for adding WASM testing.

web-csv-toolbox-wasm/tests/node.rs (1)

1-15: WASM test implementation looks good.

The test correctly validates the parse_string_to_array_sync function using wasm_bindgen_test.

web-csv-toolbox-wasm/tests/web.rs (1)

1-17: WASM browser test implementation looks good.

The test correctly validates the parse_string_to_array_sync function using wasm_bindgen_test configured for browser execution.

web-csv-toolbox-wasm/Cargo.toml (2)

11-11: Enhancement: Added rlib to crate-type.

Adding rlib allows the library to be used as a static library, increasing its flexibility in different Rust contexts. This change is beneficial for broader compatibility.


26-27: Addition: Introduced wasm-bindgen-test in dev-dependencies.

The inclusion of wasm-bindgen-test facilitates testing WebAssembly components, aligning with the PR's objective to enhance testing capabilities.

.github/actions/setup/action.yaml (1)

35-35: Optimization: Restrict C++ setup to Linux.

Limiting the C++ setup step to Linux environments optimizes the workflow by preventing unnecessary installations on non-Linux systems.

.github/workflows/.dynamic-tests.yaml (4)

61-74: Addition: New test_wasm_nodejs job.

The new job adds WebAssembly testing in Node.js environments, supporting multiple Node.js versions. This enhances the testing coverage and ensures compatibility across different Node.js versions.


110-111: Update: Added working-directory for Linux browser tests.

Specifying the working-directory ensures that tests are executed in the correct context, improving the reliability of the test execution.


134-135: Update: Added working-directory for macOS browser tests.

This change aligns with the updates for other platforms, ensuring consistency in the test execution environment.


153-155: Conditional Execution: Exclude Edge from WASM tests on Windows.

The conditional logic to skip WASM tests for Edge ensures compatibility and avoids potential issues specific to the Edge browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Rust Testing
1 participant