ci: optimize Tauri CI build path#1436
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a Node script that detects Tauri-related dependency changes between two git refs by parsing package.json, package-lock.json, Cargo.toml, and Cargo.lock; the CI workflow exposes that boolean output and conditionally selects lightweight Rust-only builds or full Tauri CLI builds and related preparation steps based on the result. ChangesTauri Dependency Detection & CI Orchestration
Sequence Diagram(s)sequenceDiagram
participant Runner as GitHub Runner
participant Git as Git
participant Node as Node runtime
participant Script as check-tauri-deps-changed.ts
participant Workflow as GitHub Actions workflow
participant Cargo as Cargo / tauri-action
Runner->>Git: git show baseRef:file
Runner->>Git: git show HEAD:file
Runner->>Node: invoke Script
Node->>Script: parse package.json / package-lock.json / Cargo.toml / Cargo.lock
Script->>Node: emit changed=true/false
Node->>Workflow: set output tauri-deps-changed
Workflow->>Runner: conditional job selection based on tauri-deps-changed
alt tauri-deps-changed == true
Runner->>Cargo: run full tauri-action build & extra prep steps
else tauri-deps-changed != true
Runner->>Cargo: run lightweight Rust crate build only
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 4/5 reviews remaining, refill in 12 minutes. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/labeler.yml (1)
8-16: ⚡ Quick winKeep the split labels aligned with workspace-level Rust changes.
hardviz_coreandhardviz_taurino longer fire for rootCargo.*or.cargo/**updates, even though.github/workflows/ci.ymltreats those paths as both core- and tauri-affecting. That makes workspace-level Rust changes lose the new split labels.Suggested alignment
hardviz_core: - changed-files: - any-glob-to-any-file: - "core/**" + - "Cargo.*" + - ".cargo/**" hardviz_tauri: - changed-files: - any-glob-to-any-file: - "src-tauri/**" + - "Cargo.*" + - ".cargo/**"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/labeler.yml around lines 8 - 16, The hardviz_core and hardviz_tauri label rules currently only match core/** and src-tauri/** and therefore miss workspace-level Rust changes; update the labeler.yml entries for the hardviz_core and hardviz_tauri rules (the changed-files any-glob-to-any-file blocks) to also include workspace-level Rust paths such as "Cargo.*" and ".cargo/**" so that changes to root Cargo.toml/Cargo.lock and .cargo/ trigger the same split labels as core and tauri changes..github/scripts/check-tauri-deps-changed.ts (1)
160-165: Extend the detector to include rootCargo.tomlfor consistency with workflow filters.The workflow filters treat root
Cargo.*files as Tauri-relevant, but the dependency detector currently only checksCargo.lockandsrc-tauri/Cargo.toml. While rootCargo.tomldoes not yet contain Tauri dependencies, adding it now prevents future bugs if Tauri versions are declared via[workspace.dependencies]or[patch]sections.Suggested fix
const checks: [path: string, extract: Extractor][] = [ ["package.json", extractPackageJson], ["package-lock.json", extractPackageLock], + ["Cargo.toml", extractCargoToml], ["Cargo.lock", extractCargoLock], ["src-tauri/Cargo.toml", extractCargoToml], ];🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/scripts/check-tauri-deps-changed.ts around lines 160 - 165, The checks array currently lists only "Cargo.lock" and "src-tauri/Cargo.toml" for Rust manifests; add the root "Cargo.toml" entry to the const checks: [path: string, extract: Extractor][] so the detector also runs extractCargoToml against the workspace root file. Update the array to include ["Cargo.toml", extractCargoToml] alongside the existing entries (preserving the Extractor type and order) so root Cargo.toml changes are detected like the workflow filters expect.
🤖 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/labeler.yml:
- Around line 8-16: The hardviz_core and hardviz_tauri label rules currently
only match core/** and src-tauri/** and therefore miss workspace-level Rust
changes; update the labeler.yml entries for the hardviz_core and hardviz_tauri
rules (the changed-files any-glob-to-any-file blocks) to also include
workspace-level Rust paths such as "Cargo.*" and ".cargo/**" so that changes to
root Cargo.toml/Cargo.lock and .cargo/ trigger the same split labels as core and
tauri changes.
In @.github/scripts/check-tauri-deps-changed.ts:
- Around line 160-165: The checks array currently lists only "Cargo.lock" and
"src-tauri/Cargo.toml" for Rust manifests; add the root "Cargo.toml" entry to
the const checks: [path: string, extract: Extractor][] so the detector also runs
extractCargoToml against the workspace root file. Update the array to include
["Cargo.toml", extractCargoToml] alongside the existing entries (preserving the
Extractor type and order) so root Cargo.toml changes are detected like the
workflow filters expect.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
Run ID: f2e56967-35c2-484d-bdbe-e61ae7fd3b99
📒 Files selected for processing (6)
.github/actions/setup-rust/action.yml.github/dependabot.yml.github/labeler.yml.github/scripts/check-tauri-deps-changed.ts.github/scripts/generate-licenses.ts.github/workflows/ci.yml
💤 Files with no reviewable changes (1)
- .github/scripts/generate-licenses.ts
There was a problem hiding this comment.
Pull request overview
This PR optimizes the CI workflow for the Tauri (Rust) portion of the repo by adding more granular change detection and using a lighter-weight Rust crate build for “source-only” PRs, while preserving the heavier Tauri CLI build path when dependencies change.
Changes:
- Add a CI step/script to detect whether Tauri-related npm/Cargo dependencies changed, and use that signal to choose between a fast Rust-only build vs. the Tauri CLI build.
- Split Rust checks into separate jobs for formatting, core lint/tests, and Tauri lint/tests; add a core→tauri integration compile check for core-only PRs.
- Adjust supporting GitHub automation/config to align with workspace-at-root (Dependabot cargo directory, rust cache workspaces, cargo deny invocation, labeling).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/ci.yml |
Adds Tauri dependency-change detection and refactors Rust CI jobs + build strategy to reduce PR runtime. |
.github/scripts/generate-licenses.ts |
Runs cargo license/metadata from repo root instead of src-tauri/. |
.github/scripts/check-tauri-deps-changed.ts |
New script to detect changes in Tauri-related npm packages and Cargo crates/locks. |
.github/labeler.yml |
Splits Rust labeling into hardviz_core and hardviz_tauri. |
.github/dependabot.yml |
Moves cargo ecosystem scanning to / (workspace root). |
.github/actions/setup-rust/action.yml |
Expands rust-cache workspaces to include repo root and updates shared cache key. |
Resolve the CI workflow conflict by keeping the Tauri dependency-aware test-build path while accepting the updated taiki-e/install-action pin from develop. Validated the resolved workflow with YAML parsing, actionlint, the Tauri dependency detection script, Biome, diff whitespace checks, and the optimized cargo build path.
Coverage Report
File CoverageNo changed files found. |
Apply Copilot review feedback by keeping coverage report generation scoped to the hardware_visualizer package and enabling custom-protocol for the core-to-tauri integration check. Validated the workflow with YAML parsing, actionlint, whitespace checks, and cargo check using the same custom-protocol feature set.
Rust Tauri Coverage ReportCoverage Details |
Create a minimal frontendDist directory for Rust-only Tauri compile checks so tauri::generate_context! can validate the configured path without requiring a full frontend build. The Tauri CLI build path remains unchanged for dependency-update PRs, where npm and Cargo version consistency is still validated through the full Tauri action.
Summary
Why
Tauri CLI builds are useful for validating npm/Cargo version consistency, but they are heavier than necessary for normal Tauri source changes. This keeps that validation for dependency updates while making the common PR path faster.
Validation
node .github/scripts/check-tauri-deps-changed.ts HEADnpx biome check .github/scripts/check-tauri-deps-changed.tsruby -e 'require "yaml"; YAML.load_file(".github/workflows/ci.yml"); puts "ok"'\n-actionlint .github/workflows/ci.yml\n-git diff --check\n-cargo build -p hardware_visualizer --profile ci --features custom-protocolSummary by CodeRabbit