Skip to content

ci: re-enable setup-soldr cook/cargo-chef prebuild for faster builds #266

Description

@zackees

Context

In PR #253 (chore(deps): adopt upstream soldr/zccache/setup-soldr updates) we added prebuild-deps: none to every zackees/setup-soldr@v0 invocation across 11 workflow blocks. setup-soldr's default since their PR #140 is prebuild-deps: cargo-chef — it runs soldr cook to pre-warm target/deps/ with all transitive dependency artifacts on the cache-keyed Cargo.lock hash. When the cache hits, the user's first cargo build starts hot.

For fbuild we had to disable it because the cook step pre-populates target/ and the subsequent soldr cargo build -p fbuild-cli -p fbuild-daemon fails:

##[warning]setup-soldr detected a pre-populated shared target directory;
  a subsequent `soldr cargo build` using the same `--target-dir` may fail
  with a missing .rmeta error - see README 'Known limitations'.
...
error: could not compile `fbuild-cli` (bin "fbuild")

Documented upstream as a known shared-target-dir limitation when you cook → cargo build -p <subset>.

Why this matters

fbuild's CI is heavy. Every PR runs the full board matrix (80+ jobs), and each one compiles fbuild's entire dependency tree from cold (zccache helps but only for downstream compilations, not for the dep tree itself). The cook layer's cache-key (cook-${os}-${arch}-${libc}-rustc${release}-f${flagsHash}-l${lockHash}-soldr${ver}) is content-addressable on Cargo.lock — it would hit across branches automatically and turn "cold first build" into "warm-start build" for every CI run.

Per setup-soldr's design doc (PR #140), the win is measured in tens of seconds per job on cache hit. Across 80+ jobs that's potentially 30+ minutes of CI savings per PR.

Options to enable

  1. Separate target dir for the cook step. Cook writes to target-chef/; the user's build still uses target/. Loses the warm-start benefit but plays nice with -p <subset> builds. Probably not what we want.

  2. Build the full workspace instead of -p fbuild-cli -p fbuild-daemon. Cook prebuilds the whole transitive dep graph; if we then build the whole workspace, every .rmeta cook created is what cargo expects to see. Trade-off: workspace builds compile more code than the subset we need for distribution.

  3. Tune prebuild-deps-flags to constrain chef's prebuild to the same -p subset (prebuild-deps-flags: \"-p fbuild-cli -p fbuild-daemon\"). Aligns cook's output with the actual build. Smallest change, but requires verifying chef respects -p for the prebuild phase.

  4. Wait for upstream setup-soldr fix. Likely lowest-effort if it lands.

Option 3 is probably the right first try.

Acceptance criteria

  • Pick a per-workflow strategy (likely Fix ESP32-S3 PSRAM board configuration in board JSON database #3, with cdc on boot warning #2 as fallback for template_native_build.yml which already builds -p fbuild-cli -p fbuild-daemon).
  • Remove prebuild-deps: none from one workflow as a probe (suggest check-ubuntu.yml); verify clean run.
  • Measure the time saved on a cache hit vs current cold-deps baseline. Threshold to roll out: ≥ 30s wall-clock per job on a hit.
  • If clean, drop prebuild-deps: none workflow-by-workflow.
  • If the upstream issue gets fixed first, ride that fix instead of working around it locally.

Reference

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions