From 48c2fcb62b8c657beaa397c1f5acf8813d1b4e27 Mon Sep 17 00:00:00 2001 From: Zhengchao An Date: Sat, 1 Aug 2026 11:36:48 +0800 Subject: [PATCH] ci: add an opt-in cargo --timings run to decide the sccache question (#5545) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sccache can only cache compilation units whose --emit includes link. That covers workspace rlibs and nothing else: clippy is metadata-only, and the ~100 test binaries, the rustfs bin and every build script invoke the system linker. So the headline claim that started this — s3select-query costing 17m13s inside a 19m32s nextest build — does not by itself justify sccache, because cargo prints "Compiling" when a crate starts and never when it finishes: that number is the whole compilation tail, not one crate. Adding --timings behind a workflow_dispatch input on Cache Warm answers it with data instead. Read two shares off the report: workspace lib codegen against the whole build, and s3select-query's own rlib. The plan in rustfs/backlog#1601 adopts sccache only above 50% and 25%; if linking dominates instead, the answer is mold/lld plus split-debuginfo, which is precisely the region sccache cannot reach. Off by default: it doubles the ci-dev build, and this only needs running once per question. Nothing about the normal warm path changes. Refs: rustfs/backlog#1598, rustfs/backlog#1601 --- .github/workflows/cache-warm.yml | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/.github/workflows/cache-warm.yml b/.github/workflows/cache-warm.yml index d80e03f42..d69a89c79 100644 --- a/.github/workflows/cache-warm.yml +++ b/.github/workflows/cache-warm.yml @@ -65,6 +65,14 @@ on: - ".github/workflows/docker.yml" - ".github/workflows/audit.yml" workflow_dispatch: + inputs: + emit_timings: + description: >- + Also emit cargo --timings for the ci-dev build and upload it. Used to + decide whether sccache is worth adopting (rustfs/backlog#1601 gate). + required: false + default: false + type: boolean permissions: contents: read @@ -103,6 +111,33 @@ jobs: # e2e_test, which test-and-lint's own run excludes. The second build adds # the e2e-test-hooks feature resolution that build-rustfs-debug-binary uses # and that no lint lane enables. + # rustfs/backlog#1601 gate. sccache can only cache compilation units whose + # --emit includes link, so it covers workspace rlibs and nothing else: + # clippy is metadata-only, and the ~100 test binaries, the rustfs bin and + # every build script invoke the system linker. Before spending a bucket, + # credentials and a supply-chain boundary on it, measure how much of the + # build is actually rlib codegen. + # + # Read from the report: workspace lib codegen as a share of the build, and + # s3select-query's own rlib as a share. The plan adopts sccache only above + # 50% and 25% respectively; if linking dominates instead, the answer is + # mold/lld plus split-debuginfo, which is exactly the part sccache cannot + # touch. Off by default — this doubles the ci-dev build. + - name: Build ci-dev superset (with --timings) + if: inputs.emit_timings + env: + CARGO_BUILD_JOBS: "2" + run: cargo build --workspace --all-targets --timings + + - name: Upload cargo timings report + if: inputs.emit_timings + uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6 + with: + name: cargo-timings-ci-dev + path: target/cargo-timings/ + retention-days: 30 + if-no-files-found: error + - name: Build ci-dev superset env: # Same limit ci.yml puts on its nextest step: this builds the same