From dd34b7d7f209c749e5a22d50802c80cdd6088267 Mon Sep 17 00:00:00 2001 From: Alec Larson <1925840+aleclarson@users.noreply.github.com> Date: Wed, 14 Aug 2024 19:30:25 -0400 Subject: [PATCH] ci: fix bench-main workflow Actually collect the benchmarks to be inserted into the database. --- scripts/benchmarks/ci-bench-main.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/benchmarks/ci-bench-main.ts b/scripts/benchmarks/ci-bench-main.ts index 0b756a51..5f1b1333 100644 --- a/scripts/benchmarks/ci-bench-main.ts +++ b/scripts/benchmarks/ci-bench-main.ts @@ -3,7 +3,7 @@ import { existsSync } from 'node:fs' import { supabase } from 'radashi-db/supabase.js' import { compareToBaseline } from './src/compareToBaseline.js' import { getStagedFiles } from './src/getStagedFiles.js' -import type { Benchmark } from './src/reporter.js' +import type { BenchmarkReport } from './src/reporter.js' import { runVitest } from './src/runner.js' main() @@ -36,7 +36,7 @@ async function main() { return } - const benchmarks: Benchmark[] = [] + const reports: BenchmarkReport[] = [] const files = await getStagedFiles(['src/**/*.ts'], lastBenchedSha) @@ -61,21 +61,21 @@ async function main() { continue } } - await runVitest(benchFile) + reports.push(...(await runVitest(benchFile))) } } } - console.log('Results', benchmarks) + console.log('Results', reports) - if (benchmarks.length === 0) { + if (reports.length === 0) { console.log('No benchmarks were found') return } const { error: upsertError } = await supabase.from('benchmarks').upsert( - benchmarks.map(result => ({ - ...result, + reports.map(report => ({ + ...report.benchmark, sha: currentSha, })), )