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: Remove loadOldReport and switch to use loadReports method for reference #2

Merged
merged 1 commit into from
Apr 5, 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
13 changes: 3 additions & 10 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,12 @@ function run() {
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
core.info(`Mapping reference gas reports`);
core.info(`Using old workspace report`);
const referenceReports = (0, report_1.loadOldReport)(referenceContent);
const referenceReports = (0, report_1.loadReports)(referenceContent);
core.info(`Mapping compared gas reports`);
const compareReports = (0, report_1.loadReports)(compareContent);
core.endGroup();
core.startGroup("Compute gas diff");
core.info(`reference reports len: ${referenceReports.programs.length}`);
core.info(`compare reports len: ${compareReports.programs[0].functions}`);
const diffRows = (0, report_1.computeProgramDiffs)(referenceReports.programs, compareReports.programs[0].functions);
const diffRows = (0, report_1.computeProgramDiffs)(referenceReports.programs[0].functions, compareReports.programs[0].functions);
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 Expand Up @@ -438,7 +435,7 @@ run();
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.computeContractDiffs = exports.computeProgramDiffs = exports.computedWorkspaceDiff = exports.loadReports = exports.loadOldReport = exports.variation = void 0;
exports.computeContractDiffs = exports.computeProgramDiffs = exports.computedWorkspaceDiff = exports.loadReports = exports.variation = void 0;
const variation = (current, previous) => {
const delta = current - previous;
return {
Expand All @@ -449,10 +446,6 @@ const variation = (current, previous) => {
};
};
exports.variation = variation;
const loadOldReport = (content) => {
return JSON.parse(content);
};
exports.loadOldReport = loadOldReport;
const loadReports = (content) => {
return JSON.parse(content);
};
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

9 changes: 3 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as core from "@actions/core";
import { context, getOctokit } from "@actions/github";

import { formatMarkdownDiff, formatShellDiff } from "./format/program";
import { loadReports, computeProgramDiffs, loadOldReport } from "./report";
import { loadReports, computeProgramDiffs } from "./report";

// import { isSortCriteriaValid, isSortOrdersValid } from "./types";

Expand Down Expand Up @@ -107,17 +107,14 @@ async function run() {
referenceContent ??= compareContent; // if no source gas reports were loaded, defaults to the current gas reports

core.info(`Mapping reference gas reports`);
core.info(`Using old workspace report`);
const referenceReports = loadOldReport(referenceContent);
const referenceReports = loadReports(referenceContent);
core.info(`Mapping compared gas reports`);
const compareReports = loadReports(compareContent);
core.endGroup();

core.startGroup("Compute gas diff");
core.info(`reference reports len: ${referenceReports.programs.length}`);
core.info(`compare reports len: ${compareReports.programs[0].functions}`);
const diffRows = computeProgramDiffs(
referenceReports.programs,
referenceReports.programs[0].functions,
compareReports.programs[0].functions
);
core.info(`Format markdown of ${diffRows.length} diffs`);
Expand Down
5 changes: 0 additions & 5 deletions src/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
CircuitReport,
WorkspaceDiffReport,
WorkspaceReport,
OldWorkspaceReport,
} from "./types";

export const variation = (current: number, previous: number) => {
Expand All @@ -21,10 +20,6 @@ export const variation = (current: number, previous: number) => {
};
};

export const loadOldReport = (content: string): OldWorkspaceReport => {
return JSON.parse(content);
};

export const loadReports = (content: string): WorkspaceReport => {
return JSON.parse(content);
};
Expand Down
6 changes: 0 additions & 6 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ export interface WorkspaceReport {
contracts: ContractReport[];
}

// Temporary workspace to get CI to pass when comparing against the old master report
export interface OldWorkspaceReport {
programs: CircuitReport[];
contracts: ContractReport[];
}

export interface WorkspaceDiffReport {
programs: DiffProgram[];
contracts: ContractDiffReport[];
Expand Down