mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-27 23:07:12 +02:00
ci: Capture actual task durations under turbo 2.x summary schema (#30908)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d82fbc8f85
commit
700243f5db
10
.github/scripts/send-build-stats.mjs
vendored
10
.github/scripts/send-build-stats.mjs
vendored
|
|
@ -37,10 +37,16 @@ const summary = JSON.parse(readFileSync(join(runsDir, files.at(-1)), 'utf-8'));
|
|||
|
||||
const metrics = [];
|
||||
|
||||
// turbo 2.x emits start/end timestamps rather than a `durationMs` field.
|
||||
// For cache hits, the execution window measures only restore overhead (~ms),
|
||||
// so we use `cache.timeSaved` — the duration of the run we avoided — instead.
|
||||
const elapsedMs = ({ startTime, endTime } = {}) =>
|
||||
startTime && endTime ? endTime - startTime : 0;
|
||||
|
||||
for (const task of summary.tasks ?? []) {
|
||||
if (task.execution?.exitCode !== 0) continue;
|
||||
const durationMs = task.execution.durationMs ?? 0;
|
||||
const cacheHit = task.cache?.status === 'HIT';
|
||||
const durationMs = cacheHit ? (task.cache.timeSaved ?? 0) : elapsedMs(task.execution);
|
||||
// taskId format: "package-name#task-name"
|
||||
const [pkg, taskName] = task.taskId?.split('#') ?? [task.package, task.task];
|
||||
|
||||
|
|
@ -53,7 +59,7 @@ for (const task of summary.tasks ?? []) {
|
|||
);
|
||||
}
|
||||
|
||||
const totalMs = summary.durationMs ?? 0;
|
||||
const totalMs = elapsedMs(summary.execution);
|
||||
const totalTasks = summary.tasks?.length ?? 0;
|
||||
const cachedTasks = summary.tasks?.filter((t) => t.cache?.status === 'HIT').length ?? 0;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user