Skip to content

Improve Depthai Python CI/CD workflow - #1894

Merged
aljazdu merged 4 commits into
developfrom
update/python_CICD_workflow
Jul 24, 2026
Merged

Improve Depthai Python CI/CD workflow#1894
aljazdu merged 4 commits into
developfrom
update/python_CICD_workflow

Conversation

@aljazdu

@aljazdu aljazdu commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Purpose

  • Fix the "spamming" of multiple workflows containing only precheck, by triggering the PR workflow run only on testable labels.
  • In case of workflows triggered by PRs, build only Python3.14 in order to speed up the PR check, while keeping a check that everything builds as it should. Full python set is still built for non-PR builds.
  • Speed up the python CI/CD workflow by running the legacy macOS intel builds only when building:
  • main
  • release branches
  • v* tags
  • develop

Specification

Updating the python-main.yml workflow file with additional conditions.

Dependencies & Potential Impact

None / not applicable

Deployment Plan

None / not applicable

Testing & Validation

This was tested by manually running the affected workflow with different conditions.

AI Usage

Assisted-by: AGENT_NAME: Chat gpt

Submitted code was reviewed by a human: YES

The author is taking the responsibility for the contribution: YES

Summary by CodeRabbit

Summary by CodeRabbit

  • Chores

    • Updated CI wheel build behavior to use centralized configuration and dynamically adjust macOS runner coverage based on branch/ref patterns.
    • Standardized wheel Python version/set matrix generation across Windows, macOS, and Linux build jobs.
    • For pull requests, restricted wheel configuration to CPython 3.14 and gated execution based on the presence of a testable label.
  • Tests

    • Updated combined wheel smoke tests to use newer Python artifacts (Linux x86_64/ARM64 from cp310 to cp314, and Windows from 3.12 to 3.14).

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The workflow computes ref-dependent wheel matrices in precheck, shares them with Windows, macOS, and Linux jobs, and updates combined-wheel smoke tests to Python 3.14. Pull request label triggering is limited to labeled and synchronize.

Changes

Wheel workflow configuration

Layer / File(s) Summary
Precheck wheel configuration
.github/workflows/python-main.yml
precheck publishes Python versions, Python sets, and macOS runners based on the Git ref while retaining the testable label condition for pull requests.
Build and combination matrix wiring
.github/workflows/python-main.yml
Windows, macOS, and Linux wheel jobs consume the dynamic outputs; the Windows job exposes the MSYS2 gfortran path, and macOS combination uses the selected runners.
Combined-wheel smoke tests
.github/workflows/python-main.yml
Linux x86_64, Linux ARM64, and Windows smoke tests use Python 3.14 interpreters.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest
  participant precheck
  participant WheelBuildJobs
  participant CombinedWheelSmokeTests
  PullRequest->>precheck: Provide event, ref, and labels
  precheck->>WheelBuildJobs: Publish Python and runner matrices
  WheelBuildJobs->>CombinedWheelSmokeTests: Build and combine wheels
  CombinedWheelSmokeTests->>CombinedWheelSmokeTests: Select Python 3.14 interpreters
Loading

Possibly related PRs

Suggested reviewers: matictonin, moratom

Poem

A rabbit saw the wheel jobs dance,
With Python fourteen leading the prance.
Runners follow refs in flight,
Labels guide the workflow right,
And every build hops clean and bright.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is related to the PR and correctly indicates a CI/CD workflow change, though it is broader than the specific wheel-build and label-gating updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update/python_CICD_workflow

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.

@aljazdu aljazdu self-assigned this Jul 13, 2026
@aljazdu
aljazdu requested a review from aljazkonec1 July 13, 2026 08:59
@aljazdu
aljazdu marked this pull request as ready for review July 13, 2026 08:59
@aljazdu
aljazdu marked this pull request as draft July 13, 2026 09:00
@aljazdu
aljazdu marked this pull request as ready for review July 13, 2026 09:01
@aljazdu
aljazdu force-pushed the update/python_CICD_workflow branch from 1ff1116 to d0bd6d5 Compare July 22, 2026 08:08

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/python-main.yml:
- Line 21: Update the pull request event configuration in the workflow trigger
to include synchronize alongside the required pull request lifecycle events,
ensuring new commits on already-testable PRs start CI. Preserve the existing
precheck logic so it decides whether a run should be skipped.
- Around line 63-74: Gate every root work-producing wheel job on the `precheck`
job’s `should_run` output by adding the condition
`needs.precheck.outputs.should_run == 'true'` to each job’s `if`. Ensure the
existing `testable` label decision from the precheck step is enforced before any
downstream wheel work runs.
- Around line 411-414: Update the workflow steps using actions/checkout and
actions/setup-python to reference immutable, specific commit SHAs instead of the
mutable v3 and v4 major tags, preserving their existing behavior and
configuration.
- Around line 456-459: Update the container image in the workflow’s manylinux
build configuration to reference the same manylinux_2_28_x86_64 image by its
immutable `@sha256` digest instead of the mutable 2025.11.10-2 tag, while
preserving the existing PLAT environment value.
- Around line 43-45: Update the workflow step’s shell setup to pass github.ref
through the step-level env configuration, then read the environment variable
inside the run block instead of interpolating the GitHub expression into Bash.
Apply the same safe pattern to the existing GITHUB_REF assignment while
preserving the current variable names and behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 09ed2042-2073-4441-939d-9ccb73a717ea

