KEMBAR78
feat: add `riscv64gc-unknown-linux-gnu` target by JounQin · Pull Request #30 · unrs/unrs-resolver · GitHub
Skip to content

Conversation

@JounQin
Copy link
Member

@JounQin JounQin commented Mar 21, 2025

Summary by CodeRabbit

  • New Features

    • Expanded platform compatibility by adding support for the RISC-V architecture.
  • Chores

    • Enhanced build and release workflows with refined event triggers, improved toolchain setup, and updated dependency sources, ensuring more reliable and condition-based publishing.

@JounQin JounQin force-pushed the ci/testing branch 3 times, most recently from 621f131 to 9d245b5 Compare March 21, 2025 17:20
@JounQin
Copy link
Member Author

JounQin commented Mar 21, 2025

Hi! @Brooooooklyn

Sorry to bother you, I just followed a new created napi template's GitHub action workflow, but some targets don't compile successfully, any possible to help resolving?

Errors like

--- stderr
  CMake Error at /usr/local/share/cmake-3.31/Modules/CMakeTestCCompiler.cmake:67 (message):
    The C compiler

      "/usr/bin/clang"

    is not able to compile a simple test program.

    It fails with the following output:

      Change Dir: '/home/runner/work/rspack-resolver/rspack-resolver/target/s390x-unknown-linux-gnu/release/build/libmimalloc-sys2-57a6624d8e4f1f38/out/build/CMakeFiles/CMakeScratch/TryCompile-yRe3rg'
      
      Run Build Command(s): /usr/local/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_c0cf6/fast
      /usr/bin/gmake  -f CMakeFiles/cmTC_c0cf6.dir/build.make CMakeFiles/cmTC_c0cf6.dir/build
      gmake[1]: Entering directory '/home/runner/work/rspack-resolver/rspack-resolver/target/s390x-unknown-linux-gnu/release/build/libmimalloc-sys2-57a6624d8e4f1f38/out/build/CMakeFiles/CMakeScratch/TryCompile-yRe3rg'
      Building C object CMakeFiles/cmTC_c0cf6.dir/testCCompiler.c.o
      /usr/bin/clang   -ffunction-sections -fdata-sections -fPIC --target=s390x-unknown-linux-gnu  -MD -MT CMakeFiles/cmTC_c0cf6.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_c0cf6.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_c0cf6.dir/testCCompiler.c.o -c /home/runner/work/rspack-resolver/rspack-resolver/target/s390x-unknown-linux-gnu/release/build/libmimalloc-sys2-57a6624d8e4f1f38/out/build/CMakeFiles/CMakeScratch/TryCompile-yRe3rg/testCCompiler.c
      Linking C executable cmTC_c0cf6
      /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c0cf6.dir/link.txt --verbose=1
      /usr/bin/ld: unrecognised emulation mode: elf64_s390
      Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386pep i386pe
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      /usr/bin/clang  -ffunction-sections -fdata-sections -fPIC --target=s390x-unknown-linux-gnu  CMakeFiles/cmTC_c0cf6.dir/testCCompiler.c.o -o cmTC_c0cf6
      gmake[1]: *** [CMakeFiles/cmTC_c0cf6.dir/build.make:103: cmTC_c0cf6] Error 1
      gmake[1]: Leaving directory '/home/runner/work/rspack-resolver/rspack-resolver/target/s390x-unknown-linux-gnu/release/build/libmimalloc-sys2-57a6624d8e4f1f38/out/build/CMakeFiles/CMakeScratch/TryCompile-yRe3rg'
      gmake: *** [Makefile:134: cmTC_c0cf6/fast] Error 2

cc @eaibmz @SukkaW

Are you familiar with this part?

@JounQin JounQin changed the title ci: test new nap build workflow ci: test new napi build workflow Mar 22, 2025
@JounQin JounQin force-pushed the ci/testing branch 20 times, most recently from 2013b5a to 45e4c37 Compare March 22, 2025 12:14
@Brooooooklyn
Copy link
Contributor

https://github.com/oxc-project/oxc-node/blob/main/.github/workflows/CI.yml#L119-L129

@JounQin JounQin force-pushed the ci/testing branch 3 times, most recently from 14e1e02 to ad65e6d Compare March 26, 2025 01:16
@JounQin JounQin force-pushed the main branch 9 times, most recently from 7c74ca1 to 5cd9ced Compare March 26, 2025 02:18
@JounQin JounQin force-pushed the ci/testing branch 2 times, most recently from 82b50cf to 6bef961 Compare March 26, 2025 02:53
@JounQin JounQin changed the title ci: test new napi build workflow feat: add riscv64gc-unknown-linux-gnu target Mar 26, 2025
@JounQin JounQin force-pushed the ci/testing branch 2 times, most recently from 53184c8 to 01b24dd Compare March 26, 2025 04:50
@JounQin JounQin force-pushed the ci/testing branch 4 times, most recently from f560021 to e953271 Compare March 26, 2025 05:09
@coderabbitai
Copy link

coderabbitai bot commented Apr 3, 2025

Walkthrough

The changes update the GitHub Actions workflow and npm configuration. In the workflow file, a new pull request trigger is introduced (set to null), the package URL has been updated, the conditional check for build jobs is disabled (making them run unconditionally), and a conditional "Setup toolchain" step is added. Additionally, support for the RISC-V architecture (riscv64gc-unknown-linux-gnu) is included in both the workflow build matrix and the npm package targets.

Changes

File(s) Change Summary
.github/workflows/release-napi.yml - Added pull_request: null trigger
- Updated package URL
- Commented out conditional checks for build and build-freebsd jobs
- Added "Setup toolchain" step (conditional on matrix.setup)
- Added new target riscv64gc-unknown-linux-gnu to the build matrix
npm/package.json - Added "riscv64gc-unknown-linux-gnu" to the napi.targets array

Sequence Diagram(s)

sequenceDiagram
    participant GitHub as GitHub Events
    participant Workflow as Release Workflow
    participant Setup as Setup Toolchain
    participant Build as Build Jobs
    participant Publish as Publish Job

    GitHub->>Workflow: Trigger event (push)
    Note right of Workflow: Process starts
    Workflow->>Setup: Evaluate matrix.setup condition
    Setup-->>Workflow: Execute toolchain setup (if true)
    Workflow->>Build: Execute build & build-freebsd jobs unconditionally
    alt Version Changed
       Workflow->>Publish: Execute publish job (version check passed)
    else No Version Change
       Workflow-->>Publish: Skip publish job
    end
Loading

Poem

I'm a happy little rabbit in the code forest so green,
Hopping through new targets and workflows unseen.
Pull requests whisper "null" in the crisp air,
While setup steps and builds bear extra care.
With every line and command so bright,
I nibble on carrots of code delight!
🥕🐇


📜 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 3e6cb18 and 22555c9.

📒 Files selected for processing (2)
  • .github/workflows/release-napi.yml (7 hunks)
  • npm/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • npm/package.json
  • .github/workflows/release-napi.yml

🪧 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

@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 (2)
npm/package.json (1)

42-42: New RISC-V Target Addition:
The addition of the "riscv64gc-unknown-linux-gnu" entry in the napi.targets array correctly expands support for the RISC-V architecture. Please ensure that any related documentation and toolchain configuration (e.g., build scripts and CI steps) are updated accordingly.

.github/workflows/release-napi.yml (1)

130-134: Conditional Toolchain Setup Step:
The new "Setup toolchain" step leverages the matrix.setup field, which is provided for targets that require extra configuration (such as the RISC-V target). Ensure that this conditional is robust and that matrix entries not requiring additional toolchain setup do not inadvertently execute this step.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c1eadd0 and 3e6cb18.

📒 Files selected for processing (2)
  • .github/workflows/release-napi.yml (7 hunks)
  • npm/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Package aarch64-unknown-linux-musl
  • GitHub Check: Package aarch64-pc-windows-msvc
  • GitHub Check: Package i686-pc-windows-msvc
  • GitHub Check: Package x86_64-pc-windows-msvc
🔇 Additional comments (4)
.github/workflows/release-napi.yml (4)

10-10: Disabled Pull Request Trigger:
The workflow now sets pull_request: null, which means pull request events will not trigger this workflow. Confirm that this change is intentional and aligned with your CI strategy.


36-38: Version Check URL Update:
The Check version step now uses file-url: https://unpkg.com/unrs-resolver@latest/package.json for version comparison. Please verify that this URL reliably returns the expected package metadata for accurate version detection.


48-48: Unconditional Build Job:
The conditional check (if: needs.check.outputs.version_changed == 'true') for the build job has been commented out, making the build run on every push. Double-check that this behavior is intended and that it fits your release strategy.


81-89: RISC-V Build Matrix Update:
A new matrix entry for riscv64gc-unknown-linux-gnu has been added with specific setup and build steps. Please confirm that:

  • Installing gcc-riscv64-linux-gnu via apt-get is the correct approach for your toolchain.
  • The Rust target addition (rustup target add riscv64gc-unknown-linux-gnu) and subsequent build command (pnpm build --use-napi-cross) are sufficient for compiling on this architecture.
    Consider incorporating error handling or logging in case any installation steps fail.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 3, 2025

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.

2 participants