Skip to content

Update CI workflow for Rust and Python builds#69

Draft
manoelhc wants to merge 23 commits intomainfrom
manoelhc-patch-4
Draft

Update CI workflow for Rust and Python builds#69
manoelhc wants to merge 23 commits intomainfrom
manoelhc-patch-4

Conversation

@manoelhc
Copy link
Copy Markdown
Owner

@manoelhc manoelhc commented Feb 21, 2026

Summary by Sourcery

Update CI workflows to run Rust and Python builds on the rpi runner and to separate behaviour for draft/manual pull requests.

CI:

  • Run the Rust build-and-test job on the rpi runner instead of ubuntu-latest.
  • Gate the main Python build-and-test matrix so it only runs for non-draft, non-manual pull requests.
  • Add a separate draft/manual build job that runs combined Rust and Python build and smoke tests on the rpi runner across multiple Python versions.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Feb 21, 2026

Reviewer's Guide

CI workflow now targets an rpi runner for Rust builds and splits Python jobs so that full Python build-and-test runs only on non-draft, non-manual PRs, while a new build-only matrix job (including Rust+maturin build and import/tests) runs for draft or manually-triggered PRs on rpi.

Flow diagram for CI job selection based on PR state

flowchart TD
  Start["pull_request event"] --> CheckManual

  CheckManual{manual_workflow == true?} -->|yes| RunBuildDraftManual
  CheckManual -->|no| CheckDraft

  CheckDraft{draft == true?} -->|yes| RunBuildDraftDraft
  CheckDraft -->|no| RunPythonBuildAndTest

  RunBuildDraftManual["Run build_draft job\n(Rust+Python build matrix on rpi)"] --> End
  RunBuildDraftDraft["Run build_draft job\n(Rust+Python build matrix on rpi)"] --> End

  RunPythonBuildAndTest["Run python_build_and_test job\n(full Python build and test on matrix.os)"] --> End

  subgraph Always_Runs
    RustJob["rust_build_and_test job\n(on rpi)"]
  end

  Start --> RustJob

  End["workflow jobs complete"]
Loading

File-Level Changes

Change Details Files
Run Rust build-and-test job on an rpi runner instead of the default ubuntu-latest environment.
  • Update the Rust job runner from ubuntu-latest to rpi to align with Raspberry Pi-like environment constraints
.github/workflows/ci.yml
Gate the main Python build-and-test matrix job to only run on non-draft PRs that are not using the manual workflow flag.
  • Add an if condition to the python-build-and-test job checking github.event.pull_request.manual_workflow == false and github.event.pull_request.draft == false
.github/workflows/ci.yml
Introduce a separate build-focused CI job for draft or manual-workflow PRs that builds and lightly tests the Rust-backed Python package on rpi across multiple Python versions.
  • Add build-draft job conditioned on github.event.pull_request.manual_workflow == true or github.event.pull_request.draft == true
  • Configure build-draft to run on an rpi runner with a Python version matrix (3.9–3.14)
  • Set up Python and Rust toolchains and cache Cargo dependencies in build-draft
  • Build the Python wheel via maturin, install the built wheel using a version-derived tag, and verify import of the rupy package
  • Optionally run pytest if a tests directory exists, with continue-on-error enabled to avoid failing CI when tests are missing or flaky
.github/workflows/ci.yml

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 21, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ca5095aa-f017-45c1-a963-c02ace3578dc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'ignore'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • 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
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch manoelhc-patch-4

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

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 21, 2026
@deepsource-io
Copy link
Copy Markdown

deepsource-io bot commented Feb 21, 2026

DeepSource Code Review

We reviewed changes in a6336a2...9d797ae on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Python Mar 12, 2026 11:31a.m. Review ↗
Rust Mar 12, 2026 11:31a.m. Review ↗

Copy link
Copy Markdown

@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 found 2 issues, and left some high level feedback:

  • The job if conditions reference github.event.pull_request.manual_workflow, which is not a standard field on the pull_request event; if you need to distinguish manual vs normal runs, consider using workflow_dispatch inputs or github.event_name instead.
  • Since draft already indicates draft PRs on pull_request events, you may not need a separate build-draft job; instead, consider simplifying by using a single Python job with an if: !github.event.pull_request.draft (or similar) condition or by sharing steps between the two jobs to avoid duplication.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The job `if` conditions reference `github.event.pull_request.manual_workflow`, which is not a standard field on the pull_request event; if you need to distinguish manual vs normal runs, consider using `workflow_dispatch` inputs or `github.event_name` instead.
- Since `draft` already indicates draft PRs on pull_request events, you may not need a separate `build-draft` job; instead, consider simplifying by using a single Python job with an `if: !github.event.pull_request.draft` (or similar) condition or by sharing steps between the two jobs to avoid duplication.

## Individual Comments

### Comment 1
<location> `.github/workflows/ci.yml:51` </location>
<code_context>
         run: cargo test --release

   python-build-and-test:
+    if: github.event.pull_request.manual_workflow == false && github.event.pull_request.draft == false
     name: Python Build and Test
     runs-on: ${{ matrix.os }}
</code_context>

<issue_to_address>
**issue (bug_risk):** Accessing `github.event.pull_request.manual_workflow` is likely invalid and may break non-PR triggers.

`pull_request` events don’t expose a `manual_workflow` field, so this condition will always be false on PRs and may throw `Cannot index into a null value` on non-PR events where `github.event.pull_request` is null (e.g. `push`, `workflow_dispatch`). If you need a manual flag, use `workflow_dispatch` inputs or labels, and guard PR-only fields with something like:

```yaml
if: github.event_name == 'pull_request' && !github.event.pull_request.draft
```
</issue_to_address>

### Comment 2
<location> `.github/workflows/ci.yml:112-113` </location>
<code_context>
           fi
         shell: bash
         continue-on-error: true
+  build-draft:
+    if: github.event.pull_request.manual_workflow == true || github.event.pull_request.draft == true
+    runs-on: ${{ matrix.os }}
+    strategy:
</code_context>

<issue_to_address>
**issue (bug_risk):** The `build-draft` condition has the same `manual_workflow` / null pull_request access problem as the main Python job.

This reuses the unguarded access to `github.event.pull_request.manual_workflow` / `.draft`. On non-PR events, `github.event.pull_request` is `null`, so this condition can fail evaluation, and `manual_workflow` is not part of the standard PR payload. Consider restricting this to PR events, e.g.

```yaml
if: github.event_name == 'pull_request' && github.event.pull_request.draft == true
```

and handle any "manual workflow" behavior via a separate mechanism (such as `workflow_dispatch` inputs or labels).
</issue_to_address>

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.

@manoelhc manoelhc marked this pull request as draft February 21, 2026 09:47
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 21, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 21, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 21, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 21, 2026
Updated CI workflow to run on Raspberry Pi and simplified Python setup.
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 21, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 21, 2026
Specify pip version for Python setup
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 21, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 24, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 6, 2026
Added a new job for installing dependencies before other jobs.
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 6, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 6, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 6, 2026
Remove pyenv directory before setting up Python in CI workflows.
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 6, 2026
@manoelhc
Copy link
Copy Markdown
Owner Author

manoelhc commented Mar 6, 2026

@copilot Run cargo clippy, fix all the issues and then run cargo fmt.

Removed redundant pyenv cleanup commands from CI workflow.
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 6, 2026
Refactor pyenv setup to ensure proper installation and path configuration.
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 6, 2026
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 10, 2026
Removed redundant PYENV_ROOT and PATH exports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants