Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/clp-uv-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "clp-uv-checks"

on:
pull_request:
paths: &monitored_paths
- ".github/workflows/clp-uv-checks.yaml"
- "components/clp-mcp-server/pyproject.toml"
- "components/clp-mcp-server/uv.lock"
- "components/clp-package-utils/pyproject.toml"
- "components/clp-package-utils/uv.lock"
- "components/clp-py-utils/pyproject.toml"
- "components/clp-py-utils/uv.lock"
- "components/job-orchestration/pyproject.toml"
- "components/job-orchestration/uv.lock"
- "integration-tests/pyproject.toml"
- "integration-tests/uv.lock"
push:
paths: *monitored_paths
schedule:
# Run daily at 00:15 UTC (the 15 is to avoid periods of high load)
- cron: "15 0 * * *"
workflow_dispatch:

concurrency:
group: "${{github.workflow}}-${{github.ref}}"
# Cancel in-progress jobs for efficiency
cancel-in-progress: true

jobs:
uv-checks:
strategy:
matrix:
os:
- "macos-15"
- "ubuntu-22.04"
- "ubuntu-24.04"
runs-on: "${{matrix.os}}"
steps:
- uses: "actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8" # v5.0.0
with:
submodules: "recursive"

- name: "Install task"
shell: "bash"
run: "npm install -g @go-task/cli@3.44.0"

- name: "Install uv"
shell: "bash"
run: "curl --fail --location --silent --show-error https://astral.sh/uv/install.sh | sh"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It might be worth to add this to the repo (like how we set up cargo)?
But I guess it's not gonna be in this PR. How about let's try https://github.com/astral-sh/setup-uv?


- name: "Validate lock files"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add uv to PATH before running lockfile checks

The workflow installs uv via the curl script but never appends the installation directory to PATH. On GitHub macOS runners the script installs the binary under $HOME/.local/bin without exporting that path for subsequent steps, so the following task deps:lock:check-uv invocation will fail with uv: command not found on macOS while the Linux jobs may pass. Consider adding echo "$HOME/.local/bin" >> "$GITHUB_PATH" (or similar) after the install so that uv is available in the validation step.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Add uv to PATH before running lockfile checks

The workflow installs uv via the curl script but never appends the installation directory to PATH. On GitHub macOS runners the script installs the binary under $HOME/.local/bin without exporting that path for subsequent steps, so the following task deps:lock:check-uv invocation will fail with uv: command not found on macOS while the Linux jobs may pass. Consider adding echo "$HOME/.local/bin" >> "$GITHUB_PATH" (or similar) after the install so that uv is available in the validation step.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsrun:~:text=Each%20run%20keyword%20represents%20a%20new%20process%20and%20shell%20in%20the%20runner%20environment.

Each run keyword represents a new process and shell in the runner environment. When you provide multi-line commands, each line runs in the same shell.

the lockfile checks are not in the same "multi-line" command as the "Install uv" step, right? so if a new shell is to be started on every new step, the new step should have had read the shell profile again and get the correct PATH if the uv installation script has correctly set the PATH?

shell: "bash"
run: "task deps:lock:check-uv"
5 changes: 5 additions & 0 deletions docs/src/dev-docs/tooling-gh-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,8 @@ This workflow builds CLP-core on macOS and runs its unit tests.
## clp-lint

This workflow runs linting checks on the codebase.

## clp-uv-checks

This workflow checks whether each UV Python project's `uv.lock` is up-to-date with its
`pyproject.toml`.
Comment thread
junhaoliao marked this conversation as resolved.
Resolved
33 changes: 33 additions & 0 deletions taskfiles/deps/lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,33 @@ tasks:
vars:
CARGO_FETCH_FLAGS: "--locked"

check-uv:
cmds:
- for: &uv-projects
- "{{.G_COMPONENTS_DIR}}/clp-mcp-server"
- "{{.G_COMPONENTS_DIR}}/clp-package-utils"
- "{{.G_COMPONENTS_DIR}}/clp-py-utils"
- "{{.G_COMPONENTS_DIR}}/job-orchestration"
- "{{.G_INTEGRATION_TESTS_DIR}}"
task: "uv-lock"
vars:
PROJECT_DIR: "{{.ITEM}}"
UV_LOCK_FLAGS: "--check"

update-rust:
cmds:
- task: "cargo-workspace-update"
vars:
CARGO_UPDATE_FLAGS: ""

update-uv:
cmds:
- for: *uv-projects
task: "uv-lock"
vars:
PROJECT_DIR: "{{.ITEM}}"
UV_LOCK_FLAGS: ""

# Runs `cargo fetch` in the root Rust workspace directory with the specified flags.
#
# @param {string} CARGO_FETCH_FLAGS The flags to pass to the `cargo fetch` command.
Expand All @@ -41,3 +62,15 @@ tasks:
cmd: |-
. "$HOME/.cargo/env"
cargo update {{.CARGO_UPDATE_FLAGS}}

# Runs `uv lock` in the UV project directory with the specified flags.
#
# @param {string} PROJECT_DIR
# @param {string} UV_LOCK_FLAGS The flags to pass to the `uv lock` command.
uv-lock:
internal: true
requires:
vars: ["PROJECT_DIR", "UV_LOCK_FLAGS"]
dir: "{{.PROJECT_DIR}}"
cmd: |-
uv lock {{.UV_LOCK_FLAGS}}
Comment on lines +66 to +76

@coderabbitai coderabbitai Bot Oct 27, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Consider adding clarification on uv tool availability.

The task assumes the uv CLI tool is available in the environment but doesn't declare this as a dependency. Consider adding a comment or checking if other tasks in the file declare similar toolchain dependencies.

You may want to verify whether a toolchain dependency (like deps: ["toolchains:python"] or similar) should be declared to ensure uv is available, consistent with how cargo-workspace-fetch depends on toolchains:rust (line 48).

🤖 Prompt for AI Agents
In taskfiles/deps/lock.yaml around lines 66 to 76, the uv-lock task assumes the
`uv` CLI is present but does not declare any toolchain dependency or note the
requirement; add a dependency entry similar to cargo-workspace-fetch (e.g. deps:
["toolchains:uv"] or the appropriate toolchain that provides `uv`) or at minimum
add a short comment above the task documenting that `uv` must be installed, and
align the dependency pattern with other tasks in this file so the tool is
guaranteed available in CI/local runs.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it's documented here already:

uv isn't installed the same way as the rust toolchain in a task, although i agree that at some point we probably should. it's out of scope of the current PR anyways

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@junhaoliao, thank you for the clarification! You're absolutely right—UV is documented in the building-package guide, and since it's not managed through a task dependency like the rust toolchain, adding that now would indeed be out of scope. I appreciate you pointing out the documentation location and explaining the current approach.


✏️ Learnings added
Learnt from: junhaoliao
PR: y-scope/clp#1507
File: taskfiles/deps/lock.yaml:66-76
Timestamp: 2025-10-27T04:05:01.545Z
Learning: In the CLP project, the `uv` CLI tool is documented as a prerequisite in docs/src/dev-docs/building-package.md and is not installed via a task dependency like the rust toolchain. UV is expected to be available in the environment rather than being provisioned by the taskfile system.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: Bill-hbrhbr
PR: y-scope/clp#1271
File: components/core/tools/scripts/lib_install/centos-stream-9/install-prebuilt-packages.sh:41-43
Timestamp: 2025-08-29T07:31:24.032Z
Learning: In CLP's build tool installation scripts, uv version constraints should use lower bound constraints (uv>=0.8) rather than exact version pinning, following the same philosophy used for other build tools to accommodate platform differences while ensuring minimum required functionality.