Skip to content

Commit

Permalink
ci: fix bench-main workflow
Browse files Browse the repository at this point in the history
Actually collect the benchmarks to be inserted into the database.
  • Loading branch information
aleclarson committed Aug 14, 2024
1 parent 5f70b5d commit dd34b7d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/benchmarks/ci-bench-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -36,7 +36,7 @@ async function main() {
return
}

const benchmarks: Benchmark[] = []
const reports: BenchmarkReport[] = []

const files = await getStagedFiles(['src/**/*.ts'], lastBenchedSha)

Expand All @@ -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,
})),
)
Expand Down

0 comments on commit dd34b7d

Please sign in to comment.