From b771539eb3d7bc077e31fc61adcbdfe4ec883d65 Mon Sep 17 00:00:00 2001 From: Pawel Kozlowski Date: Tue, 26 Sep 2023 11:34:19 +0200 Subject: [PATCH] build: improve results logging in perf script (#51902) Add git references when printing perf comparison results. PR Close #51902 --- scripts/benchmarks/index.mts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/benchmarks/index.mts b/scripts/benchmarks/index.mts index 44cf37e3a89..6958528d699 100644 --- a/scripts/benchmarks/index.mts +++ b/scripts/benchmarks/index.mts @@ -6,13 +6,13 @@ * found in the LICENSE file at https://angular.io/license */ -import yargs from 'yargs'; -import {bold, yellow, GitClient, green, Log} from '@angular/ng-dev'; -import inquirer from 'inquirer'; -import {exec} from './utils.mjs'; -import {ResolvedTarget, findBenchmarkTargets, getTestlogPath, resolveTarget} from './targets.mjs'; -import {collectBenchmarkResults} from './results.mjs'; import {setOutput} from '@actions/core'; +import {GitClient, Log, bold, green, yellow} from '@angular/ng-dev'; +import inquirer from 'inquirer'; +import yargs from 'yargs'; +import {collectBenchmarkResults} from './results.mjs'; +import {ResolvedTarget, findBenchmarkTargets, getTestlogPath, resolveTarget} from './targets.mjs'; +import {exec} from './utils.mjs'; const benchmarkTestFlags = [ '--cache_test_results=no', @@ -135,7 +135,7 @@ async function runBenchmarkTarget(bazelTarget: ResolvedTarget): Promise { */ async function runCompare(bazelTargetRaw: string | undefined, compareRef: string): Promise { const git = await GitClient.get(); - const initialRef = git.getCurrentBranchOrRevision(); + const currentRef = git.getCurrentBranchOrRevision(); if (git.hasUncommittedChanges()) { Log.warn(bold('You have uncommitted changes.')); @@ -173,7 +173,7 @@ async function runCompare(bazelTargetRaw: string | undefined, compareRef: string await exec('yarn'); await runBenchmarkTarget(bazelTarget); } finally { - restoreWorkingStage(git, initialRef); + restoreWorkingStage(git, currentRef); } // Re-install dependencies for `HEAD`. @@ -191,10 +191,10 @@ async function runCompare(bazelTargetRaw: string | undefined, compareRef: string Log.info('\n\n\n'); Log.info(bold(green('Results!'))); - Log.info(bold(yellow('Comparison results')), '\n'); + Log.info(bold(yellow(`Comparison reference (${compareRef}) results:`)), '\n'); Log.info(comparisonResults.summaryConsoleText); - Log.info(bold(yellow('Working stage results')), '\n'); + Log.info(bold(yellow(`Working stage (${currentRef}) results:`)), '\n'); Log.info(workingDirResults.summaryConsoleText); }