Skip to content

Cleanup ci.yaml matrix usage#7260

Open
ShaharNaveh wants to merge 3 commits intoRustPython:mainfrom
ShaharNaveh:CLN-ci-matrix
Open

Cleanup ci.yaml matrix usage#7260
ShaharNaveh wants to merge 3 commits intoRustPython:mainfrom
ShaharNaveh:CLN-ci-matrix

Conversation

@ShaharNaveh
Copy link
Contributor

@ShaharNaveh ShaharNaveh commented Feb 28, 2026

Summary by CodeRabbit

  • Chores

    • Restructured CI to a matrix-driven configuration with per-OS entries, explicit timeouts, and clearer job definitions.
    • Streamlined job steps and messaging to use matrix values for args, skips, and env checks.
  • Tests

    • Consolidated platform-independent and platform-dependent test execution into matrix-guided steps, replacing multiple OS-specific branches and hard-coded skip lists.
    • Added per-entry handling for env-polluting tests and timeout overrides.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 28, 2026

📝 Walkthrough

Walkthrough

Refactors .github/workflows/ci.yaml to replace OS-specific skip/env variables with a matrix-driven job matrix (per-entry os, skips, PLATFORM_INDEPENDENT_TESTS, env_polluting_tests, timeout) and consolidates test and env-polluter steps into matrix-aware executions.

Changes

Cohort / File(s) Summary
CI workflow (matrix-driven)
.github/workflows/ci.yaml
Converted OS-specific skip/env branches into a matrix.include configuration providing per-entry skips, PLATFORM_INDEPENDENT_TESTS, env_polluting_tests, and timeout; unified platform-independent and platform-dependent test steps to use matrix.* values; removed WINDOWS_SKIPS and global ENV_POLLUTING_* variables; consolidated messaging and timeouts.

Sequence Diagram(s)

sequenceDiagram
    rect rgba(200,230,255,0.5)
    participant GH as GitHub Actions
    participant Matrix as Job Matrix
    participant Runner as OS Runner
    participant Shell as Job Steps
    end
    GH->>Matrix: expand matrix.include (os, skips, PLATFORM_INDEPENDENT_TESTS, env_polluting_tests, timeout)
    Matrix->>Runner: select runner for entry (linux/macos/windows)
    Runner->>Shell: execute unified job steps with matrix.* args
    Shell->>Shell: run platform-independent tests (matrix.PLATFORM_INDEPENDENT_TESTS)
    Shell->>Shell: run platform-dependent tests excluding matrix.skips
    Shell->>Shell: run env-polluter checks using matrix.env_polluting_tests
    Shell-->>Runner: return results
    Runner-->>GH: report completion
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • youknowone

Poem

🐇 I hopped through YAML, tidy and spry,

Matrix paths set under one sky,
Tests now march in tidy rows,
No more scattered OS-posed woes,
A happy thump — CI's reply!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Cleanup ci.yaml matrix usage' clearly and specifically identifies the main change: refactoring GitHub Actions CI workflow to improve matrix definition and usage patterns.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

@ShaharNaveh ShaharNaveh marked this pull request as ready for review February 28, 2026 12:52
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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/ci.yaml (1)

343-367: ⚠️ Potential issue | 🟠 Major

ENV_POLLUTING_TESTS_COMMON is referenced but not defined.

Line 346 references ${{ env.ENV_POLLUTING_TESTS_COMMON }}, but this environment variable is not defined anywhere in the file. Combined with matrix.job.env_polluting_tests being set to "" for all matrix entries, the for-loop body will never execute, making this step a silent no-op.

If there are currently no environment-polluting tests to check, consider either:

  1. Defining ENV_POLLUTING_TESTS_COMMON in the env: section (even if empty, for clarity), or
  2. Removing this step entirely if it's no longer needed, or
  3. Adding a comment explaining that this step is intentionally dormant pending future polluting tests.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yaml around lines 343 - 367, The workflow step's
