mirror of
https://github.com/graalvm/setup-graalvm.git
synced 2025-03-13 14:30:15 +08:00
add mermaid diagramm to pr comment
This commit is contained in:
parent
ab28789618
commit
e3535f6ae8
@ -43,6 +43,10 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
description: 'Post a comment containing a Native Image build report on pull requests.'
|
description: 'Post a comment containing a Native Image build report on pull requests.'
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
native-image-pr-comparison:
|
||||||
|
required: false
|
||||||
|
description: 'Post a comment containing a comparison between the Native Image of the pr-branch and the pr-base-branch on pull.'
|
||||||
|
default: 'false'
|
||||||
version:
|
version:
|
||||||
required: false
|
required: false
|
||||||
description: 'GraalVM version (release, latest, dev).'
|
description: 'GraalVM version (release, latest, dev).'
|
||||||
|
39
dist/cleanup/index.js
generated
vendored
39
dist/cleanup/index.js
generated
vendored
@ -74427,6 +74427,7 @@ const BYTES_TO_GiB = 1024 * 1024 * 1024;
|
|||||||
const DOCS_BASE = 'https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md';
|
const DOCS_BASE = 'https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md';
|
||||||
const INPUT_NI_JOB_REPORTS = 'native-image-job-reports';
|
const INPUT_NI_JOB_REPORTS = 'native-image-job-reports';
|
||||||
const INPUT_NI_PR_REPORTS = 'native-image-pr-reports';
|
const INPUT_NI_PR_REPORTS = 'native-image-pr-reports';
|
||||||
|
const INPUT_NI_PR_COMPARISON = 'native-image-pr-comparison';
|
||||||
const NATIVE_IMAGE_CONFIG_FILE = (0, path_1.join)((0, os_1.tmpdir)(), 'native-image-options.properties');
|
const NATIVE_IMAGE_CONFIG_FILE = (0, path_1.join)((0, os_1.tmpdir)(), 'native-image-options.properties');
|
||||||
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE';
|
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE';
|
||||||
function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion) {
|
function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion) {
|
||||||
@ -74458,9 +74459,6 @@ function generateReports() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const buildOutput = JSON.parse(fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8'));
|
const buildOutput = JSON.parse(fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8'));
|
||||||
const treeSha = yield (0, utils_1.createTree)(JSON.stringify(buildOutput));
|
|
||||||
yield (0, utils_1.createRef)(treeSha);
|
|
||||||
const prMetrics = JSON.parse(yield (0, utils_1.getPrBaseBranchMetrics)());
|
|
||||||
const report = createReport(buildOutput);
|
const report = createReport(buildOutput);
|
||||||
if (areJobReportsEnabled()) {
|
if (areJobReportsEnabled()) {
|
||||||
core.summary.addRaw(report);
|
core.summary.addRaw(report);
|
||||||
@ -74469,8 +74467,12 @@ function generateReports() {
|
|||||||
if (arePRReportsEnabled()) {
|
if (arePRReportsEnabled()) {
|
||||||
yield (0, utils_1.createPRComment)(report);
|
yield (0, utils_1.createPRComment)(report);
|
||||||
}
|
}
|
||||||
const prBaseReport = createPRComparison(buildOutput, prMetrics);
|
const treeSha = yield (0, utils_1.createTree)(JSON.stringify(buildOutput));
|
||||||
yield (0, utils_1.createPRComment)(prBaseReport);
|
yield (0, utils_1.createRef)(treeSha);
|
||||||
|
if (arePRBaseComparisonEnabled()) {
|
||||||
|
const prMetrics = JSON.parse(yield (0, utils_1.getPrBaseBranchMetrics)());
|
||||||
|
yield (0, utils_1.createPRComment)(createPRComparison(buildOutput, prMetrics));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -74481,6 +74483,9 @@ function areJobReportsEnabled() {
|
|||||||
function arePRReportsEnabled() {
|
function arePRReportsEnabled() {
|
||||||
return (0, utils_1.isPREvent)() && core.getInput(INPUT_NI_PR_REPORTS) === 'true';
|
return (0, utils_1.isPREvent)() && core.getInput(INPUT_NI_PR_REPORTS) === 'true';
|
||||||
}
|
}
|
||||||
|
function arePRBaseComparisonEnabled() {
|
||||||
|
return (0, utils_1.isPREvent)() && core.getInput(INPUT_NI_PR_COMPARISON) === 'true';
|
||||||
|
}
|
||||||
function getNativeImageOptionsFile() {
|
function getNativeImageOptionsFile() {
|
||||||
let optionsFile = process.env[NATIVE_IMAGE_CONFIG_FILE_ENV];
|
let optionsFile = process.env[NATIVE_IMAGE_CONFIG_FILE_ENV];
|
||||||
if (optionsFile === undefined) {
|
if (optionsFile === undefined) {
|
||||||
@ -74548,6 +74553,30 @@ function createPRComparison(dataRecent, dataBase) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
\`\`\`mermaid
|
||||||
|
gantt
|
||||||
|
title Native Image Size Details
|
||||||
|
todayMarker off
|
||||||
|
dateFormat X
|
||||||
|
axisFormat %s
|
||||||
|
|
||||||
|
section Code area
|
||||||
|
${recentBranch} (${bytesToHuman(detailsRecent.code_area.bytes)}) : active, 0, ${detailsRecent.code_area.bytes / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(detailsBase.code_area.bytes)}) : 0, ${detailsBase.code_area.bytes / 1000000}
|
||||||
|
|
||||||
|
section Image heap
|
||||||
|
${recentBranch} (${bytesToHuman(detailsRecent.image_heap.bytes)}) : active, 0, ${detailsRecent.image_heap.bytes / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(detailsBase.image_heap.bytes)}) : 0, ${detailsBase.image_heap.bytes / 1000000}
|
||||||
|
|
||||||
|
section Other data
|
||||||
|
${recentBranch} (${bytesToHuman(otherBytesRecent)}) : active, 0, ${otherBytesRecent / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(otherBytesBase)}) : 0, ${otherBytesBase / 1000000}
|
||||||
|
|
||||||
|
section Total
|
||||||
|
${recentBranch} (${bytesToHuman(detailsRecent.total_bytes)}) : active, 0, ${detailsRecent.total_bytes / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(detailsBase.total_bytes)}) : 0, ${detailsBase.total_bytes / 1000000}
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
<em>Report generated by <a href="https://github.com/marketplace/actions/github-action-for-graalvm" target="_blank">setup-graalvm</a>.</em>`;
|
<em>Report generated by <a href="https://github.com/marketplace/actions/github-action-for-graalvm" target="_blank">setup-graalvm</a>.</em>`;
|
||||||
}
|
}
|
||||||
function createReport(data) {
|
function createReport(data) {
|
||||||
|
39
dist/main/index.js
generated
vendored
39
dist/main/index.js
generated
vendored
@ -74526,6 +74526,7 @@ const BYTES_TO_GiB = 1024 * 1024 * 1024;
|
|||||||
const DOCS_BASE = 'https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md';
|
const DOCS_BASE = 'https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md';
|
||||||
const INPUT_NI_JOB_REPORTS = 'native-image-job-reports';
|
const INPUT_NI_JOB_REPORTS = 'native-image-job-reports';
|
||||||
const INPUT_NI_PR_REPORTS = 'native-image-pr-reports';
|
const INPUT_NI_PR_REPORTS = 'native-image-pr-reports';
|
||||||
|
const INPUT_NI_PR_COMPARISON = 'native-image-pr-comparison';
|
||||||
const NATIVE_IMAGE_CONFIG_FILE = (0, path_1.join)((0, os_1.tmpdir)(), 'native-image-options.properties');
|
const NATIVE_IMAGE_CONFIG_FILE = (0, path_1.join)((0, os_1.tmpdir)(), 'native-image-options.properties');
|
||||||
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE';
|
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE';
|
||||||
function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion) {
|
function setUpNativeImageBuildReports(isGraalVMforJDK17OrLater, graalVMVersion) {
|
||||||
@ -74557,9 +74558,6 @@ function generateReports() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const buildOutput = JSON.parse(fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8'));
|
const buildOutput = JSON.parse(fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8'));
|
||||||
const treeSha = yield (0, utils_1.createTree)(JSON.stringify(buildOutput));
|
|
||||||
yield (0, utils_1.createRef)(treeSha);
|
|
||||||
const prMetrics = JSON.parse(yield (0, utils_1.getPrBaseBranchMetrics)());
|
|
||||||
const report = createReport(buildOutput);
|
const report = createReport(buildOutput);
|
||||||
if (areJobReportsEnabled()) {
|
if (areJobReportsEnabled()) {
|
||||||
core.summary.addRaw(report);
|
core.summary.addRaw(report);
|
||||||
@ -74568,8 +74566,12 @@ function generateReports() {
|
|||||||
if (arePRReportsEnabled()) {
|
if (arePRReportsEnabled()) {
|
||||||
yield (0, utils_1.createPRComment)(report);
|
yield (0, utils_1.createPRComment)(report);
|
||||||
}
|
}
|
||||||
const prBaseReport = createPRComparison(buildOutput, prMetrics);
|
const treeSha = yield (0, utils_1.createTree)(JSON.stringify(buildOutput));
|
||||||
yield (0, utils_1.createPRComment)(prBaseReport);
|
yield (0, utils_1.createRef)(treeSha);
|
||||||
|
if (arePRBaseComparisonEnabled()) {
|
||||||
|
const prMetrics = JSON.parse(yield (0, utils_1.getPrBaseBranchMetrics)());
|
||||||
|
yield (0, utils_1.createPRComment)(createPRComparison(buildOutput, prMetrics));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -74580,6 +74582,9 @@ function areJobReportsEnabled() {
|
|||||||
function arePRReportsEnabled() {
|
function arePRReportsEnabled() {
|
||||||
return (0, utils_1.isPREvent)() && core.getInput(INPUT_NI_PR_REPORTS) === 'true';
|
return (0, utils_1.isPREvent)() && core.getInput(INPUT_NI_PR_REPORTS) === 'true';
|
||||||
}
|
}
|
||||||
|
function arePRBaseComparisonEnabled() {
|
||||||
|
return (0, utils_1.isPREvent)() && core.getInput(INPUT_NI_PR_COMPARISON) === 'true';
|
||||||
|
}
|
||||||
function getNativeImageOptionsFile() {
|
function getNativeImageOptionsFile() {
|
||||||
let optionsFile = process.env[NATIVE_IMAGE_CONFIG_FILE_ENV];
|
let optionsFile = process.env[NATIVE_IMAGE_CONFIG_FILE_ENV];
|
||||||
if (optionsFile === undefined) {
|
if (optionsFile === undefined) {
|
||||||
@ -74647,6 +74652,30 @@ function createPRComparison(dataRecent, dataBase) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
\`\`\`mermaid
|
||||||
|
gantt
|
||||||
|
title Native Image Size Details
|
||||||
|
todayMarker off
|
||||||
|
dateFormat X
|
||||||
|
axisFormat %s
|
||||||
|
|
||||||
|
section Code area
|
||||||
|
${recentBranch} (${bytesToHuman(detailsRecent.code_area.bytes)}) : active, 0, ${detailsRecent.code_area.bytes / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(detailsBase.code_area.bytes)}) : 0, ${detailsBase.code_area.bytes / 1000000}
|
||||||
|
|
||||||
|
section Image heap
|
||||||
|
${recentBranch} (${bytesToHuman(detailsRecent.image_heap.bytes)}) : active, 0, ${detailsRecent.image_heap.bytes / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(detailsBase.image_heap.bytes)}) : 0, ${detailsBase.image_heap.bytes / 1000000}
|
||||||
|
|
||||||
|
section Other data
|
||||||
|
${recentBranch} (${bytesToHuman(otherBytesRecent)}) : active, 0, ${otherBytesRecent / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(otherBytesBase)}) : 0, ${otherBytesBase / 1000000}
|
||||||
|
|
||||||
|
section Total
|
||||||
|
${recentBranch} (${bytesToHuman(detailsRecent.total_bytes)}) : active, 0, ${detailsRecent.total_bytes / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(detailsBase.total_bytes)}) : 0, ${detailsBase.total_bytes / 1000000}
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
<em>Report generated by <a href="https://github.com/marketplace/actions/github-action-for-graalvm" target="_blank">setup-graalvm</a>.</em>`;
|
<em>Report generated by <a href="https://github.com/marketplace/actions/github-action-for-graalvm" target="_blank">setup-graalvm</a>.</em>`;
|
||||||
}
|
}
|
||||||
function createReport(data) {
|
function createReport(data) {
|
||||||
|
@ -15,6 +15,7 @@ const DOCS_BASE =
|
|||||||
'https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md'
|
'https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md'
|
||||||
const INPUT_NI_JOB_REPORTS = 'native-image-job-reports'
|
const INPUT_NI_JOB_REPORTS = 'native-image-job-reports'
|
||||||
const INPUT_NI_PR_REPORTS = 'native-image-pr-reports'
|
const INPUT_NI_PR_REPORTS = 'native-image-pr-reports'
|
||||||
|
const INPUT_NI_PR_COMPARISON = 'native-image-pr-comparison'
|
||||||
const NATIVE_IMAGE_CONFIG_FILE = join(
|
const NATIVE_IMAGE_CONFIG_FILE = join(
|
||||||
tmpdir(),
|
tmpdir(),
|
||||||
'native-image-options.properties'
|
'native-image-options.properties'
|
||||||
@ -128,12 +129,6 @@ export async function generateReports(): Promise<void> {
|
|||||||
fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8')
|
fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8')
|
||||||
)
|
)
|
||||||
|
|
||||||
const treeSha = await createTree(JSON.stringify(buildOutput))
|
|
||||||
await createRef(treeSha)
|
|
||||||
const prMetrics: BuildOutput = JSON.parse(
|
|
||||||
await getPrBaseBranchMetrics()
|
|
||||||
)
|
|
||||||
|
|
||||||
const report = createReport(buildOutput)
|
const report = createReport(buildOutput)
|
||||||
if (areJobReportsEnabled()) {
|
if (areJobReportsEnabled()) {
|
||||||
core.summary.addRaw(report)
|
core.summary.addRaw(report)
|
||||||
@ -142,8 +137,14 @@ export async function generateReports(): Promise<void> {
|
|||||||
if (arePRReportsEnabled()) {
|
if (arePRReportsEnabled()) {
|
||||||
await createPRComment(report)
|
await createPRComment(report)
|
||||||
}
|
}
|
||||||
const prBaseReport = createPRComparison(buildOutput, prMetrics)
|
const treeSha = await createTree(JSON.stringify(buildOutput))
|
||||||
await createPRComment(prBaseReport)
|
await createRef(treeSha)
|
||||||
|
if (arePRBaseComparisonEnabled()) {
|
||||||
|
const prMetrics: BuildOutput = JSON.parse(
|
||||||
|
await getPrBaseBranchMetrics()
|
||||||
|
)
|
||||||
|
await createPRComment(createPRComparison(buildOutput, prMetrics))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,6 +156,10 @@ function arePRReportsEnabled(): boolean {
|
|||||||
return isPREvent() && core.getInput(INPUT_NI_PR_REPORTS) === 'true'
|
return isPREvent() && core.getInput(INPUT_NI_PR_REPORTS) === 'true'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function arePRBaseComparisonEnabled(): boolean {
|
||||||
|
return isPREvent() && core.getInput(INPUT_NI_PR_COMPARISON) === 'true'
|
||||||
|
}
|
||||||
|
|
||||||
function getNativeImageOptionsFile(): string {
|
function getNativeImageOptionsFile(): string {
|
||||||
let optionsFile = process.env[NATIVE_IMAGE_CONFIG_FILE_ENV]
|
let optionsFile = process.env[NATIVE_IMAGE_CONFIG_FILE_ENV]
|
||||||
if (optionsFile === undefined) {
|
if (optionsFile === undefined) {
|
||||||
@ -228,6 +233,30 @@ function createPRComparison(dataRecent: BuildOutput, dataBase: BuildOutput): str
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
\`\`\`mermaid
|
||||||
|
gantt
|
||||||
|
title Native Image Size Details
|
||||||
|
todayMarker off
|
||||||
|
dateFormat X
|
||||||
|
axisFormat %s
|
||||||
|
|
||||||
|
section Code area
|
||||||
|
${recentBranch} (${bytesToHuman(detailsRecent.code_area.bytes)}) : active, 0, ${detailsRecent.code_area.bytes / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(detailsBase.code_area.bytes)}) : 0, ${detailsBase.code_area.bytes / 1000000}
|
||||||
|
|
||||||
|
section Image heap
|
||||||
|
${recentBranch} (${bytesToHuman(detailsRecent.image_heap.bytes)}) : active, 0, ${detailsRecent.image_heap.bytes / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(detailsBase.image_heap.bytes)}) : 0, ${detailsBase.image_heap.bytes / 1000000}
|
||||||
|
|
||||||
|
section Other data
|
||||||
|
${recentBranch} (${bytesToHuman(otherBytesRecent)}) : active, 0, ${otherBytesRecent / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(otherBytesBase)}) : 0, ${otherBytesBase / 1000000}
|
||||||
|
|
||||||
|
section Total
|
||||||
|
${recentBranch} (${bytesToHuman(detailsRecent.total_bytes)}) : active, 0, ${detailsRecent.total_bytes / 1000000}
|
||||||
|
${baseBranch} (${bytesToHuman(detailsBase.total_bytes)}) : 0, ${detailsBase.total_bytes / 1000000}
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
<em>Report generated by <a href="https://github.com/marketplace/actions/github-action-for-graalvm" target="_blank">setup-graalvm</a>.</em>`
|
<em>Report generated by <a href="https://github.com/marketplace/actions/github-action-for-graalvm" target="_blank">setup-graalvm</a>.</em>`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user