Skip to content

Commit 2783365

Browse files
committed
add debugging mode
1 parent 3bc340c commit 2783365

File tree

1 file changed

+20
-5
lines changed
  • .github/scripts/analyze_benchmarks

1 file changed

+20
-5
lines changed

.github/scripts/analyze_benchmarks/index.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,34 @@ async function analyzeBenchmarksForVersion(
4949
/**
5050
* Runs the benchmark analysis for a specified version or current version
5151
* @param specifiedVersion Optional version to analyze. If not provided, uses current package version
52+
* @param debugMode If true, throws errors instead of writing them to markdown
5253
*/
53-
async function runBenchmarkAnalysis(specifiedVersion?: string): Promise<void> {
54+
async function runBenchmarkAnalysis(
55+
specifiedVersion?: string,
56+
debugMode: boolean = false
57+
): Promise<void> {
5458
const versionToAnalyze = specifiedVersion ?? currentAzleVersion;
5559
console.info('Analyzing benchmarks...');
5660
try {
5761
const statistics = await analyzeBenchmarksForVersion(versionToAnalyze);
5862
await reportResults(statistics, versionToAnalyze);
5963
} catch (error) {
60-
const errorMessage =
61-
error instanceof Error ? error.message : String(error);
62-
await reportErrorResult(errorMessage, versionToAnalyze);
64+
if (debugMode) {
65+
// In debug mode, throw the error to get stack traces and immediate feedback
66+
throw error;
67+
} else {
68+
// In normal mode, write error to markdown for PR visibility
69+
const errorMessage =
70+
error instanceof Error ? error.message : String(error);
71+
await reportErrorResult(errorMessage, versionToAnalyze);
72+
}
6373
}
6474
console.info(`Report generated at ${MARKDOWN_FILE}`);
6575
}
6676

67-
runBenchmarkAnalysis(process.argv[2]);
77+
// Parse command line arguments
78+
const args = process.argv.slice(2);
79+
const debugMode = args.includes('--debug') === true;
80+
const versionArg = args.find((arg) => arg.startsWith('--') === false);
81+
82+
runBenchmarkAnalysis(versionArg, debugMode);

0 commit comments

Comments
 (0)