Skip to content

fix: venv usage #314

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

Merged
merged 8 commits into from
Aug 18, 2025
Merged

fix: venv usage #314

merged 8 commits into from
Aug 18, 2025

Conversation

2bndy5
Copy link
Collaborator

@2bndy5 2bndy5 commented Aug 17, 2025

related to #305
resolves #313

Python venv fix

Apparently, uv respects the UV_PROJECT_ENVIRONMENT env var for only certain uv commands.

This workaround involves a combination of --project and --directory:

uv run --project $GITHUB_ACTION_PATH --directory (pwd) cpp-linter ...$inputs

Where (pwd) is the nushell builtin command similar to bash's $(pwd) and should point to the working directory.

Tested in a container

I ran this in the test repo using the ubuntu:latest docker image (for Linux runners only).
While it works now (after switching from bash to nushell), I found that the LLVM script requires certain tools that are not present in docker images.

So after a lot of trial and error, I revised the README to describe the required tools for each platform. It turns out nushell's builtin http command uses curl or wget underneath (on Linux).

sudo is no longer required if the docker container runs as root. 🎉

Summary by CodeRabbit

  • Documentation

    • Added a “Required tools installed” section with OS-specific prerequisites and install guidance; updated the warning to link to it and added cross-link anchors.
    • Clarified cache-enable description to explain caching behavior, defaults, and cache location.
  • Refactor

    • Reworked dependency/setup and linter invocation to a unified, cross-platform flow (nu-based + uv) with verbosity/debug handling; public inputs/outputs unchanged.
  • Chores

    • Bumped internal tool versions and improved installer reliability.

2bndy5 added 2 commits August 16, 2025 21:36
enable verbosity in uv output
dependent on ACTIONS_STEP_DEBUG env var or `inputs.verbosity`
@2bndy5 2bndy5 added the bug Something isn't working label Aug 17, 2025
Copy link
Contributor

github-actions bot commented Aug 17, 2025

Cpp-Linter Report ⚠️

Some files did not pass the configured checks!

