Skip to content

Commit

Permalink
Release by 29.05.2024 (#1222)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yakutoc authored May 30, 2024
2 parents 230fcba + 3c8f07a commit d1132a4
Show file tree
Hide file tree
Showing 373 changed files with 15,754 additions and 3,278 deletions.
4 changes: 2 additions & 2 deletions actions/perftest-helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@salutejs/perftest-helpers",
"version": "0.4.0",
"version": "0.5.0-dev.0",
"description": "Performance test job helpers",
"author": "Salute Frontend Team <[email protected]>",
"license": "MIT",
Expand Down Expand Up @@ -37,4 +37,4 @@
"lib",
"actions"
]
}
}
14 changes: 14 additions & 0 deletions actions/perftest-helpers/src/modules/writeComment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ describe('perftest/writeComment', () => {

describe('getCommentBody', () => {
const descriptionResult = 'description';
const errorMessage = 'description';
let getDescriptionMock: jest.Mock;
let getErrorMessageMock: jest.Mock;

class ApiWithGetVisualReportExposed extends PerftestWriteCommentApi {
public getCommentBody = super.getCommentBody;

getReportDescription = (getDescriptionMock = jest.fn().mockReturnValue(descriptionResult) as any);

getErrorMessage = (getErrorMessageMock = jest.fn().mockReturnValue(errorMessage) as any);
}

it('should create report markup, add description', () => {
Expand All @@ -95,6 +99,16 @@ describe('perftest/writeComment', () => {
const result = api.getCommentBody(jsonReport as any);
expect(result.includes('OK')).toBe(true);
});

it('should write fallback message if no json report presented', () => {
const jsonReport = null;
const api = new ApiWithGetVisualReportExposed({} as any);

const result = api.getCommentBody(jsonReport);
expect(result).toEqual(errorMessage);

expect(getErrorMessageMock).toHaveBeenCalledTimes(1);
});
});

describe('getReportDescription', () => {
Expand Down
19 changes: 17 additions & 2 deletions actions/perftest-helpers/src/modules/writeComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class PerftestWriteCommentApi {
}

async post({ prId, owner, repo, reportPath }: WriteCommentParams): Promise<void> {
const jsonReport = await readJson<ReportType>(path.resolve(reportPath));
const jsonReport = await readJson<ReportType>(path.resolve(reportPath)).catch(() => null);
const body = this.getCommentBody(jsonReport);

await this.deps.octokit.rest.issues.createComment({
Expand All @@ -36,7 +36,11 @@ class PerftestWriteCommentApi {
});
}

protected getCommentBody(jsonReport: ReportType): string {
protected getCommentBody(jsonReport: ReportType | null): string {
if (!jsonReport) {
return this.getErrorMessage();
}

const result = jsonReport.hasSignificantNegativeChanges ? '🔴 FAIL' : '🟢 OK';

const report = `<h3>⚡ Component performance testing</h3>
Expand All @@ -49,6 +53,17 @@ ${this.getReportDescription(jsonReport)}
return report;
}

protected getErrorMessage(): string {
return `<h3>⚡ Component performance testing</h3>
**Result:** 💀 WASTED
Performance tests are broken.
If the current changes are the cause, please fix it immediately in this PR. If not, please schedule their repair.
For any questions, come to the Speed team.
`;
}

protected getReportDescription(jsonReport: ReportType): string {
const resultByTaskId = this.getResultByTaskId(jsonReport);
const metricsReport = this.getDescriptionTables(resultByTaskId);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d1132a4

Please sign in to comment.