◐ Shell
reader mode source ↗
Skip to content

Use matrix for cargo check#7388

Merged
youknowone merged 4 commits into
RustPython:mainfrom
ShaharNaveh:ci-matrix-cargo-check
Mar 11, 2026
Merged

Use matrix for cargo check#7388
youknowone merged 4 commits into
RustPython:mainfrom
ShaharNaveh:ci-matrix-cargo-check

Conversation

@ShaharNaveh

@ShaharNaveh ShaharNaveh commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Chores
    • Reduced Linux install footprint by using non-recommending package installs to avoid extra packages.
    • Added additional ARM64 cross-compilation runtime/dev packages when cross-targeting AArch64.
    • Consolidated CI into a matrix-driven compilation check across platforms, centralizing tool/setup steps and per-target build checks to remove duplication.

@coderabbitai

coderabbitai Bot commented Mar 9, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Replaced per-target CI steps with a matrix-driven cargo_check workflow and updated the Linux dependency installer action to run apt-get install with --no-install-recommends and add arm64 cross-tool packages when the gcc-aarch64-linux-gnu input is enabled.

Changes

Cohort / File(s) Summary
Linux Dependencies Action
​.github/actions/install-linux-deps/action.yml
apt-get install now uses --no-install-recommends; when gcc-aarch64-linux-gnu input is true, adds linux-libc-dev-arm64-cross and libc6-dev-arm64-cross to packages.
CI Workflow Restructuring
​.github/workflows/ci.yaml
Replaced many per-target prepare/check steps with a matrix-driven cargo_check job; unified checkout, toolchain setup, cache usage, conditional Android NDK setup, centralized Linux deps install, and a loop that runs cargo check per matrix target.

Sequence Diagram(s)

sequenceDiagram
    participant Runner as GitHub Runner
    participant Action as install-linux-deps Action
    participant Apt as apt-get
    participant Toolchain as rustup / toolchain
    participant Cache as action/cache
    participant NDK as Android NDK (conditional)
    participant Cargo as cargo check

    Runner->>Action: invoke with inputs (e.g., gcc-aarch64-linux-gnu)
    Action->>Apt: apt-get install --no-install-recommends (add arm64 cross pkgs if input=true)
    Runner->>Toolchain: setup Rust toolchain and add targets
    Runner->>Cache: restore/save cargo cache
    alt Android target present
        Runner->>NDK: setup Android NDK
    end
    Runner->>Cargo: loop over matrix targets -> cargo check (per-target env)
    Cargo-->>Runner: return check results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • youknowone

Poem

"🐰 I hopped through YAML, trimmed installs light,

Packed arm64 tools for a cross-compile night.
One matrix to check them, targets all in a row,
I nibbled the excess and watched the checks go. 🥕"

🚥 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 'Use matrix for cargo check' directly and clearly summarizes the main change: refactoring the CI workflow to use a matrix-driven approach for cargo check instead of discrete per-target invocations.
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

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 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.

Hide comment

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yaml:
- Around line 197-229: The Install dependencies step uses a scalar expression
for with: (with: ${{ matrix.dependencies || fromJSON('{}') }}) which violates
GitHub Actions schema; change the with: to an explicit mapping of the action
inputs (the boolean flags) instead of a single scalar. Update the step that uses
./.github/actions/install-linux-deps so its with: lists each dependency key as a
mapping entry (e.g., gcc-multilib, musl-tools, gcc-aarch64-linux-gnu) and set
each value to a safe expression that reads the matrix entry with a default
(e.g., ${{ matrix.dependencies.gcc-multilib || false }}), ensuring every
possible dependency key in the matrix is represented as a boolean input.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 81db98f2-101c-44e3-9ba0-013dbad11b83

📥 Commits

Reviewing files that changed from the base of the PR and between 82e9b5d and 7501452.

📒 Files selected for processing (2)
  • .github/actions/install-linux-deps/action.yml
  • .github/workflows/ci.yaml

@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.

Hide comment
♻️ Duplicate comments (1)
.github/workflows/ci.yaml (1)

227-229: ⚠️ Potential issue | 🔴 Critical

Fix the Install dependencies step shape and scope.

Line 229 is invalid GitHub Actions syntax: with: must be a mapping, so this job will not pass workflow validation. Even after that is fixed, this step still runs for the macos-latest row even though it invokes the Linux-only install-linux-deps action.

One working shape
       matrix:
         include:
         - os: ubuntu-latest
           targets:
             - aarch64-linux-android
             - i686-unknown-linux-gnu
             - i686-unknown-linux-musl
             - wasm32-wasip2
             - x86_64-unknown-freebsd