clang-tidy (v12.0.0) reports: 3 concern(s)
  • build/CMakeFiles/3.31.6/CompilerIdC/CMakeCCompilerId.c:2:3: error: [clang-diagnostic-error]

    "A C++ compiler has been selected for C."

    # error "A C++ compiler has been selected for C."
      ^
  • build/CMakeFiles/3.31.6/CompilerIdC/CMakeCCompilerId.c:776:1: warning: [modernize-avoid-c-arrays]

    do not declare C-style arrays, use std::array<> instead

    char const info_version[] = {
    ^
  • build/CMakeFiles/3.31.6/CompilerIdC/CMakeCCompilerId.c:877:5: warning: [modernize-use-trailing-return-type]

    use a trailing return type for this function

    int main(int argc, char* argv[])
    ~~~ ^
    auto                             -> int

Have any feedback or feature suggestions? Share it here.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 17, 2025

I'm also noticing that the ignore option is not actually ignoring paths.

    ignore: build

This ends up running clang tools on files nested in the build/ directory. See bot comment above.

I suspect this is related to cpp-linter (py) implementation of ignore-tidy and ignore-format.

instead of `curl` on unix or `irm ... iex` on windows

because `curl` may not be available
@2bndy5 2bndy5 force-pushed the fix-venv branch 5 times, most recently from 7e10ff1 to 2d780d8 Compare August 17, 2025 10:52
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Aug 17, 2025
@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 17, 2025

BTW, Ubuntu 25.10 is transitioning to use rust implementations of

And, nushell is already wrapping some of the functions from uutils/coreutils.

@2bndy5 2bndy5 marked this pull request as ready for review August 17, 2025 12:09
@2bndy5 2bndy5 requested a review from a team as a code owner August 17, 2025 12:09
@2bndy5 2bndy5 requested review from shenxianpeng and removed request for a team August 17, 2025 12:09
for each platform
Copy link
Contributor

coderabbitai bot commented Aug 17, 2025

Walkthrough

Replaces Bash-based setup with Nu-based, cross-platform flows in action.yml for installing clang tools and invoking cpp-linter via uv; updates cache-enable description and verbosity handling. README.md adds a “Required tools installed” section, clarifies OS-specific prerequisites, and updates the runner-support warning to link the new section.

Changes

Cohort / File(s) Summary
Documentation updates
README.md
Added a “Required tools installed” section detailing nushell/uv presence and OS-specific prerequisites; replaced the prior runner support warning with a link to the new section; no code/API changes.
Action runtime refactor
action.yml
Migrated from Bash to Nu/Nushell flows for Linux/macOS installer steps; introduced cross-platform uv installer logic and unified uv_args with verbosity handling; bumped UV_VERSION to 0.8.11; added PATH augmentation for Linux; expanded cache-enable input description; changed clang tools install/retry flow and invocation to run cpp-linter via uv.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Runner
  participant Action
  participant OS_PkgMgr as OS Package Manager
  participant LLVM_Installer as LLVM Installer
  participant Homebrew as Homebrew
  participant UV as uv
  participant CppLinter as cpp-linter

  Runner->>Action: Start action.yml
  Action->>Action: Parse inputs, verbosity, cache settings

  alt Linux
    Action->>OS_PkgMgr: apt-get install clang-format/clang-tidy
    alt Tools missing
      Action->>LLVM_Installer: Download & run LLVM installer
      Action->>OS_PkgMgr: Retry apt-get install
    end
  else macOS
    Action->>Homebrew: brew install llvm@<version>
    Action->>Action: Create symlinks for clang-format/tidy
  else Windows
    Action->>Action: Use provided static binaries
  end

  Action->>UV: Fetch and run platform-specific installer (install.sh / install.ps1)
  Action->>UV: uv run --no-sync --project <action> --directory (pwd) cpp-linter <args>
  UV->>CppLinter: Execute cpp-linter
  CppLinter-->>Runner: Results / exit code
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Assessment against linked issues

Objective Addressed Explanation
Fix “Failed to spawn: clang-tools” after v2.16.0 in containerized Ubuntu (#313)
Ensure clang-format/clang-tidy availability via robust installer path when apt lacks tools (#313)
Handle PATH visibility for installed tools and uv in CI/container contexts (#313)
Provide documentation clarifying tooling and OS prerequisites (#313)

Possibly related PRs

Suggested labels

python

Suggested reviewers

  • shenxianpeng

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-venv

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
🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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
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 (5)
README.md (3)

161-168: Tighten phrasing and fix minor grammar around PATH behavior

The sentences read a bit clunky with the semicolon and “now uses” construction. Suggested edits improve clarity and flow.

-As of v2.16.0, this action now uses
+As of v2.16.0, this action uses

-This action installs [nushell] and [uv] automatically, but only [nushell] is added to the PATH environment variable;
-[uv], and any standalone Python distribution it downloads, are not added to the PATH environment variable.
+This action installs [nushell] and [uv] automatically. Only [nushell] is added to the PATH environment variable.
+[uv], and any standalone Python distribution it downloads, are not added to the PATH environment variable.

171-186: Subject-verb agreement and stronger guidance for Debian-based containers

  • Use “are installed” for the list.
  • Consider including an apt-get update in the example, as many minimal images need it before install.
-We only support Linux runners using a Debian-based Linux OS (like Ubuntu and many others).
-This is because we first try to use the `apt` package manager to install clang tools.
+We only support Linux runners using a Debian-based Linux OS (like Ubuntu and many others).
+This is because we first try to use the `apt` package manager to install clang tools.

-Linux workflows that use a specific [`container`][gh-container-syntax] should ensure that
-the following is installed:
+Linux workflows that use a specific [`container`][gh-container-syntax] should ensure that
+the following are installed:

-```shell
-apt-get install -y libc6 wget lsb-release software-properties-common gnupg
-```
+```shell
+apt-get update && apt-get install -y libc6 wget curl lsb-release software-properties-common gnupg
+```

189-199: Use “macOS” capitalization and align with Apple’s style

This is purely cosmetic, but standardizes terminology across docs.

-### On MacOS runners
+### On macOS runners
action.yml (2)

324-333: macOS symlink creation may fail or be non-idempotent

  • Use -sf to replace existing symlinks on reruns.
  • On some environments, /usr/local/bin may require elevated permissions. GitHub macOS runners typically allow it, but being idempotent helps.
-          ^ln -s $"($brew_prefix)/bin/clang-format" "/usr/local/bin/clang-format-${{ inputs.version }}"
-          ^ln -s $"($brew_prefix)/bin/clang-tidy" "/usr/local/bin/clang-tidy-${{ inputs.version }}"
+          ^ln -sf $"($brew_prefix)/bin/clang-format" "/usr/local/bin/clang-format-${{ inputs.version }}"
+          ^ln -sf $"($brew_prefix)/bin/clang-tidy" "/usr/local/bin/clang-tidy-${{ inputs.version }}"

430-438: Minor: simplify PATH augmentation and remove unused variable

tmp_path is unused; directly mutate PATH within the conditional.

-        let local_bin = '~/.local/bin' | path expand
-        let tmp_path = if (
+        let local_bin = '~/.local/bin' | path expand
+        if (
           ('${{ runner.os }}' == 'Linux')
           and ($local_bin | path exists)
           and (not ($env.PATH | any {$in == $local_bin}))
         ) {
           # add ~/.local/bin to PATH (temporarily)
           $env.PATH = $env.PATH | append $local_bin
         }
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d7155ea and a27ea8b.

📒 Files selected for processing (2)
  • README.md (2 hunks)
  • action.yml (2 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[grammar] ~163-~163: There might be a mistake here.
Context: ... for cross-platform compatible scripting - [uv] for driving a Python virtual environ...

(QB_NEW_EN)


[grammar] ~166-~166: There might be a mistake here.
Context: ... added to the PATH environment variable; [uv], and any standalone Python distribu...

(QB_NEW_EN)


[grammar] ~174-~174: There might be a mistake here.
Context: ...[gh-container-syntax] should ensure that the following is installed: - GLIBC (v2...

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: test (ubuntu-latest, 19)
  • GitHub Check: test (macos-latest, 16)
  • GitHub Check: test (macos-latest, 15)
  • GitHub Check: test (macos-latest, 11)
  • GitHub Check: test (macos-latest, 8)
  • GitHub Check: test (macos-latest, 14)
🔇 Additional comments (6)
README.md (2)

36-38: Good clarification via anchored warning

Pointing to a concrete “Required tools” section is clearer than the previous generic warning. This improves discoverability for container users.


204-209: Link references look good

The added references are accurate and helpful.

action.yml (4)

220-227: Cache description improvements are clear

Good callout that clang tools themselves aren’t cached and where assets live. No issues.


372-385: LGTM on uv args construction and clang-tools invocation

The --project + --directory (pwd) workaround addresses uv’s project environment edge cases. Verbosity handling is clean.


249-271: Cache key derivation and storage path look good

Using uv.lock hash or action.yml hash is a sensible cache key. Storing in runner.temp avoids polluting workspace.


273-321: Request quick validation on Linux/macOS runners after these Nu changes

Given the shell migration and the critical Windows uv fix above, a quick smoke run across platforms will guard against regressions (apt script/save semantics, brew symlinks, uv flags, PATH augmentation).

I can generate a matrix workflow snippet you can paste into a temporary branch to validate Linux/macOS end-to-end if you’d like. -->

Also applies to: 324-333, 339-361, 372-385, 387-442

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

♻️ Duplicate comments (1)
action.yml (1)

395-416: About passing empty --extra-arg: acceptable per downstream parser

You previously noted that your downstream parser in cpp-linter/cpp-linter tolerates --extra-arg="". Keeping it as-is is fine; conditional appending can be explored later if desired.

🧹 Nitpick comments (4)
README.md (2)

159-169: Tighten phrasing; minor grammar tweaks for clarity

A few wording improvements make this section scan better and avoid hyphenation ambiguity.

Apply this diff:

-## Required tools installed
+## Required tools installed
@@
-As of v2.16.0, this action uses
+As of v2.16.0, this action uses:
@@
-- [nushell] for cross-platform compatible scripting
-- [uv] for driving a Python virtual environment
+- [nushell] for cross-platform scripting
+- [uv] to manage a Python virtual environment
@@
-This action installs [nushell] and [uv] automatically.
-Only [nushell] is added to the PATH environment variable.
-[uv], and any standalone Python distribution it downloads, are not added to the PATH environment variable.
+This action installs both [nushell] and [uv] automatically.
+Only [nushell] is added to PATH.
+[uv], and any standalone Python distribution it downloads, are not added to PATH.

171-189: Linux prerequisites: include CA certs and make wget/curl guidance explicit

LLVM’s installer fetches over HTTPS and GPG-validates keys; CA bundles are often missing in minimal images. Also, the bulleted list says “wget or curl” but the command installs only wget. Consider installing both or making the choice explicit.

Proposed diff:

 Linux workflows that use a specific [container][gh-container-syntax] should ensure that
 the following are installed:
@@
-- GLIBC (v2.32 or later)
-- `wget` or `curl`
+- GLIBC (v2.32 or later)
+- `wget` or `curl` (at least one)
 - `lsb-release` (required by LLVM-provided install script)
 - `software-properties-common` (required by LLVM-provided install script)
 - `gnupg` (required by LLVM-provided install script)
+- `ca-certificates` (required for HTTPS downloads)
@@
-apt-get update
-apt-get install -y libc6 wget lsb-release software-properties-common gnupg
+# choose either wget or curl; installing both is also fine
+apt-get update
+apt-get install -y libc6 wget curl lsb-release software-properties-common gnupg ca-certificates
action.yml (2)

273-321: Linux: minor nits + optional hardening when fetching llvm.sh

  • There’s a harmless double space before ...$apt_install_args on Line 290.
  • Optional: consider save --force or removing the file before saving for idempotency across re-runs (even though action path usually starts clean).
  • Optional: when executing remote installers, you could pin or checksum the script for extra supply-chain safety.

Apply this diff to fix the spacing nit and make save idempotent:

-                ^apt-get  ...$apt_install_args
+                ^apt-get ...$apt_install_args
@@
-          (
-            http get --raw --redirect-mode follow https://apt.llvm.org/llvm.sh
-            | save $"($action_path)/llvm_install.sh"
-          )
+          (
+            http get --raw --redirect-mode follow https://apt.llvm.org/llvm.sh
+            | save --force $"($action_path)/llvm_install.sh"
+          )

If you want checksum verification, I can draft a Nu snippet that computes and validates a known SHA256 before execution.


349-361: Windows uv installer: add -NoProfile to avoid profile side-effects

Piping to PowerShell with -Command - is correct. Add -NoProfile to prevent user profiles from mutating the session.

Apply this diff:

-        if $is_windows {
-          $installer | ^powershell -NonInteractive -ExecutionPolicy ByPass -Command -
+        if $is_windows {
+          $installer | ^powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command -
         } else {
           $installer | ^sh
         }
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a27ea8b and 6edefb8.

📒 Files selected for processing (2)
  • README.md (2 hunks)
  • action.yml (2 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-08-17T12:34:25.438Z
Learnt from: 2bndy5
PR: cpp-linter/cpp-linter-action#314
File: action.yml:394-416
Timestamp: 2025-08-17T12:34:25.438Z
Learning: The cpp-linter/cpp-linter-action repository manages the downstream parsing of command-line arguments through their own cpp-linter/cpp-linter project, so passing empty string values for flags like --extra-arg="" is acceptable and known to work in their implementation.

Applied to files:

  • action.yml
📚 Learning: 2025-08-17T12:31:25.296Z
Learnt from: 2bndy5
PR: cpp-linter/cpp-linter-action#314
File: action.yml:273-321
Timestamp: 2025-08-17T12:31:25.296Z
Learning: In Nu shell, the pattern `(...) | complete | $in.exit_code == 0` is valid syntax for checking command exit codes, where `complete` captures the command result and `$in` refers to the piped input.

Applied to files:

  • action.yml
📚 Learning: 2025-08-17T12:50:57.018Z
Learnt from: 2bndy5
PR: cpp-linter/cpp-linter-action#314
File: action.yml:273-321
Timestamp: 2025-08-17T12:50:57.018Z
Learning: In Nu shell, `$in` is shorthand for a closure that takes 1 argument, so `(...) | complete | $in.exit_code == 0` is equivalent to `(...) | complete | {|in| $in.exit_code == 0}`.

Applied to files:

  • action.yml
📚 Learning: 2025-08-17T12:34:25.438Z
Learnt from: 2bndy5
PR: cpp-linter/cpp-linter-action#314
File: action.yml:394-416
Timestamp: 2025-08-17T12:34:25.438Z
Learning: In the cpp-linter-action project, technical improvements can be deferred to separate PRs when they're not critical to the current changes, especially when the current implementation is known to work correctly.

Applied to files:

  • action.yml
📚 Learning: 2025-08-17T12:50:57.018Z
Learnt from: 2bndy5
PR: cpp-linter/cpp-linter-action#314
File: action.yml:273-321
Timestamp: 2025-08-17T12:50:57.018Z
Learning: In Nu shell, the `.` operator on records is equivalent to `| get`, so `$rec.exit_code` is the same as `$rec | get 'exit_code'`.

Applied to files:

  • action.yml
🪛 LanguageTool
README.md

[grammar] ~163-~163: There might be a mistake here.
Context: ... for cross-platform compatible scripting - [uv] for driving a Python virtual environ...

(QB_NEW_EN)


[grammar] ~175-~175: There might be a mistake here.
Context: ...[gh-container-syntax] should ensure that the following are installed: - GLIBC (v...

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (16)
  • GitHub Check: test (windows-latest, 15)
  • GitHub Check: test (windows-latest, 17)
  • GitHub Check: test (windows-latest, 14)
  • GitHub Check: test (windows-latest, 18)
  • GitHub Check: test (windows-latest, 12)
  • GitHub Check: test (macos-latest, 17)
  • GitHub Check: test (windows-latest, 10)
  • GitHub Check: test (macos-latest, 12)
  • GitHub Check: test (windows-latest, 8)
  • GitHub Check: test (ubuntu-latest, 18)
  • GitHub Check: test (macos-latest, 14)
  • GitHub Check: test (ubuntu-latest, 15)
  • GitHub Check: test (ubuntu-latest, 12)
  • GitHub Check: test (macos-latest, 19)
  • GitHub Check: test (macos-latest, 20)
  • GitHub Check: test (ubuntu-latest, 19)
🔇 Additional comments (9)
README.md (2)

37-37: Good change: warning now points to concrete requirements

Linking to the new “Required tools installed” section is clearer and more actionable than the previous generic warning.


191-201: macOS/Windows notes align with installer flow

The documented fallback to static binaries matches the action’s later uv-driven clang-tools ensure step. Looks consistent.

action.yml (7)

220-227: Cache description reads well and sets correct expectations

Clear that tool binaries aren’t cached and where cache lives. No issues found.


324-333: macOS: symlink approach is fine; consider Homebrew prefix variance

On Apple Silicon, Homebrew’s prefix is commonly /opt/homebrew; you’re already deriving it via brew --prefix llvm@<ver>, which is good. The hard-coded /usr/local/bin symlink target generally works on GitHub macOS runners; if self-hosted runners are in scope, note that write permissions may vary.

If you support self-hosted macOS runners, confirm /usr/local/bin is writable; otherwise, consider symlinking into the detected Homebrew bin dir or adjusting PATH instead.


372-377: uv sync flow is clean and respects verbosity

Using --group action with conditional -v is tidy and debuggable. Looks good.


379-385: Ensuring clang-tools via uv is aligned with README fallback

This provides the promised cross-platform fallback regardless of OS-specific package managers. LGTM.


417-429: Verbosity gating is consistent with earlier steps

Reusing the same detection for ACTIONS_STEP_DEBUG and user input keeps behavior predictable. No issues.


430-438: Linux PATH augmentation for ~/.local/bin is a nice touch

Temporary PATH extension avoids surprises when user-installed tools live under ~/.local/bin. Looks correct and safe.


441-441: Final uv invocation is correct and mirrors setup pattern

uv run --no-sync --project <action_path> --directory (pwd) with args expansion is consistent and robust across shells. LGTM.

@shenxianpeng
Copy link
Collaborator

And, nushell is already wrapping some of the functions from uutils/coreutils.

The drawback of using nushell is that it requires some learning and pre-installation (since GitHub Actions doesn’t ship it by default, unlike other shells or Python). I’ve been wondering whether it’s worth adopting, especially given that PowerShell and Python are also available on Windows, Linux, and macOS runners. After trying some commands, nushell seems quite interesting—which might be the most important.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 17, 2025

And, nushell is already wrapping some of the functions from uutils/coreutils.

The drawback of using nushell is that it requires some learning and pre-installation (since GitHub Actions doesn’t ship it by default, unlike other shells or Python). I’ve been wondering whether it’s worth adopting, especially given that PowerShell and Python are also available on Windows, Linux, and macOS runners. After trying some commands, nushell seems quite interesting—which might be the most important.

  1. Do you know powershell? I don't. Command arguments in powershell feels foreign to me because they do not follow the GNU standard for CLI options. I also don't like bash because the meaning/intention is not obvious to the naked eye. For example, syntax like if [[ -z "$some_path" ]] says nothing about its meaning or intention.
  2. Python is not a shell. Using a python script requires some extra error handling because stack traces (before Python v3.13) are not understandable by most people that do not write python code. Most shells output errors in a readable way. In fact nushell interprets nu syntax like a compile-time language, see nushell docs.
  3. We started writing steps twice in bash and powershell because there was no guarantee that either would be available on certain runners (self-hosted or those that use containers like GitLab Pipelines does). In testing, I found that the shell field in GitHub Actions syntax is not allowed to be dynamic (similar to how uses cannot use variables like ${{ inputs.git-ref }}).

I've been using nushell on all my machines for almost 2 years now. The more I use the nushell syntax, the more I love it. Some concepts were borrowed from bash (commands like mkdir, cat, rm, etc. and piping data <input> | <command using input>). There's also support for things that other shells do not have: closures (inline anonymous functions) and variables are immutable unless declared with mut (instead of let). To me, nushell syntax feels a lot like if rust and bash had a baby.

There's a task runner out there called nur (nushell runner) which ships with nushell builtin. So, authors don't have to worry about what OS/shell another team member might use.

@shenxianpeng
Copy link
Collaborator

I don't know PowerShell either. : )

syntax like if [[ -z "$some_path" ]] says nothing about its meaning or intention.

It's true.

Good to know you’re familiar with Nushell. I tried it a bit myself, and it’s interesting and I have no concerns about it now.

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 (7)
README.md (7)

156-166: Polish wording and quote PATH for consistency/readability

Tighten phrasing and standardize PATH formatting.

-As of v2.16.0, this action uses
-
-- [nushell] for cross-platform compatible scripting
-- [uv] for driving a Python virtual environment
+As of v2.16.0, this action uses:
+
+- [nushell] for cross-platform scripting
+- [uv] for managing Python virtual environments
@@
-This action installs [nushell] and [uv] automatically.
-Only [nushell] is added to the PATH environment variable.
-[uv], and any standalone Python distribution it downloads, are not added to the PATH environment variable.
+This action installs [nushell] and [uv] automatically.
+Only [nushell] is added to the `PATH`.
+[uv], and any standalone Python distribution it downloads, are not added to the `PATH`.

169-171: Clarify Linux support scope

Make the constraint and rationale concise.

-We only support Linux runners using a Debian-based Linux OS (like Ubuntu and many others).
-This is because we first try to use the `apt` package manager to install clang tools.
+We currently support Debian-based Linux runners (e.g., Ubuntu) because the action installs clang tools via `apt`.

172-180: Name what’s being installed and include ca-certificates (often required)

Explicitly say “packages” and consider adding ca-certificates which is commonly needed for HTTPS downloads/repos.

-Linux workflows that use a specific [`container`][gh-container-syntax] should ensure that
-the following are installed:
+Linux workflows that use a specific [`container`][gh-container-syntax] should ensure that
+the following packages are installed:
@@
 - `software-properties-common` (required by LLVM-provided install script)
 - `gnupg` (required by LLVM-provided install script)
+- `ca-certificates` (required for HTTPS downloads and APT repositories)

181-184: APT example: add ca-certificates and avoid pulling recommends

Keeps container images leaner and reduces surprises.

 apt-get update
-apt-get install -y libc6 wget lsb-release software-properties-common gnupg
+apt-get install -y --no-install-recommends libc6 wget lsb-release software-properties-common gnupg ca-certificates

186-186: Tighten wording

Minor phrasing improvement.

-Otherwise, [nushell] and/or the LLVM-provided bash script will fail to run.
+Otherwise, [nushell] and/or the LLVM-provided install script will fail to run.

190-193: Minor style: “details” vs “detail”

Nit on phrasing.

-see [cpp-linter/clang-tools-pip] and [cpp-linter/clang-tools-static-binaries] projects for more detail.
+see [cpp-linter/clang-tools-pip] and [cpp-linter/clang-tools-static-binaries] projects for more details.

196-198: Minor style: mirror macOS phrasing

Same nit for consistency.

-See [cpp-linter/clang-tools-pip] and [cpp-linter/clang-tools-static-binaries] projects for more detail.
+See [cpp-linter/clang-tools-pip] and [cpp-linter/clang-tools-static-binaries] projects for more details.
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6edefb8 and 45a8c12.

📒 Files selected for processing (1)
  • README.md (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-17T13:20:51.010Z
Learnt from: 2bndy5
PR: cpp-linter/cpp-linter-action#314
File: README.md:206-211
Timestamp: 2025-08-17T13:20:51.010Z
Learning: For GitHub Actions documentation references in cpp-linter-action, prefer stable workflow syntax documentation links over "canonical" specialized pages that may redirect, as the comprehensive workflow syntax page provides better context and examples for container configuration.

Applied to files:

  • README.md
🪛 LanguageTool
README.md

[grammar] ~160-~160: There might be a mistake here.
Context: ... for cross-platform compatible scripting - [uv] for driving a Python virtual environ...

(QB_NEW_EN)


[grammar] ~172-~172: There might be a mistake here.
Context: ...[gh-container-syntax] should ensure that the following are installed: - GLIBC (v...

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: test (windows-latest, 10)
  • GitHub Check: test (ubuntu-latest, 15)
  • GitHub Check: test (windows-latest, 20)
  • GitHub Check: test (ubuntu-latest, 19)
  • GitHub Check: test (windows-latest, 13)
  • GitHub Check: test (macos-latest, 14)
  • GitHub Check: test (ubuntu-latest, 14)
  • GitHub Check: test (windows-latest, 19)
  • GitHub Check: test (windows-latest, 20)
  • GitHub Check: test (windows-latest, 17)
  • GitHub Check: test (windows-latest, 16)
  • GitHub Check: test (windows-latest, 12)
  • GitHub Check: test (windows-latest, 8)
  • GitHub Check: test (macos-latest, 18)
  • GitHub Check: test (windows-latest, 11)
  • GitHub Check: test (macos-latest, 13)
  • GitHub Check: test (macos-latest, 20)
  • GitHub Check: test (macos-latest, 9)
🔇 Additional comments (1)
README.md (1)

203-208: LGTM on link references (keeps workflow syntax doc as preferred target)

References look good and align with the preference to use the comprehensive workflow syntax page for container configuration.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 18, 2025

The default immutability of variables in nushell is the only feature that causes me trouble. But that just makes me rethink my approach, in which case the script ends up being more robust anyway.

@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 18, 2025

I've also made some important changes to the test repo (test-uv branch). I'll submit a PR for that repo soon.

@2bndy5 2bndy5 merged commit fb269f1 into main Aug 18, 2025
83 checks passed
@2bndy5 2bndy5 deleted the fix-venv branch August 18, 2025 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error after recent update (v2.16.0)
2 participants