Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

ci(tauri): check lockfiles with cargo, vendor only when inputs change (#9716)

teo942ca4224515
diff --git a/.github/workflows/check_tauri_lockfiles.yml b/.github/workflows/check_tauri_lockfiles.yml
index 7a3c77b740..b25dd233bc 100644
--- a/.github/workflows/check_tauri_lockfiles.yml
+++ b/.github/workflows/check_tauri_lockfiles.yml
@@ -18,7 +18,42 @@ permissions:
jobs:
check-tauri-lockfiles:
name: check Tauri lockfiles
- runs-on: namespace-profile-linux-small
+ runs-on: namespace-profile-linux-tiny-no-cache
+ outputs:
+ vendoring_inputs: ${{ steps.filter.outputs.vendoring_inputs }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
+ with:
+ clean: 'false'
+ persist-credentials: 'false'
+ - id: filter
+ name: Filter changed paths
+ uses: dorny/paths-filter@d1c1ffe0248fe513906c8e24db8ea791d46f8590
+ with:
+ filters: |
+ vendoring_inputs:
+ - 'apps/web/tauri/Cargo.lock'
+ - 'apps/web/tauri/desktop-cef/Cargo.lock'
+ - 'nix/tauri-desktop.nix'
+ - 'flake.nix'
+ - 'flake.lock'
+ - '.github/workflows/check_tauri_lockfiles.yml'
+ - name: Setup Rust
+ uses: './.github/actions/setup-rust'
+ with:
+ sccache: 'false'
+ rust-cache: 'false'
+ - name: Check lockfiles match their manifests
+ run: |
+ cargo update --workspace --locked --manifest-path apps/web/tauri/Cargo.toml
+ cargo update --workspace --locked --manifest-path apps/web/tauri/desktop-cef/Cargo.toml
+ check-tauri-vendoring:
+ needs:
+ - check-tauri-lockfiles
+ if: needs.check-tauri-lockfiles.outputs.vendoring_inputs == 'true'
+ name: check Tauri vendoring
+ runs-on: namespace-profile-linux-small;overrides.cache-tag=nix-checks
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
diff --git a/apps/web/tauri/desktop-cef/AGENTS.md b/apps/web/tauri/desktop-cef/AGENTS.md
index a5dd9bfc77..7327e70eb3 100644
--- a/apps/web/tauri/desktop-cef/AGENTS.md
+++ b/apps/web/tauri/desktop-cef/AGENTS.md
@@ -37,8 +37,10 @@ thin binary over `../src-tauri` (`app_lib::run_with`) that selects
lockfiles: run `cargo metadata --format-version 1 > /dev/null` here as well as
in `..`. A new git dependency also needs its `outputHashes` entry on both
vendor dirs in `nix/tauri-desktop.nix`. The `check tauri lockfiles` PR
- workflow (`nix build .#checks.x86_64-linux.tauri-cargo-lockfiles`) fails
- when either lockfile is stale; otherwise only the macOS release build would.
+ workflow fails when either lockfile is stale (`cargo update --workspace
+ --locked`); otherwise only the macOS release build would. When a lockfile or
+ Nix input changes it also builds the vendor dirs
+ (`nix build .#checks.x86_64-linux.tauri-cargo-lockfiles`).
- `../src-tauri` must resolve `tauri` through `[patch.crates-io]` (a version
requirement, not a git dependency) so this workspace can repoint it.
- The `cef` feature of `../src-tauri` adds no dependencies; it switches the
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/check_tauri_lockfiles.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/check_tauri_lockfiles.rs
index 5c61839492..bd96d3268a 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/check_tauri_lockfiles.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/check_tauri_lockfiles.rs
@@ -1,12 +1,17 @@
-//! `check tauri lockfiles` — resolves both Tauri Cargo workspaces offline
-//! against their Nix vendor dirs. The macOS release builds the desktop-cef
-//! workspace, whose lockfile drifts silently when a shared `src-tauri`
-//! dependency changes; this catches it on the PR instead of the next release.
+//! `check tauri lockfiles` — keeps both Tauri Cargo workspaces' lockfiles in step
+//! with their manifests. The macOS release builds the desktop-cef workspace,
+//! whose lockfile drifts silently when a shared `src-tauri` dependency changes;
+//! this catches it on the PR instead of the next release.
+//!
+//! Plain Cargo answers that from the registry index, without a Nix store, so it
+//! takes the same time on any runner. The offline Nix resolve also proves the
+//! vendored sources build, which only a lockfile or Nix change can break, so it
+//! runs only for those.
//! Generated into `check_tauri_lockfiles.yml`.
-use gh_workflow::{Event, Job, Level, Permissions, PullRequest, Step, Workflow};
+use gh_workflow::{Event, Expression, Job, Level, Permissions, PullRequest, Step, Use, Workflow};
-use crate::workflows::{runners, steps};
+use crate::workflows::{runners, steps, vars};
/// Build the workflow.
pub fn check_tauri_lockfiles() -> Workflow {
@@ -31,12 +36,58 @@ pub fn check_tauri_lockfiles() -> Workflow {
)),
))
.add_job("check-tauri-lockfiles", check_tauri_lockfiles_job())
+ .add_job("check-tauri-vendoring", check_tauri_vendoring_job())
}
fn check_tauri_lockfiles_job() -> Job {
Job::default()
.name("check Tauri lockfiles")
- .runs_on(runners::Runner::Small.to_string())
+ .runs_on(runners::Runner::TinyNoCache.to_string())
+ .add_output(
+ "vendoring_inputs",
+ "${{ steps.filter.outputs.vendoring_inputs }}",
+ )
+ .add_step(steps::checkout(false, false))
+ .add_step(vendoring_inputs_filter())
+ .add_step(steps::setup_rust_light())
+ .add_step(
+ Step::new("Check lockfiles match their manifests").run(indoc::indoc! {r#"
+ cargo update --workspace --locked --manifest-path apps/web/tauri/Cargo.toml
+ cargo update --workspace --locked --manifest-path apps/web/tauri/desktop-cef/Cargo.toml
+ "#}),
+ )
+}
+
+fn vendoring_inputs_filter() -> Step<Use> {
+ Step::new("Filter changed paths")
+ .uses(
+ "dorny",
+ "paths-filter",
+ "d1c1ffe0248fe513906c8e24db8ea791d46f8590",
+ ) // v3.0.3
+ .id("filter")
+ .add_with((
+ "filters",
+ indoc::indoc! {r#"
+ vendoring_inputs:
+ - 'apps/web/tauri/Cargo.lock'
+ - 'apps/web/tauri/desktop-cef/Cargo.lock'
+ - 'nix/tauri-desktop.nix'
+ - 'flake.nix'
+ - 'flake.lock'
+ - '.github/workflows/check_tauri_lockfiles.yml'
+ "#},
+ ))
+}
+
+fn check_tauri_vendoring_job() -> Job {
+ Job::default()
+ .name("check Tauri vendoring")
+ .needs(vec!["check-tauri-lockfiles".to_string()])
+ .cond(Expression::new(
+ "needs.check-tauri-lockfiles.outputs.vendoring_inputs == 'true'",
+ ))
+ .runs_on(runners::Runner::Small.with_cache_tag(vars::NIX_CHECKS_CACHE_TAG))
.add_step(steps::checkout(false, false))
.add_step(steps::mount_nix_cache_volume())
.add_step(steps::setup_nix())
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/vars.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/vars.rs
index 8e26ef6391..2db17e7d76 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/vars.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/vars.rs
@@ -73,6 +73,10 @@ pub const CI_SCCACHE_NAME: &str = "sccache-ci";
/// `linux-mid` volume.
pub const WEB_CI_CACHE_TAG: &str = "web-ci";
+/// Nix-only PR checks. They read a Nix store back, so they stay off the small
+/// profile's default volume, where other jobs would overwrite that store.
+pub const NIX_CHECKS_CACHE_TAG: &str = "nix-checks";
+
/// Namespace remote sccache used when the web checks compile Rust API schema
/// generators. Kept separate from [`CI_SCCACHE_NAME`] because these jobs have
/// a different workload and runner profile.