Skip to content

CI: Update build-module workflow#2048

Open
squioc wants to merge 5 commits intodevelopfrom
chore/RefactorGitHubWorkflow
Open

CI: Update build-module workflow#2048
squioc wants to merge 5 commits intodevelopfrom
chore/RefactorGitHubWorkflow

Conversation

@squioc
Copy link
Collaborator

@squioc squioc commented Feb 19, 2026

Update the build-module workflow:

  • Outsource poetry commands inside a dedicated GitHub action
  • Create the equivalent one for uv
  • Update the workflow to detect the package manager and use the corresponding action.

Summary by Sourcery

Update the module build workflow to support both Poetry and uv via reusable composite actions for testing modules.

CI:

  • Refactor the build-modules workflow to detect the package manager (Poetry or uv) and invoke the appropriate testing action.
  • Adjust workflow syntax and job steps formatting for consistency.

Tests:

  • Extract module test logic into reusable composite actions for Poetry and uv, including dependency installation, formatting checks, type checks, and pytest runs.

@squioc squioc requested review from a team, Darkheir, Copilot and otetard February 19, 2026 16:45
@squioc squioc added the enhancement New feature or request label Feb 19, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 19, 2026

Reviewer's Guide

Refactors the build-modules CI workflow to delegate testing to reusable composite actions, with automatic detection of Poetry vs uv as the Python package manager, while preserving the existing linting and testing behavior per module.

Sequence diagram for updated build-modules CI workflow with package manager detection

sequenceDiagram
    actor Dev
    participant GitHub as GitHub_Actions
    participant WF as build-modules_workflow
    participant JM as find-modules_job
    participant JB as build-module_job
    participant DP as detect-pm_step
    participant P as test-with-poetry_action
    participant U as test-with-uv_action
    participant RS as result-status_job

    Dev->>GitHub: push_or_pull_request
    GitHub->>WF: trigger_build-modules_workflow

    WF->>JM: run_find-modules
    JM-->>WF: modules_matrix

    WF->>JB: start_build-module_matrix_for_each_module
    JB->>JB: setup-python_3_11
    JB->>DP: run_detect-pm
    DP-->>JB: package_manager=poetry_or_uv

    alt Poetry_project
        JB->>P: use_test-with-poetry_with_module
        P-->>JB: lint_and_tests_completed
    else uv_project
        JB->>U: use_test-with-uv_with_module
        U-->>JB: lint_and_tests_completed
    end

    JB-->>WF: job_result

    WF->>RS: run_result-status_with_needs
    alt any_job_failed_and_modules_found
        RS-->>GitHub: workflow_failure
    else all_jobs_success_or_no_modules
        RS-->>GitHub: workflow_success
    end
Loading

Flow diagram for package manager detection and test selection

flowchart TD
    A[Start build-module job for a module] --> B[Setup Python 3.11]
    B --> C[Check if uv.lock exists in MODULE_PATH]

    C -->|Found uv.lock| D[Set package_manager=uv]
    C -->|Not found| E[Set package_manager=poetry]

    D --> F[Use composite action test-with-uv with module]
    E --> G[Use composite action test-with-poetry with module]

    F --> H[Upload artifacts]
    G --> H[Upload artifacts]

    H --> I[End job]
Loading

File-Level Changes

Change Details Files
Refactor build-modules workflow to use package-manager-specific composite actions for testing modules.
  • Normalize pull_request type list formatting and minor YAML formatting fixes
  • Add a step to detect the package manager (uv vs Poetry) based on the presence of uv.lock in the module directory and expose it via step outputs
  • Replace inline Poetry install/lint/test steps with conditional calls to local composite actions for Poetry or uv
  • Keep success/failure aggregation job but fix step indentation for clarity and correctness
.github/workflows/build-modules.yml
Introduce a reusable composite GitHub Action to run Poetry-based tests and checks for a module.
  • Install Poetry and configure in-project virtualenvs
  • Install dependencies with poetry install in the target module directory
  • Run Black via psf/black@stable against the given module path
  • Run mypy inside the Poetry environment with appropriate flags and cache directory
  • Run pytest with coverage and JUnit XML output using Poetry
.github/actions/test-with-poetry/action.yaml
Introduce a reusable composite GitHub Action to run uv-based tests and checks for a module.
  • Install uv using astral-sh/setup-uv with caching and environment activation
  • Install dependencies with uv sync in the target module directory
  • Run Black via psf/black@stable against the given module path
  • Run mypy via uv (installing it with uv pip) and execute with the same flags and cache behavior as the Poetry flow
  • Run pytest with coverage and JUnit XML output using uv run
.github/actions/test-with-uv/action.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The test-with-poetry and test-with-uv composite actions duplicate most of the logic (Black, mypy, pytest invocation); consider extracting the common steps into a shared composite or parameterizing a single action to reduce maintenance overhead.
  • The package manager detection relies solely on the presence of uv.lock; if you expect uv projects that might not commit a lock file, consider also checking pyproject.toml (e.g., for [tool.uv]) or another uv-specific marker to avoid incorrectly defaulting to Poetry.
  • The id: install-dependencies and id: execute-tests in the composite actions are not used by subsequent steps; you can remove these ids to simplify the actions unless you plan to consume their outputs later.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `test-with-poetry` and `test-with-uv` composite actions duplicate most of the logic (Black, mypy, pytest invocation); consider extracting the common steps into a shared composite or parameterizing a single action to reduce maintenance overhead.
- The package manager detection relies solely on the presence of `uv.lock`; if you expect uv projects that might not commit a lock file, consider also checking `pyproject.toml` (e.g., for `[tool.uv]`) or another uv-specific marker to avoid incorrectly defaulting to Poetry.
- The `id: install-dependencies` and `id: execute-tests` in the composite actions are not used by subsequent steps; you can remove these ids to simplify the actions unless you plan to consume their outputs later.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the “Build Modules” CI workflow by moving module test/lint commands into reusable local composite actions and adding support for uv-managed modules, selected automatically per module.

Changes:

  • Added local composite actions to test modules with Poetry and with uv.
  • Updated build-modules.yml to detect the package manager per module and invoke the corresponding action.
  • Minor workflow formatting/cleanup (e.g., normalized YAML spacing/indentation).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/build-modules.yml Detects per-module package manager (uv vs Poetry) and routes testing to the corresponding composite action.
.github/actions/test-with-uv/action.yaml New composite action encapsulating uv-based dependency sync, linting, type-checking, and tests.
.github/actions/test-with-poetry/action.yaml New composite action encapsulating Poetry-based dependency install, linting, type-checking, and tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants