-
Notifications
You must be signed in to change notification settings - Fork 22
feat: migrate to uv and use nu shell #306
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
Conversation
Technically requirements.txt is not used by
|
resolves #305
reusable workflow does not use uv (yet)
We might remove requirements.txt by installing action deps by |
cpp-linter-action/.readthedocs.yaml Line 19 in 659d314
https://docs.readthedocs.com/platform/stable/build-customization.html#id15 Here also support |
If existing requirements.txt could be replaced by pyproject.toml file, that would be great! |
I had no idea this was supported. I need to investigate what version of pip introduced this option.
I often forget about updating RTD config. Nice catch! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I found a way to prevent adding env:
UV_NO_MODIFY_PATH: 1 Using UV in action.yml can also make caching the venv (and action deps) rather easy. This would also resolve #234 . We also wouldn't require runners to have python installed because I'm a bit distracted right now. I'll pick this up later. |
💯 No rush |
Cpp-Linter Report
|
includes doc'd `minimum-version` for the new input option
I've done what I can, but our org's reusable workflow (for mkdocs) still depends on docs/requirements.txt. Once that workflow is updated (or replaced), I can delete docs/requirements.txt.
I also managed to use Only nushell is added to the PATH (via hustcer/setup-nu),
I also introduced the new |
I will remove the useless docs/requirements.txt after cpp-linter/.github#38 is merged. |
WalkthroughReplaces Python venv steps with a Nu + uv-based composite action (with optional caching), adds a cache-enable input and unified outputs, updates CI/docs packaging and dependency files (pyproject, requirements), adjusts ReadTheDocs build, updates Dependabot to uv, and removes a pre-commit requirements fixer. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Runner as GitHub Runner
participant Action as Composite Action
participant Nu as Nu shell
participant Cache as actions/cache
participant uv as uv
User->>Runner: Trigger workflow
Runner->>Action: Run action.yml
Action->>Action: Setup Nu shell
Action->>Nu: Compute cache key (lock/requirements/action.yml)
alt cache-enable == true
Action->>Cache: Restore cache with key
Cache-->>Action: Cache hit/miss
end
Action->>Nu: Install uv and sync deps (group: action)
Nu->>uv: Resolve/install tools
Action->>Nu: Run cpp-linter via uv
Nu-->>Action: Returns results (checks-failed, clang-* outputs)
Action-->>Runner: Expose unified outputs
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Assessment against linked issues
Out-of-scope changes
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-08-13T09:26:54.549Z
Applied to files:
🔇 Additional comments (9)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
🔭 Outside diff range comments (1)
action.yml (1)
326-351
: Splitextra-args
into individual flags & quote path inputsTo align with action.yml documentation—where
extra-args
is a space-separated list that should be passed as repeated--extra-arg
flags—replace the single--extra-arg="${{ inputs.extra-args }}"
with Nu code that splits on whitespace. Also quote any path-like inputs to guard against spaces.Bullet-proof diff:
let args = [ --style="${{ inputs.style }}" --extensions="${{ inputs.extensions }}" --tidy-checks="${{ inputs.tidy-checks }}" - --repo-root=${{ inputs.repo-root }} + --repo-root="${{ inputs.repo-root }}" --version="${{ inputs.version }}" --verbosity="${{ inputs.verbosity }}" --lines-changed-only="${{ inputs.lines-changed-only }}" --files-changed-only="${{ inputs.files-changed-only }}" --thread-comments="${{ inputs.thread-comments }}" --no-lgtm="${{ inputs.no-lgtm }}" --step-summary="${{ inputs.step-summary }}" --ignore="${{ inputs.ignore }}" --ignore-tidy="${{ inputs.ignore-tidy }}" --ignore-format="${{ inputs.ignore-format }}" - --database=${{ inputs.database }} + --database="${{ inputs.database }}" - --file-annotations=${{ inputs.file-annotations }} + --file-annotations="${{ inputs.file-annotations }}" - --extra-arg="${{ inputs.extra-args }}" ] + # Split `extra-args` into individual --extra-arg flags + let extra_inputs = "${{ inputs.extra-args }}" + let extra_flags = ( + $extra_inputs + | split row ' ' + | where {|x| $x != ''} + | each {|e| $"--extra-arg={e}"} + ) + let args = ($args | append $extra_flags) ^$'($env.UV_INSTALL_DIR)/uv' run cpp-linter ...$args
- Verified in action.yml that the intent is one
--extra-arg
per token:
clang-tidy --extra-arg=-std=c++17 --extra-arg=-Wall.- Quoted
repo-root
,database
, andfile-annotations
to handle paths with spaces.
🧹 Nitpick comments (2)
action.yml (2)
278-284
: Optional: add restore-keys for partial cache reuse.To soften cache busts on minor edits (e.g., comments in pyproject), add a generic restore key.
uses: actions/cache@v4 with: path: ${{ runner.temp }}/cpp-linter-action-cache key: cpp-linter-action_${{ runner.os }}_${{ steps.compute-cache-key.outputs.key }} + restore-keys: | + cpp-linter-action_${{ runner.os }}_
236-249
: Optional: consider dropping platform tool installs if clang-tools pip covers it.Given you run “uv run clang-tools -i … -b”, the apt/brew installs may be redundant and slow. Consider making them conditional or removing them to shorten runs, unless you rely on system clang-{tidy,format} elsewhere.
I can provide a follow-up diff that skips OS package installs when clang-tools installation succeeds.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lock
is excluded by!**/*.lock
📒 Files selected for processing (7)
.github/dependabot.yml
(2 hunks).pre-commit-config.yaml
(0 hunks).readthedocs.yaml
(1 hunks)action.yml
(3 hunks)docs/action.yml
(1 hunks)pyproject.toml
(1 hunks)requirements.txt
(0 hunks)
💤 Files with no reviewable changes (2)
- requirements.txt
- .pre-commit-config.yaml
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-12T08:57:29.249Z
Learnt from: 2bndy5
PR: cpp-linter/cpp-linter-action#303
File: .github/dependabot.yml:0-0
Timestamp: 2025-08-12T08:57:29.249Z
Learning: For Dependabot's github-actions ecosystem, multiple directories in the directories list are supported. When directory is "/", Dependabot scans both .github/workflows/ and root action.yml/action.yaml files. Other directory entries are treated as workflow directories and scanned for .yml/.yaml files.
Applied to files:
.github/dependabot.yml
🔇 Additional comments (5)
docs/action.yml (1)
52-53
: Good addition: version-gating the new input.Adding cache-enable with minimum-version '2.16.0' is consistent and keeps the docs metadata aligned with the composite action interface.
.github/dependabot.yml (1)
8-12
: Dependabot multi-ecosystem-groups configuration is correct—no per-update schedules needed
The top-level keymulti-ecosystem-groups
is valid and group-levelschedule
settings apply to all member updates. No changes are required.pyproject.toml (1)
1-5
: Virtual project config looks sane for uv.Declaring a “virtual” project with requires-python and empty dependencies is fine for uv-managed groups. Nice touch on the pre-release version tag.
action.yml (2)
219-223
: New input wired correctly.cache-enable defaulting to true is reasonable; naming and description are clear.
244-247
: Minor robustness improvement looks good.Using ${GITHUB_ACTION_PATH%/} guards against stray trailing slashes. Good catch.
I looked at the source for hustcer/setup-nu, and it does exactly what I would have to do manually:
Fortunately, hustcer/setup-nu already does steps 1-3. It also adds the downloaded asset to somewhere in PATH, so step 4 is not really needed. If the user's workflow already uses a version of nushell, then we may have a conflict on our hands. However, nu shell doesn't seem widely used because it is still in v0.x. I'll just have to keep updating the pinned version of nushell here: Lines 254 to 256 in 86d4fb5
|
I forgot to review the README. A follow up PR is coming. |
follow-up to #306 Python is no longer required to be installed on the runner anymore. `uv sync` will automatically download the latest supported stable version of Python.
follow-up to #306 Python is no longer required to be installed on the runner anymore. `uv sync` will automatically download the latest supported stable version of Python.
resolves #305
closes #234
This uses dependabot's newer option to combine multiple package ecosystems into 1 group. This means that updates to uv.lock, pyproject.toml, and **/requirements.txt should be submitted in 1 PR.
uv
requires pyproject.toml to specify dependency groups. The specified[project]
in pyproject.toml shall be considered "virtual" because nobuild-backend
is specified.Install all dependencies as before with
uv
:Summary by CodeRabbit
New Features
Documentation
Chores