Skip to content

ci: optimize Tauri CI build path#1436

Merged
shm11C3 merged 7 commits into
developfrom
ci/fast-test-build-rust
May 2, 2026
Merged

ci: optimize Tauri CI build path#1436
shm11C3 merged 7 commits into
developfrom
ci/fast-test-build-rust

Conversation

@shm11C3

@shm11C3 shm11C3 commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add Tauri-specific dependency change detection for CI.
  • Use the Tauri CLI build path only when Tauri npm/Cargo dependencies change in pull requests.
  • Use a direct Rust crate build for source-only PR test-build jobs to reduce CI time.

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 HEAD
  • npx biome check .github/scripts/check-tauri-deps-changed.ts
  • ruby -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-protocol

Summary by CodeRabbit

  • Chores
    • Added automated Tauri dependency-change detection in CI and exposed it as a job output.
    • CI now gates lightweight vs full Tauri build based on that detection, including conditional platform prep steps.
    • Reduced checkout fetch depth and adjusted coverage reporting to capture stderr.
    • Improved Core–Tauri integration verification and added supporting CI orchestration steps.

@coderabbitai

coderabbitai Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 9836638c-07cf-4813-aed5-251575c7e3bc

📥 Commits

Reviewing files that changed from the base of the PR and between 233c835 and 6c7ed93.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml

📝 Walkthrough

Walkthrough

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

Changes

Tauri Dependency Detection & CI Orchestration

