forked from dapplion/benchmark
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d79159f
commit 53bbb67
Showing
11 changed files
with
144 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {BenchmarkComparisonReport} from "../../types.js"; | ||
import {renderBenchmarkComparisonTable} from "../../utils/render.js"; | ||
|
||
export function benchmarkComparisonComment(report: BenchmarkComparisonReport): string { | ||
return ` | ||
## Comparison Report | ||
${renderBenchmarkComparisonTable(report, "html")} | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import * as github from "@actions/github"; | ||
import {getGithubEventData, GithubActionsEventData} from "../../utils/index.js"; | ||
import {commentToCommit, commentToPrUpdatable, GithubCommentTag} from "../octokit.js"; | ||
|
||
export async function postGaComment({ | ||
commentBody, | ||
tag, | ||
commentOnPush, | ||
}: { | ||
commentBody: string; | ||
tag: GithubCommentTag; | ||
commentOnPush: boolean; | ||
}): Promise<void> { | ||
switch (github.context.eventName) { | ||
case "pull_request": { | ||
const eventData = getGithubEventData<GithubActionsEventData["pull_request"]>(); | ||
const prNumber = eventData.number; | ||
if (!prNumber) { | ||
throw Error("github event data has no PR number"); | ||
} | ||
|
||
await commentToPrUpdatable(prNumber, commentBody, tag); | ||
|
||
break; | ||
} | ||
|
||
case "push": { | ||
// Only comment on performance regression | ||
if (commentOnPush) { | ||
await commentToCommit(github.context.sha, commentBody); | ||
} | ||
|
||
break; | ||
} | ||
|
||
default: | ||
throw Error(`event not supported ${github.context.eventName}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import {PerformanceReport} from "../../types.js"; | ||
import {renderPerformanceTable} from "../../utils/render.js"; | ||
|
||
export function performanceReportComment(report: PerformanceReport): string { | ||
const isFailedResults = report.results.filter((r) => r.isFailed); | ||
const isImprovedResults = report.results.filter((r) => r.isImproved); | ||
|
||
if (report.someFailed) { | ||
return ` | ||
## :warning: **Performance Alert** :warning: | ||
Possible performance regression was detected for some benchmarks. | ||
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold. | ||
${renderPerformanceTable(isFailedResults, report, "html")} | ||
`; | ||
} | ||
|
||
if (isImprovedResults.length > 0) { | ||
return ` | ||
## Performance Report | ||
🚀🚀 Significant benchmark improvement detected | ||
<details><summary>Full benchmark results</summary> | ||
${renderPerformanceTable(isImprovedResults, report, "html")} | ||
</details> | ||
`; | ||
} | ||
|
||
return ` | ||
## Performance Report | ||
✔️ no performance regression detected | ||
<details><summary>Full benchmark results</summary> | ||
${renderPerformanceTable(report.results, report, "html")} | ||
</details> | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.