Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use actual reference report #2

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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