Layer / File(s) Summary
Detection Logic
.github/scripts/check-tauri-deps-changed.ts
New TypeScript script: reads files at two refs via git show, extracts @tauri-apps/* entries and Tauri-related Cargo entries (from package.json, package-lock.json, Cargo.toml, Cargo.lock), produces stable sorted outputs, compares them, and computes changed (boolean). Emits changed=<boolean> to GITHUB_OUTPUT or stdout.
Workflow Integration / Base Ref
.github/workflows/ci.yml
Adds change-detection.outputs.tauri-deps-changed, uses fetch-depth: 2, and runs the new script in a step that computes a base_ref (default HEAD^) and invokes the Node script.
Job Outputs & Conditions
.github/workflows/ci.yml
Exports tauri-deps-changed and consumes it in downstream job conditions; test-build job if expanded to include needs.change-detection.outputs.tauri-deps-changed == 'true'.
Conditional Setup & Build Wiring
.github/workflows/ci.yml
Splits CI setup and build paths: when Tauri deps changed (or non-PR), runs full Tauri CLI build path with extra Linux/Windows prep (linuxdeploy perms, WiX/cache steps, env fixes); when not changed for PRs, runs lightweight Rust-only crate build and uses a dist/index.html placeholder.
Minor CI Command Adjustments
.github/workflows/ci.yml
Captures stderr for the Ubuntu coverage command (2>&1), prepares a dist/index.html placeholder in integration checks, and adjusts an integration cargo check invocation to include --features custom-protocol.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Poem

🐰 I sniff the diffs from ref to head,
Tauri crumbs in JSON neatly read.
Workflows gate, builds pick their way,
Small hops of logic guide each day.
A cheery script — CI saved the day!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main objective: optimizing the Tauri CI build path by making it conditional on dependency changes and using a faster Rust build for source-only changes.
Description check ✅ Passed The description covers the Summary (what and why), includes validation commands, and addresses the Type of Change, but is missing Test Plan and Checklist sections from the template.
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.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/fast-test-build-rust

Review rate limit: 4/5 reviews remaining, refill in 12 minutes.

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

@github-actions github-actions Bot added the github_actions Pull requests that update GitHub Actions code label May 2, 2026
@shm11C3 shm11C3 marked this pull request as ready for review May 2, 2026 10:21
Copilot AI review requested due to automatic review settings May 2, 2026 10:21

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

🧹 Nitpick comments (2)
.github/labeler.yml (1)

8-16: ⚡ Quick win

Keep the split labels aligned with workspace-level Rust changes.

hardviz_core and hardviz_tauri no longer fire for root Cargo.* or .cargo/** updates, even though .github/workflows/ci.yml treats 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 root Cargo.toml for consistency with workflow filters.

The workflow filters treat root Cargo.* files as Tauri-relevant, but the dependency detector currently only checks Cargo.lock and src-tauri/Cargo.toml. While root Cargo.toml does 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

📥 Commits

Reviewing files that changed from the base of the PR and between b40bec7 and cc1b98b.

📒 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

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 2, 2026

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

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.

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml Outdated
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.
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 2, 2026
@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 97.43% (🎯 60%) 1064 / 1092
🔵 Statements 96.9% (🎯 60%) 1127 / 1163
🔵 Functions 96.7% (🎯 60%) 264 / 273
🔵 Branches 89.94% (🎯 60%) 358 / 398
File CoverageNo changed files found.
Generated in workflow #2868 for commit 6c7ed93 by the Vitest Coverage Report Action

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

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Rust Tauri Coverage Report

Coverage Details
Filename                                     Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
_tests/commands/background_image_test.rs          39                 0   100.00%           6                 0   100.00%          21                 0   100.00%           0                 0         -
_tests/commands/settings_test.rs                 219                 0   100.00%          18                 0   100.00%         162                 0   100.00%           0                 0         -
adapters/tray.rs                                  91                91     0.00%           7                 7     0.00%          60                60     0.00%           0                 0         -
adapters/window.rs                               254                69    72.83%          21                 8    61.90%         195                47    75.90%           0                 0         -
app/startup.rs                                   188                87    53.72%          10                 3    70.00%         114                58    49.12%           0                 0         -
commands/background_image.rs                      22                 7    68.18%          11                 5    54.55%          19                 7    63.16%           0                 0         -
commands/hardware.rs                              62                62     0.00%          20                20     0.00%          68                68     0.00%           0                 0         -
commands/settings.rs                             578               578     0.00%         102               102     0.00%         497               497     0.00%           0                 0         -
commands/system.rs                                21                21     0.00%          10                10     0.00%          20                20     0.00%           0                 0         -
commands/ui.rs                                    17                17     0.00%           2                 2     0.00%          13                13     0.00%           0                 0         -
commands/updater.rs                               97                97     0.00%          15                15     0.00%          66                66     0.00%           0                 0         -
enums/error.rs                                   115                10    91.30%           9                 1    88.89%          99                10    89.90%           0                 0         -
enums/hardware.rs                                194                 7    96.39%          16                 1    93.75%         120                 6    95.00%           0                 0         -
enums/settings.rs                                425                16    96.24%          26                 2    92.31%         289                10    96.54%           0                 0         -
infrastructure/database/migration.rs              66                 1    98.48%          10                 0   100.00%          86                 0   100.00%           0                 0         -
lib.rs                                           203               203     0.00%           5                 5     0.00%         124               124     0.00%           0                 0         -
lifecycle.rs                                     227               178    21.59%          29                25    13.79%         160               137    14.37%           0                 0         -
main.rs                                            3                 3     0.00%           1                 1     0.00%           3                 3     0.00%           0                 0         -
models/hardware.rs                               375                83    77.87%          31                12    61.29%         275               100    63.64%           0                 0         -
models/hardware_archive.rs                         8                 0   100.00%           2                 0   100.00%          10                 0   100.00%           0                 0         -
models/settings.rs                               283                 0   100.00%          16                 0   100.00%         246                 0   100.00%           0                 0         -
services/background_image_service.rs             165                96    41.82%          16                10    37.50%          93                59    36.56%           0                 0         -
services/gpu_service.rs                           56                56     0.00%          11                11     0.00%          43                43     0.00%           0                 0         -
services/hardware_service.rs                      85                85     0.00%           4                 4     0.00%          51                51     0.00%           0                 0         -
services/language_service.rs                     101                 0   100.00%          18                 0   100.00%          57                 0   100.00%           0                 0         -
services/memory_service.rs                        12                12     0.00%           3                 3     0.00%           7                 7     0.00%           0                 0         -
services/motherboard_service.rs                   12                12     0.00%           3                 3     0.00%           7                 7     0.00%           0                 0         -
services/network_service.rs                       14                14     0.00%           1                 1     0.00%           8                 8     0.00%           0                 0         -
services/settings_service.rs                     321               143    55.45%          31                13    58.06%         269               130    51.67%           0                 0         -
services/system_service.rs                        22                22     0.00%           2                 2     0.00%          12                12     0.00%           0                 0         -
services/ui_service.rs                            45                45     0.00%           8                 8     0.00%          36                36     0.00%           0                 0         -
utils/color.rs                                    66                 1    98.48%           4                 0   100.00%          26                 0   100.00%           0                 0         -
utils/file.rs                                    224                 5    97.77%          14                 0   100.00%         144                 4    97.22%           0                 0         -
utils/formatter.rs                                55                 0   100.00%           5                 0   100.00%          39                 0   100.00%           0                 0         -
utils/logger.rs                                   71                71     0.00%           1                 1     0.00%          38                38     0.00%           0                 0         -
utils/tauri.rs                                   138                 0   100.00%          17                 0   100.00%          82                 0   100.00%           0                 0         -
workers/mod.rs                                    32                32     0.00%           2                 2     0.00%          20                20     0.00%           0                 0         -
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                           4906              2124    56.71%         507               277    45.36%        3579              1641    54.15%           0                 0         -

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 2, 2026
@shm11C3 shm11C3 enabled auto-merge (squash) May 2, 2026 10:39
shm11C3 added 2 commits May 2, 2026 19:41
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.
@shm11C3 shm11C3 merged commit d7ce8b2 into develop May 2, 2026
36 checks passed
@shm11C3 shm11C3 deleted the ci/fast-test-build-rust branch May 2, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants