Skip to content

ci: add riscv64 cross-compilation to release matrix - #2

Open
gounthar wants to merge 3 commits into
masterfrom
ci/riscv64-cross-compile
Open

gounthar wants to merge 3 commits into
masterfrom
ci/riscv64-cross-compile

Conversation

@gounthar

@gounthar gounthar commented Mar 28, 2026

Copy link
Copy Markdown
Owner

Validate riscv64 cross-compilation following the loongarch64 pattern.

Summary by CodeRabbit

  • Chores

    • Added release build support for RISC-V 64-bit Linux.
  • Refactor

    • Internal shell-detection and script naming logic reorganized for more consistent handling of different shells.
  • Bug Fixes / Reliability

    • Improved handling of command argument invocation to reduce incorrect shell invocation cases.
  • Tests

    • Added Windows PowerShell-focused tests covering backtick and shell command execution.

@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@coderabbitai

coderabbitai Bot commented Mar 28, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Multiple changes add a ShellKind abstraction and update command invocation handling, adjust executor script-extension logic, introduce PowerShell-focused tests, and add a RISC-V release target to the CI release workflow.

Changes

Cohort / File(s) Summary
CI / Release
.github/workflows/release.yaml
Added riscv64gc-unknown-linux-musl to package job matrix, included an ubuntu-latest entry with --codegen linker=riscv64-linux-gnu-gcc, and extended dependency installation to include gcc-riscv64-linux-gnu.
Shell kind abstraction
src/shell_kind.rs, src/lib.rs
New crate-visible ShellKind enum with extension() and takes_shell_name() helpers; added module and re-export.
Command execution changes
src/evaluator.rs, src/function.rs
Evaluator::run_command signature changed from args: &[&str] to args: Option<&[String]>; call sites updated to pass Some(args) or None; command-name handling adjusted to consult shell behavior.
Executor script filename logic
src/executor.rs
Moved shell-to-extension logic into a new private shell_kind() helper and delegate default extension selection to ShellKind::extension().
Tests (PowerShell/backticks)
tests/backticks.rs, tests/functions.rs
Added Windows-only tests validating backtick and shell(...) behavior when using PowerShell (pwsh.exe) with expected Windows line endings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble code and hop with cheer,
New shells and targets spring up here,
PowerShell whispers, RISC-V near,
Tiny paws push builds and tests—hip, hooray, my dear! 🎋

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'ci: add riscv64 cross-compilation to release matrix' directly describes the main change, but the changeset also includes multiple non-CI changes to evaluator, executor, function, and test files that are substantial and not reflected in the title. The title should be updated to reflect all major changes in the PR, not just the CI/workflow changes. Consider a more comprehensive title or split these changes into separate PRs.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/riscv64-cross-compile

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/shell_kind.rs`:
- Around line 27-35: The From<&str> for ShellKind currently does case-sensitive
matching causing mixed-case shell names (e.g., "Cmd.exe", "PWSH.EXE") to map to
Other; update the impl for From<&str> (the From conversion for ShellKind) to
perform case-insensitive comparisons—either normalize the input string
(to_lowercase) before the match or use eq_ignore_ascii_case in each arm for
"cmd"/"cmd.exe", "powershell"/"powershell.exe"/"pwsh"/"pwsh.exe"—so
Windows-configured shell.command values are correctly classified as
ShellKind::Cmd or ShellKind::Powershell.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c9f00a88-19de-476a-8c6f-e97cc49709cd

📥 Commits

Reviewing files that changed from the base of the PR and between 7b7e184 and a81dd0a.

📒 Files selected for processing (7)
  • src/evaluator.rs
  • src/executor.rs
  • src/function.rs
  • src/lib.rs
  • src/shell_kind.rs
  • tests/backticks.rs
  • tests/functions.rs

Comment thread src/shell_kind.rs
Comment on lines +27 to +35
impl From<&str> for ShellKind {
fn from(command: &str) -> Self {
match command {
"cmd" | "cmd.exe" => Self::Cmd,
"powershell" | "powershell.exe" | "pwsh" | "pwsh.exe" => Self::Powershell,
_ => Self::Other,
}
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Case-sensitive matching may cause incorrect shell classification on Windows.

The From<&str> implementation only matches exact lowercase names (cmd, powershell, pwsh, etc.). On Windows, users may specify shell commands with different casing (e.g., Cmd.exe, PWSH.EXE, PowerShell.exe). Per context in src/settings.rs:55-59, shell.command is used directly without normalization, so mixed-case configurations will fall through to Other, resulting in incorrect script extensions (no extension instead of .bat/.ps1).

Consider using case-insensitive matching:

♻️ Suggested fix using case-insensitive comparison
 impl From<&str> for ShellKind {
   fn from(command: &str) -> Self {
-    match command {
-      "cmd" | "cmd.exe" => Self::Cmd,
-      "powershell" | "powershell.exe" | "pwsh" | "pwsh.exe" => Self::Powershell,
+    match command.to_ascii_lowercase().as_str() {
+      "cmd" | "cmd.exe" => Self::Cmd,
+      "powershell" | "powershell.exe" | "pwsh" | "pwsh.exe" => Self::Powershell,
       _ => Self::Other,
     }
   }
 }
📝 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.

Suggested change
impl From<&str> for ShellKind {
fn from(command: &str) -> Self {
match command {
"cmd" | "cmd.exe" => Self::Cmd,
"powershell" | "powershell.exe" | "pwsh" | "pwsh.exe" => Self::Powershell,
_ => Self::Other,
}
}
}
impl From<&str> for ShellKind {
fn from(command: &str) -> Self {
match command.to_ascii_lowercase().as_str() {
"cmd" | "cmd.exe" => Self::Cmd,
"powershell" | "powershell.exe" | "pwsh" | "pwsh.exe" => Self::Powershell,
_ => Self::Other,
}
}
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/shell_kind.rs` around lines 27 - 35, The From<&str> for ShellKind
currently does case-sensitive matching causing mixed-case shell names (e.g.,
"Cmd.exe", "PWSH.EXE") to map to Other; update the impl for From<&str> (the From
conversion for ShellKind) to perform case-insensitive comparisons—either
normalize the input string (to_lowercase) before the match or use
eq_ignore_ascii_case in each arm for "cmd"/"cmd.exe",
"powershell"/"powershell.exe"/"pwsh"/"pwsh.exe"—so Windows-configured
shell.command values are correctly classified as ShellKind::Cmd or
ShellKind::Powershell.

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