-          dependencies:
-            gcc-multilib: true
-            musl-tools: true
+          gcc_multilib: true
+          musl_tools: true
         - os: ubuntu-latest
           targets:
             - aarch64-unknown-linux-gnu
-          dependencies:
-            gcc-aarch64-linux-gnu: true # conflict with `gcc-multilib`
+          gcc_aarch64_linux_gnu: true # conflict with `gcc-multilib`
         - os: macos-latest
           targets:
             - aarch64-apple-ios
             - x86_64-apple-darwin
...
       - name: Install dependencies
+        if: runner.os == 'Linux'
         uses: ./.github/actions/install-linux-deps
-        with: ${{ matrix.dependencies || fromJSON('{}') }}
+        with:
+          gcc-multilib: ${{ matrix.gcc_multilib || false }}
+          musl-tools: ${{ matrix.musl_tools || false }}
+          clang: ${{ matrix.clang || false }}
+          gcc-aarch64-linux-gnu: ${{ matrix.gcc_aarch64_linux_gnu || false }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yaml around lines 227 - 229, The "Install dependencies"
step uses invalid YAML for the with: field and also unconditionally invokes the
Linux-only action ./.github/actions/install-linux-deps for non-Linux matrix
rows; change the step to provide a proper mapping for the inputs (e.g., a key
like dependencies mapped to the expression using matrix.dependencies) and add a
conditional that restricts the step to Linux matrix entries (use matrix.os in
the if: expression) so the step only runs for Linux jobs and the with: block is
valid.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/ci.yaml:
- Around line 227-229: The "Install dependencies" step uses invalid YAML for the
with: field and also unconditionally invokes the Linux-only action
./.github/actions/install-linux-deps for non-Linux matrix rows; change the step
to provide a proper mapping for the inputs (e.g., a key like dependencies mapped
to the expression using matrix.dependencies) and add a conditional that
restricts the step to Linux matrix entries (use matrix.os in the if: expression)
so the step only runs for Linux jobs and the with: block is valid.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 68bac21c-80f5-4e72-a059-13705ac74f77

📥 Commits

Reviewing files that changed from the base of the PR and between 7501452 and 3eaa342.

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

@ShaharNaveh ShaharNaveh requested a review from youknowone March 10, 2026 08:22

@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.

Hide comment
♻️ Duplicate comments (1)
.github/workflows/ci.yaml (1)

227-229: ⚠️ Potential issue | 🔴 Critical

Schema violation: with: requires a mapping, not a scalar expression.

The syntax with: ${{ matrix.dependencies || fromJSON('{}') }} is invalid. GitHub Actions expects with: to contain an explicit mapping of input names to values. Additionally, this step will run on macOS where install-linux-deps is not applicable.

The fix proposed in the previous review remains valid—flatten the dependency flags to top-level matrix properties and bind them explicitly with an OS condition.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yaml around lines 227 - 229, The CI step "Install
dependencies" uses an invalid scalar for with: and is not guarded by OS; change
the step to pass a mapping (e.g. with: dependencies: ${{ matrix.dependencies }}
) and add an OS guard (if: runner.os == 'Linux') so the local action
./.github/actions/install-linux-deps only runs on Linux; also ensure your matrix
defines the top-level property matrix.dependencies (use fromJSON default when
building the matrix if needed) so the referenced matrix key exists.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/ci.yaml:
- Around line 227-229: The CI step "Install dependencies" uses an invalid scalar
for with: and is not guarded by OS; change the step to pass a mapping (e.g.
with: dependencies: ${{ matrix.dependencies }} ) and add an OS guard (if:
runner.os == 'Linux') so the local action ./.github/actions/install-linux-deps
only runs on Linux; also ensure your matrix defines the top-level property
matrix.dependencies (use fromJSON default when building the matrix if needed) so
the referenced matrix key exists.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 2aaff4f0-652d-4034-a957-2a97a27a6ca8

📥 Commits

Reviewing files that changed from the base of the PR and between 3eaa342 and a713e06.

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

Hide details View details @youknowone youknowone merged commit 7e47270 into RustPython:main Mar 11, 2026
27 of 28 checks passed
youknowone pushed a commit to youknowone/RustPython that referenced this pull request Mar 19, 2026
* Use matrix for cargo_check

* Tweak `gcc-aarch64-linux-gnu` deps

* Re-add redox comment
youknowone pushed a commit to youknowone/RustPython that referenced this pull request Mar 22, 2026
* Use matrix for cargo_check

* Tweak `gcc-aarch64-linux-gnu` deps

* Re-add redox comment
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.

2 participants