Skip to content

Commit

Permalink
Merge pull request #2 from vezenovm/mv/check-reference-report
Browse files Browse the repository at this point in the history
fix: Use actual reference report
  • Loading branch information
vezenovm authored Apr 23, 2024
2 parents 45e9c9a + a44ae27 commit acf1279
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 29 deletions.
18 changes: 4 additions & 14 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,25 +387,15 @@ function run() {
core.info(`Loading gas reports from "${localReportPath}"`);
const compareContent = fs.readFileSync(localReportPath, "utf8");
referenceContent !== null && referenceContent !== void 0 ? referenceContent : (referenceContent = compareContent); // if no source gas reports were loaded, defaults to the current gas reports
// TODO: Bring this back after master has a correct report as it currently
// has a report with only "main" report names
// const referenceReports = loadReports(referenceContent);
core.info(`Mapping compared gas reports`);
const compareReports = (0, report_1.loadReports)(compareContent);
core.info(`Got ${compareReports.programs.length} programs`);
core.info(`Got ${compareReports.programs.length} compare programs`);
core.info(`Mapping reference gas reports`);
core.info(`Making dummy reference report`);
const referenceReports = compareReports.programs.map((program) => {
const circuitReport = { name: "main", acir_opcodes: 1, circuit_size: 1 };
const programReport = {
package_name: program.package_name,
functions: [circuitReport],
};
return programReport;
});
const referenceReports = (0, report_1.loadReports)(referenceContent);
core.info(`Got ${compareReports.programs.length} reference programs`);
core.endGroup();
core.startGroup("Compute gas diff");
const diffRows = (0, report_1.computeProgramDiffs)(referenceReports, compareReports.programs);
const diffRows = (0, report_1.computeProgramDiffs)(referenceReports.programs, compareReports.programs);
core.info(`Format markdown of ${diffRows.length} diffs`);
const markdown = (0, program_1.formatMarkdownDiff)(header, diffRows, repository, github_1.context.sha, refCommitHash, summaryQuantile);
core.info(`Format shell of ${diffRows.length} diffs`);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

19 changes: 5 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,26 +107,17 @@ async function run() {
const compareContent = fs.readFileSync(localReportPath, "utf8");
referenceContent ??= compareContent; // if no source gas reports were loaded, defaults to the current gas reports

// TODO: Bring this back after master has a correct report as it currently
// has a report with only "main" report names
// const referenceReports = loadReports(referenceContent);
core.info(`Mapping compared gas reports`);
const compareReports = loadReports(compareContent);
core.info(`Got ${compareReports.programs.length} programs`);
core.info(`Got ${compareReports.programs.length} compare programs`);

core.info(`Mapping reference gas reports`);
core.info(`Making dummy reference report`);
const referenceReports = compareReports.programs.map((program) => {
const circuitReport: CircuitReport = { name: "main", acir_opcodes: 1, circuit_size: 1 };
const programReport: ProgramReport = {
package_name: program.package_name,
functions: [circuitReport],
};
return programReport;
});
const referenceReports = loadReports(referenceContent);
core.info(`Got ${compareReports.programs.length} reference programs`);
core.endGroup();

core.startGroup("Compute gas diff");
const diffRows = computeProgramDiffs(referenceReports, compareReports.programs);
const diffRows = computeProgramDiffs(referenceReports.programs, compareReports.programs);
core.info(`Format markdown of ${diffRows.length} diffs`);
const markdown = formatMarkdownDiff(
header,
Expand Down

0 comments on commit acf1279

Please sign in to comment.