📥 Commits

Reviewing files that changed from the base of the PR and between 1ff1116 and d0bd6d5.

📒 Files selected for processing (1)
  • .github/workflows/python-main.yml
📜 Review details
🧰 Additional context used
🪛 actionlint (1.7.12)
.github/workflows/python-main.yml

[error] 411-411: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


[error] 412-412: the runner of "actions/setup-python@v4" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 zizmor (1.26.1)
.github/workflows/python-main.yml

[warning] 44-44: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)


[error] 45-45: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)


[warning] 411-411: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 411-411: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 412-412: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 457-457: unpinned image references (unpinned-images): container image is not pinned to a SHA256 hash

(unpinned-images)

Comment thread .github/workflows/python-main.yml
Comment thread .github/workflows/python-main.yml Outdated
Comment thread .github/workflows/python-main.yml
Comment thread .github/workflows/python-main.yml
Comment thread .github/workflows/python-main.yml
@aljazdu aljazdu changed the title Macos Intel will only be build for relases, main branch run Improve Depthai Python CI/CD workflow Jul 22, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/python-main.yml (1)

69-70: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Require an exact testable label match.

grep -q "testable" also matches labels such as not-testable or testable-preview, so non-testable PRs can still launch the full wheel matrix. Use an exact match.

Proposed fix
-          if ! echo "$LABELS" | jq -r '.[].name' | grep -q "testable"; then
+          if ! echo "$LABELS" | jq -r '.[].name' | grep -Fxq "testable"; then
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/python-main.yml around lines 69 - 70, Update the label
check in the workflow’s SHOULD_RUN decision so it matches only a label whose
complete name is exactly “testable”; use an exact-line match rather than
substring matching, while preserving the existing false assignment for PRs
without that label.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/python-main.yml:
- Around line 69-70: Update the label check in the workflow’s SHOULD_RUN
decision so it matches only a label whose complete name is exactly “testable”;
use an exact-line match rather than substring matching, while preserving the
existing false assignment for PRs without that label.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: cd3411e6-fed4-48f3-a970-5c192a790f97

📥 Commits

Reviewing files that changed from the base of the PR and between d0bd6d5 and b705f17.

📒 Files selected for processing (1)
  • .github/workflows/python-main.yml
📜 Review details
🔇 Additional comments (1)
.github/workflows/python-main.yml (1)

21-21: LGTM!

Also applies to: 37-48, 58-68, 74-77, 240-244, 331-335, 412-412, 460-468, 567-567, 586-595, 697-697, 727-727

@aljazdu
aljazdu force-pushed the update/python_CICD_workflow branch from b705f17 to c0ddf24 Compare July 22, 2026 08:55

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/python-main.yml (1)

69-71: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Require an exact testable label match.

grep -q "testable" also matches labels such as not-testable or testable-preview, allowing workflows to run without the required exact label.

Proposed fix
-          if ! echo "$LABELS" | jq -r '.[].name' | grep -q "testable"; then
+          if ! echo "$LABELS" | jq -r '.[].name' | grep -Fxq "testable"; then
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/python-main.yml around lines 69 - 71, Update the label
check in the workflow’s SHOULD_RUN decision to match the complete label value
exactly as “testable,” preventing partial matches such as “not-testable” or
“testable-preview.”
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/python-main.yml:
- Around line 62-64: Update the branch/tag condition controlling
WHEEL_MACOS_RUNNERS so refs/heads/develop is excluded, while retaining Intel
macOS runners for refs/heads/main, release branches, and v* tags.

---

Outside diff comments:
In @.github/workflows/python-main.yml:
- Around line 69-71: Update the label check in the workflow’s SHOULD_RUN
decision to match the complete label value exactly as “testable,” preventing
partial matches such as “not-testable” or “testable-preview.”
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: bb3876f2-b030-4346-97fb-8f4e964299f2

📥 Commits

Reviewing files that changed from the base of the PR and between b705f17 and b0e2878.

📒 Files selected for processing (1)
  • .github/workflows/python-main.yml
📜 Review details
🔇 Additional comments (1)
.github/workflows/python-main.yml (1)

21-21: LGTM!

Also applies to: 33-48, 57-60, 66-68, 74-77, 239-243, 329-333, 407-413, 417-417, 465-465, 564-564, 582-582, 591-591, 693-693, 723-723

Comment thread .github/workflows/python-main.yml
@aljazkonec1 aljazkonec1 added the testable PR is ready to be tested - run vanilla tests label Jul 23, 2026

@aljazkonec1 aljazkonec1 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks! Lets just let workflow pass to see how it looks

@aljazdu aljazdu added testable PR is ready to be tested - run vanilla tests and removed testable PR is ready to be tested - run vanilla tests labels Jul 23, 2026

@coderabbitai coderabbitai Bot left a comment

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/python-main.yml (1)

69-71: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Match the testable label exactly.

grep -q "testable" also matches labels such as not-testable or testable-v2, causing wheel CI to run without the exact required label. Use an exact-match check such as grep -Fxq "testable".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/python-main.yml around lines 69 - 71, Update the
testable-label check in the SHOULD_RUN workflow condition to use exact line
matching, such as grep -Fxq, so only the label exactly equal to “testable”
qualifies; preserve the existing behavior for all other labels.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/python-main.yml:
- Around line 69-71: Update the testable-label check in the SHOULD_RUN workflow
condition to use exact line matching, such as grep -Fxq, so only the label
exactly equal to “testable” qualifies; preserve the existing behavior for all
other labels.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5e9a409e-f8e0-4774-bf64-bf5d8e46df12

📥 Commits

Reviewing files that changed from the base of the PR and between b0e2878 and dc54202.

📒 Files selected for processing (1)
  • .github/workflows/python-main.yml
📜 Review details
🔇 Additional comments (5)
.github/workflows/python-main.yml (5)

21-21: 🎯 Functional Correctness

Keep synchronize in the pull-request trigger.

The supplied line is types: [labeled]; unless synchronize is declared elsewhere in this trigger, commits pushed to an already-testable PR will not rerun CI. This repeats the prior review finding—ensure the list remains [labeled, synchronize].


62-64: 🚀 Performance & Scalability

Exclude develop from legacy Intel macOS builds.

This condition still enables macos-15-intel for every refs/heads/develop run, contrary to the stated objective that Intel builds run only for main, release branches, and v* tags. This repeats the prior review finding.


239-243: 🎯 Functional Correctness

Gate root wheel jobs on should_run.

precheck publishes should_run=false, but these root wheel jobs have no job-level condition consuming it. A pull request without the exact testable label can therefore still build wheels. Add if: needs.precheck.outputs.should_run == 'true' to the Windows, macOS, Linux x86_64, and Linux ARM64 build jobs; downstream combination jobs will then be skipped through their dependencies. This repeats the prior review finding.

Proposed fix
   build-windows-x86_64:
     needs: [precheck, build-docstrings]
+    if: needs.precheck.outputs.should_run == 'true'

   build-macos:
     needs: [precheck, build-docstrings]
+    if: needs.precheck.outputs.should_run == 'true'

   build-linux-x86_64:
     needs: [precheck, build-docstrings]
+    if: needs.precheck.outputs.should_run == 'true'

   build-linux-arm64:
     needs: [precheck, build-docstrings]
+    if: needs.precheck.outputs.should_run == 'true'

Also applies to: 331-335, 459-467, 584-593


37-48: LGTM!

Also applies to: 58-60, 66-68, 74-77


291-292: LGTM!

Also applies to: 409-419, 566-566, 695-695, 725-725

@aljazdu
aljazdu force-pushed the update/python_CICD_workflow branch from dc54202 to 66ee70a Compare July 23, 2026 17:54
@aljazdu aljazdu added testable PR is ready to be tested - run vanilla tests and removed testable PR is ready to be tested - run vanilla tests labels Jul 23, 2026
@aljazdu
aljazdu force-pushed the update/python_CICD_workflow branch from 66ee70a to 3355002 Compare July 23, 2026 19:07
@aljazdu aljazdu added testable PR is ready to be tested - run vanilla tests and removed testable PR is ready to be tested - run vanilla tests labels Jul 23, 2026
@aljazdu
aljazdu force-pushed the update/python_CICD_workflow branch from 3355002 to d6d9f3d Compare July 23, 2026 20:21
@aljazdu aljazdu added testable PR is ready to be tested - run vanilla tests and removed testable PR is ready to be tested - run vanilla tests labels Jul 23, 2026
@aljazdu
aljazdu merged commit bd2120c into develop Jul 24, 2026
32 of 51 checks passed
@aljazdu
aljazdu deleted the update/python_CICD_workflow branch July 24, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testable PR is ready to be tested - run vanilla tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants