Skip to content

Commit

Permalink
chore: only run install case in need (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 authored Nov 24, 2023
1 parent 3c9546d commit 04a1233
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions scripts/src/pr-bench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { dev } from './runners/dev';
import { build } from './runners/build';
import {
DefaultBenchCase,
ValidMetricsForCase,
cloneRepo,
getDataPath,
mergeMetrics,
Expand Down Expand Up @@ -29,10 +30,17 @@ async function prBench() {

await build(productName, caseName);

try {
await yarnInstall(productName, caseName);
} catch (err) {
console.log('failed to collect install size metrics:', err);
if (
ValidMetricsForCase[
caseName as keyof typeof ValidMetricsForCase
]?.includes('installSize') ||
!ValidMetricsForCase[caseName as keyof typeof ValidMetricsForCase]
) {
try {
await yarnInstall(productName, caseName);
} catch (err) {
console.log('failed to collect install size metrics:', err);
}
}

await mergeMetrics(productName, caseName);
Expand Down

0 comments on commit 04a1233

Please sign in to comment.