for-loop references ENV_POLLUTING_TESTS_COMMON and
matrix.job.env_polluting_tests but ENV_POLLUTING_TESTS_COMMON is not defined, so
the loop will be a no-op; fix by defining ENV_POLLUTING_TESTS_COMMON in the
workflow's env: block (even as an empty string) or remove/comment out this step
if it's no longer needed — locate the references to ENV_POLLUTING_TESTS_COMMON
and matrix.job.env_polluting_tests in the CI step that runs rustpython (the for
thing in ... loop) and either add an env: ENV_POLLUTING_TESTS_COMMON: "" entry
at the top-level env or delete/add a clear comment explaining the step is
intentionally dormant.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.github/workflows/ci.yaml:
- Around line 343-367: The workflow step's for-loop references
ENV_POLLUTING_TESTS_COMMON and matrix.job.env_polluting_tests but
ENV_POLLUTING_TESTS_COMMON is not defined, so the loop will be a no-op; fix by
defining ENV_POLLUTING_TESTS_COMMON in the workflow's env: block (even as an
empty string) or remove/comment out this step if it's no longer needed — locate
the references to ENV_POLLUTING_TESTS_COMMON and matrix.job.env_polluting_tests
in the CI step that runs rustpython (the for thing in ... loop) and either add
an env: ENV_POLLUTING_TESTS_COMMON: "" entry at the top-level env or delete/add
a clear comment explaining the step is intentionally dormant.

ℹ️ Review info

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c726e1 and e333638.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml

@ShaharNaveh ShaharNaveh marked this pull request as draft March 15, 2026 12:22
@ShaharNaveh ShaharNaveh marked this pull request as ready for review March 15, 2026 14:30
@ShaharNaveh ShaharNaveh requested a review from youknowone March 15, 2026 14:30
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
.github/workflows/ci.yaml (2)

300-303: Use matrix args here too to avoid drift.

Line 303 hardcodes -u all, while Line 310 already pulls from matrix.extra_test_args. Reusing matrix input here keeps a single source of truth.

♻️ Proposed change
-          target/release/rustpython -m test -j 1 -u all --slowest --fail-env-changed --timeout 600 -v ${{ env.PLATFORM_INDEPENDENT_TESTS }}
+          target/release/rustpython -m test -j 1 ${{ join(matrix.extra_test_args, ' ') }} --slowest --fail-env-changed --timeout 600 -v ${{ env.PLATFORM_INDEPENDENT_TESTS }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yaml around lines 300 - 303, The workflow step "run
cpython platform-independent tests" uses a hardcoded "-u all" in the test
command; replace that hardcoded arg with the matrix variable already used
elsewhere (matrix.extra_test_args or env.PLATFORM_INDEPENDENT_TESTS) so the step
consumes the same single source of truth as the other test step—update the run
string that invokes "target/release/rustpython -m test ..." to include the
matrix.extra_test_args (or the existing PLATFORM_INDEPENDENT_TESTS env var)
instead of "-u all" and ensure the job matrix defines extra_test_args
consistently.

315-332: Skip env-polluter verification step when list is empty.

With current matrix values, this step is a no-op on every OS. Adding a step-level guard makes intent clearer and trims unnecessary CI work.

🧹 Proposed guard
       - name: run cpython tests to check if env polluters have stopped polluting
+        if: ${{ join(matrix.env_polluting_tests, '') != '' }}
         shell: bash
         run: |
           for thing in ${{ join(matrix.env_polluting_tests, ' ') }}; do
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yaml around lines 315 - 332, The CI step named "run
cpython tests to check if env polluters have stopped polluting" currently runs
even when matrix.env_polluting_tests is empty; add a step-level guard so the
step only runs when matrix.env_polluting_tests is non-empty (i.e., check
matrix.env_polluting_tests before executing the for-loop), thereby skipping the
whole step when there are no env polluters to verify.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/ci.yaml:
- Around line 300-303: The workflow step "run cpython platform-independent
tests" uses a hardcoded "-u all" in the test command; replace that hardcoded arg
with the matrix variable already used elsewhere (matrix.extra_test_args or
env.PLATFORM_INDEPENDENT_TESTS) so the step consumes the same single source of
truth as the other test step—update the run string that invokes
"target/release/rustpython -m test ..." to include the matrix.extra_test_args
(or the existing PLATFORM_INDEPENDENT_TESTS env var) instead of "-u all" and
ensure the job matrix defines extra_test_args consistently.
- Around line 315-332: The CI step named "run cpython tests to check if env
polluters have stopped polluting" currently runs even when
matrix.env_polluting_tests is empty; add a step-level guard so the step only
runs when matrix.env_polluting_tests is non-empty (i.e., check
matrix.env_polluting_tests before executing the for-loop), thereby skipping the
whole step when there are no env polluters to verify.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 934455a1-3965-4330-80dd-d4bd5b07da9a

📥 Commits

Reviewing files that changed from the base of the PR and between 36fed7d and b667837.

📒 Files selected for processing (1)
  • .github/workflows/ci.yaml

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.

1 participant