diff --git a/.github/workflows/clp-uv-checks.yaml b/.github/workflows/clp-uv-checks.yaml new file mode 100644 index 0000000000..6f60233b00 --- /dev/null +++ b/.github/workflows/clp-uv-checks.yaml @@ -0,0 +1,52 @@ +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 the latest version of uv" + uses: "astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41" # v7.1.2 + + - name: "Validate lock files" + shell: "bash" + run: "task deps:lock:check-uv" diff --git a/docs/src/dev-docs/tooling-gh-workflows.md b/docs/src/dev-docs/tooling-gh-workflows.md index 4d52694b3e..25491c9073 100644 --- a/docs/src/dev-docs/tooling-gh-workflows.md +++ b/docs/src/dev-docs/tooling-gh-workflows.md @@ -91,3 +91,7 @@ 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 lockfile matches the project metadata. diff --git a/taskfiles/deps/lock.yaml b/taskfiles/deps/lock.yaml index bf656e9c11..651bfd87e6 100644 --- a/taskfiles/deps/lock.yaml +++ b/taskfiles/deps/lock.yaml @@ -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. @@ -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}}