Skip to content

Commit 044b62f

Browse files
committed
Switch CI build timings from --timings to -Zbuild-analysis
Replace --timings (HTML) with -Zbuild-analysis (JSONL) for per-crate build timing data. Both cargo invocations use identical flags to avoid cache invalidation. RUSTC_BOOTSTRAP=1 is required for the unstable -Zbuild-analysis flag. Output is collected from $CARGO_HOME/log/ and published as cargo-build-analysis.jsonl.
1 parent 40fca5d commit 044b62f

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

.github/buildomat/build-and-test.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,25 @@ export TMPDIR="$TEST_TMPDIR"
105105
export RUST_BACKTRACE=1
106106
# We're building once, so there's no need to incur the overhead of an incremental build.
107107
export CARGO_INCREMENTAL=0
108+
# This allows us to use -Zbuild-analysis to collect per-crate build timing
109+
# data in JSONL format.
110+
export RUSTC_BOOTSTRAP=1
111+
108112
# Build all the packages and tests, and keep track of how long each took to build.
109113
#
110114
# The build graph ends up building several bin/test targets that depend on
111115
# omicron-nexus at the same time, which uses significant memory to compile on
112116
# illumos. To mitigate this we build everything except omicron-nexus's bin/test
113117
# targets first, then finish the build after.
114118
#
115-
# --timings produces an HTML timing report in target/cargo-timings/.
116-
ptime -m cargo build --timings \
119+
# Both invocations use the same flags to avoid cache invalidation.
120+
# We collect timing data only from the second (full workspace) build.
121+
ptime -m cargo --config 'build.analysis.enabled=true' build -Zbuild-analysis \
117122
--workspace --exclude=omicron-nexus --tests --locked --verbose
118-
ptime -m cargo build --timings \
123+
ptime -m cargo --config 'build.analysis.enabled=true' build -Zbuild-analysis \
119124
--workspace --tests --locked --verbose
120-
cp target/cargo-timings/cargo-timing.html "$OUTPUT_DIR/cargo-timing.html"
125+
cp "$(ls -t "$CARGO_HOME/log/"*.jsonl | head -1)" \
126+
"$OUTPUT_DIR/cargo-build-analysis.jsonl"
121127

122128
#
123129
# We apply our own timeout to ensure that we get a normal failure on timeout

.github/buildomat/jobs/build-and-test-helios.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
#:
3030
#: [[publish]]
3131
#: series = "build-info-helios"
32-
#: name = "cargo-timing.html"
33-
#: from_output = "/work/cargo-timing.html"
32+
#: name = "cargo-build-analysis.jsonl"
33+
#: from_output = "/work/cargo-build-analysis.jsonl"
3434
#:
3535
#: [[publish]]
3636
#: series = "live-tests"

.github/buildomat/jobs/build-and-test-linux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
#:
2929
#: [[publish]]
3030
#: series = "build-info-linux"
31-
#: name = "cargo-timing.html"
32-
#: from_output = "/work/cargo-timing.html"
31+
#: name = "cargo-build-analysis.jsonl"
32+
#: from_output = "/work/cargo-build-analysis.jsonl"
3333
#:
3434
#: [[publish]]
3535
#: series = "nextest-recording-linux"

0 commit comments

Comments
 (0)