undone changes

This commit is contained in:
jpaul 2023-11-13 06:09:54 +01:00
parent 19c4b6ca84
commit 621295feb1
4 changed files with 72 additions and 72 deletions

2
dist/cleanup/index.js generated vendored
View File

@ -74451,7 +74451,7 @@ 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'));
yield (0, utils_1.saveReportJson)(JSON.stringify(buildOutput)); (0, utils_1.saveReportJson)(JSON.stringify(buildOutput));
const report = createReport(buildOutput); const report = createReport(buildOutput);
if (areJobReportsEnabled()) { if (areJobReportsEnabled()) {
core.summary.addRaw(report); core.summary.addRaw(report);

2
dist/main/index.js generated vendored
View File

@ -74550,7 +74550,7 @@ 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'));
yield (0, utils_1.saveReportJson)(JSON.stringify(buildOutput)); (0, utils_1.saveReportJson)(JSON.stringify(buildOutput));
const report = createReport(buildOutput); const report = createReport(buildOutput);
if (areJobReportsEnabled()) { if (areJobReportsEnabled()) {
core.summary.addRaw(report); core.summary.addRaw(report);

View File

@ -15,12 +15,12 @@ const BYTES_TO_KiB = 1024
const BYTES_TO_MiB = 1024 * 1024 const BYTES_TO_MiB = 1024 * 1024
const BYTES_TO_GiB = 1024 * 1024 * 1024 const BYTES_TO_GiB = 1024 * 1024 * 1024
const DOCS_BASE = 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 NATIVE_IMAGE_CONFIG_FILE = join( const NATIVE_IMAGE_CONFIG_FILE = join(
tmpdir(), tmpdir(),
'native-image-options.properties' 'native-image-options.properties'
) )
const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE' const NATIVE_IMAGE_CONFIG_FILE_ENV = 'NATIVE_IMAGE_CONFIG_FILE'
//const { Octokit } = require("@octokit/rest"); //const { Octokit } = require("@octokit/rest");
@ -96,28 +96,28 @@ interface BuildOutput {
} }
export async function setUpNativeImageBuildReports( export async function setUpNativeImageBuildReports(
isGraalVMforJDK17OrLater: boolean, isGraalVMforJDK17OrLater: boolean,
graalVMVersion: string, graalVMVersion: string,
reportToken: string reportToken: string
): Promise<void> { ): Promise<void> {
const isRequired = areJobReportsEnabled() || arePRReportsEnabled() const isRequired = areJobReportsEnabled() || arePRReportsEnabled()
if (!isRequired) { if (!isRequired) {
return return
} }
const isSupported = const isSupported =
isGraalVMforJDK17OrLater || isGraalVMforJDK17OrLater ||
graalVMVersion === c.VERSION_LATEST || graalVMVersion === c.VERSION_LATEST ||
graalVMVersion === c.VERSION_DEV || graalVMVersion === c.VERSION_DEV ||
(!graalVMVersion.startsWith(c.MANDREL_NAMESPACE) && (!graalVMVersion.startsWith(c.MANDREL_NAMESPACE) &&
gte(toSemVer(graalVMVersion), '22.2.0')) gte(toSemVer(graalVMVersion), '22.2.0'))
if (!isSupported) { if (!isSupported) {
core.warning( core.warning(
`Build reports for PRs and job summaries are only available in GraalVM 22.2.0 or later. This build job uses GraalVM ${graalVMVersion}.` `Build reports for PRs and job summaries are only available in GraalVM 22.2.0 or later. This build job uses GraalVM ${graalVMVersion}.`
) )
return return
} }
setNativeImageOption( setNativeImageOption(
`-H:BuildOutputJSONFile=${BUILD_OUTPUT_JSON_PATH.replace(/\\/g, '\\\\')}` `-H:BuildOutputJSONFile=${BUILD_OUTPUT_JSON_PATH.replace(/\\/g, '\\\\')}`
)// Escape backslashes for Windows )// Escape backslashes for Windows
REPORT_TOKEN = reportToken REPORT_TOKEN = reportToken
} }
@ -126,15 +126,15 @@ export async function generateReports(): Promise<void> {
if (areJobReportsEnabled() || arePRReportsEnabled()) { if (areJobReportsEnabled() || arePRReportsEnabled()) {
if (!fs.existsSync(BUILD_OUTPUT_JSON_PATH)) { if (!fs.existsSync(BUILD_OUTPUT_JSON_PATH)) {
core.warning( core.warning(
'Unable to find build output data to create a report. Are you sure this build job has used GraalVM Native Image?' 'Unable to find build output data to create a report. Are you sure this build job has used GraalVM Native Image?'
) )
return return
} }
const buildOutput: BuildOutput = JSON.parse( const buildOutput: BuildOutput = JSON.parse(
fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8') fs.readFileSync(BUILD_OUTPUT_JSON_PATH, 'utf8')
) )
await saveReportJson(JSON.stringify(buildOutput)) saveReportJson(JSON.stringify(buildOutput))
const report = createReport(buildOutput) const report = createReport(buildOutput)
if (areJobReportsEnabled()) { if (areJobReportsEnabled()) {
@ -185,10 +185,10 @@ function createReport(data: BuildOutput): string {
} }
const debugInfoBytes = details.debug_info ? details.debug_info.bytes : 0 const debugInfoBytes = details.debug_info ? details.debug_info.bytes : 0
const otherBytes = const otherBytes =
details.total_bytes - details.total_bytes -
details.code_area.bytes - details.code_area.bytes -
details.image_heap.bytes - details.image_heap.bytes -
debugInfoBytes debugInfoBytes
let debugInfoLine = '' let debugInfoLine = ''
if (details.debug_info) { if (details.debug_info) {
debugInfoLine = ` debugInfoLine = `
@ -221,7 +221,7 @@ function createReport(data: BuildOutput): string {
if (info.graal_compiler) { if (info.graal_compiler) {
let pgoSuffix = '' let pgoSuffix = ''
const isOracleGraalVM = const isOracleGraalVM =
info.vendor_version && info.vendor_version.includes('Oracle GraalVM') info.vendor_version && info.vendor_version.includes('Oracle GraalVM')
if (isOracleGraalVM) { if (isOracleGraalVM) {
const pgo = info.graal_compiler.pgo const pgo = info.graal_compiler.pgo
const pgoText = pgo ? pgo.join('+') : 'off' const pgoText = pgo ? pgo.join('+') : 'off'
@ -244,17 +244,17 @@ function createReport(data: BuildOutput): string {
if (resources.total_secs) { if (resources.total_secs) {
totalTime = ` in ${secondsToHuman(resources.total_secs)}` totalTime = ` in ${secondsToHuman(resources.total_secs)}`
gcTotalTimeRatio = ` (${toPercent( gcTotalTimeRatio = ` (${toPercent(
resources.garbage_collection.total_secs, resources.garbage_collection.total_secs,
resources.total_secs resources.total_secs
)} of total time)` )} of total time)`
} }
return `## GraalVM Native Image Build Report example return `## GraalVM Native Image Build Report example
\`${info.name}\` generated${totalTime} as part of the '${ \`${info.name}\` generated${totalTime} as part of the '${
context.job context.job
}' job in run <a href="${context.serverUrl}/${context.repo.owner}/${ }' job in run <a href="${context.serverUrl}/${context.repo.owner}/${
context.repo.repo context.repo.repo
}/actions/runs/${context.runId}" target="_blank">#${context.runNumber}</a>. }/actions/runs/${context.runId}" target="_blank">#${context.runNumber}</a>.
#### Environment #### Environment
@ -289,55 +289,55 @@ function createReport(data: BuildOutput): string {
<td align="left"><a href="${DOCS_BASE}#glossary-reachability" target="_blank">Reachable</a></td> <td align="left"><a href="${DOCS_BASE}#glossary-reachability" target="_blank">Reachable</a></td>
<td align="right">${analysisTypes.reachable.toLocaleString()}</td> <td align="right">${analysisTypes.reachable.toLocaleString()}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
analysisTypes.reachable, analysisTypes.reachable,
analysisTypes.total analysisTypes.total
)}</td> )}</td>
<td align="right">${analysis.fields.reachable.toLocaleString()}</td> <td align="right">${analysis.fields.reachable.toLocaleString()}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
analysis.fields.reachable, analysis.fields.reachable,
analysis.fields.total analysis.fields.total
)}</td> )}</td>
<td align="right">${analysis.methods.reachable.toLocaleString()}</td> <td align="right">${analysis.methods.reachable.toLocaleString()}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
analysis.methods.reachable, analysis.methods.reachable,
analysis.methods.total analysis.methods.total
)}</td> )}</td>
</tr> </tr>
<tr> <tr>
<td align="left"><a href="${DOCS_BASE}#glossary-reflection-registrations" target="_blank">Reflection</a></td> <td align="left"><a href="${DOCS_BASE}#glossary-reflection-registrations" target="_blank">Reflection</a></td>
<td align="right">${analysisTypes.reflection.toLocaleString()}</td> <td align="right">${analysisTypes.reflection.toLocaleString()}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
analysisTypes.reflection, analysisTypes.reflection,
analysisTypes.total analysisTypes.total
)}</td> )}</td>
<td align="right">${analysis.fields.reflection.toLocaleString()}</td> <td align="right">${analysis.fields.reflection.toLocaleString()}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
analysis.fields.reflection, analysis.fields.reflection,
analysis.fields.total analysis.fields.total
)}</td> )}</td>
<td align="right">${analysis.methods.reflection.toLocaleString()}</td> <td align="right">${analysis.methods.reflection.toLocaleString()}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
analysis.methods.reflection, analysis.methods.reflection,
analysis.methods.total analysis.methods.total
)}</td> )}</td>
</tr> </tr>
<tr> <tr>
<td align="left"><a href="${DOCS_BASE}#glossary-jni-access-registrations" target="_blank">JNI</a></td> <td align="left"><a href="${DOCS_BASE}#glossary-jni-access-registrations" target="_blank">JNI</a></td>
<td align="right">${analysisTypes.jni.toLocaleString()}</td> <td align="right">${analysisTypes.jni.toLocaleString()}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
analysisTypes.jni, analysisTypes.jni,
analysisTypes.total analysisTypes.total
)}</td> )}</td>
<td align="right">${analysis.fields.jni.toLocaleString()}</td> <td align="right">${analysis.fields.jni.toLocaleString()}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
analysis.fields.jni, analysis.fields.jni,
analysis.fields.total analysis.fields.total
)}</td> )}</td>
<td align="right">${analysis.methods.jni.toLocaleString()}</td> <td align="right">${analysis.methods.jni.toLocaleString()}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
analysis.methods.jni, analysis.methods.jni,
analysis.methods.total analysis.methods.total
)}</td> )}</td>
</tr> </tr>
<tr> <tr>
<td align="left"><a href="${DOCS_BASE}#glossary-reachability" target="_blank">Loaded</a></td> <td align="left"><a href="${DOCS_BASE}#glossary-reachability" target="_blank">Loaded</a></td>
@ -367,20 +367,20 @@ function createReport(data: BuildOutput): string {
<td align="left"><a href="${DOCS_BASE}#glossary-code-area" target="_blank">Code area</a></td> <td align="left"><a href="${DOCS_BASE}#glossary-code-area" target="_blank">Code area</a></td>
<td align="right">${bytesToHuman(details.code_area.bytes)}</td> <td align="right">${bytesToHuman(details.code_area.bytes)}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
details.code_area.bytes, details.code_area.bytes,
details.total_bytes details.total_bytes
)}</td> )}</td>
<td align="left">${details.code_area.compilation_units.toLocaleString()} compilation units</td> <td align="left">${details.code_area.compilation_units.toLocaleString()} compilation units</td>
</tr> </tr>
<tr> <tr>
<td align="left"><a href="${DOCS_BASE}#glossary-image-heap" target="_blank">Image heap</a></td> <td align="left"><a href="${DOCS_BASE}#glossary-image-heap" target="_blank">Image heap</a></td>
<td align="right">${bytesToHuman(details.image_heap.bytes)}</td> <td align="right">${bytesToHuman(details.image_heap.bytes)}</td>
<td align="right">${toPercent( <td align="right">${toPercent(
details.image_heap.bytes, details.image_heap.bytes,
details.total_bytes details.total_bytes
)}</td> )}</td>
<td align="left">${objectCount}${bytesToHuman( <td align="left">${objectCount}${bytesToHuman(
details.image_heap.resources.bytes details.image_heap.resources.bytes
)} for ${details.image_heap.resources.count.toLocaleString()} resources</td> )} for ${details.image_heap.resources.count.toLocaleString()} resources</td>
</tr>${debugInfoLine} </tr>${debugInfoLine}
<tr> <tr>
@ -392,8 +392,8 @@ function createReport(data: BuildOutput): string {
<tr> <tr>
<td align="left">Total</td> <td align="left">Total</td>
<td align="right"><strong>${bytesToHuman( <td align="right"><strong>${bytesToHuman(
details.total_bytes details.total_bytes
)}</strong></td> )}</strong></td>
<td align="right">100.000%</td> <td align="right">100.000%</td>
<td align="left"></td> <td align="left"></td>
</tr> </tr>
@ -407,23 +407,23 @@ function createReport(data: BuildOutput): string {
<tr> <tr>
<td align="left"><a href="${DOCS_BASE}#glossary-garbage-collections" target="_blank">Garbage collection</a></td> <td align="left"><a href="${DOCS_BASE}#glossary-garbage-collections" target="_blank">Garbage collection</a></td>
<td align="left">${resources.garbage_collection.total_secs.toFixed( <td align="left">${resources.garbage_collection.total_secs.toFixed(
2 2
)}s${gcTotalTimeRatio} in ${resources.garbage_collection.count} GCs</td> )}s${gcTotalTimeRatio} in ${resources.garbage_collection.count} GCs</td>
</tr> </tr>
<tr> <tr>
<td align="left"><a href="${DOCS_BASE}#glossary-peak-rss" target="_blank">Peak RSS</a></td> <td align="left"><a href="${DOCS_BASE}#glossary-peak-rss" target="_blank">Peak RSS</a></td>
<td align="left">${bytesToHuman( <td align="left">${bytesToHuman(
resources.memory.peak_rss_bytes resources.memory.peak_rss_bytes
)} (${toPercent( )} (${toPercent(
resources.memory.peak_rss_bytes, resources.memory.peak_rss_bytes,
resources.memory.system_total resources.memory.system_total
)} of ${bytesToHuman(resources.memory.system_total)} system memory)</td> )} of ${bytesToHuman(resources.memory.system_total)} system memory)</td>
</tr> </tr>
<tr> <tr>
<td align="left"><a href="${DOCS_BASE}#glossary-cpu-load" target="_blank">CPU load</a></td> <td align="left"><a href="${DOCS_BASE}#glossary-cpu-load" target="_blank">CPU load</a></td>
<td align="left">${resources.cpu.load.toFixed(3)} (${toPercent( <td align="left">${resources.cpu.load.toFixed(3)} (${toPercent(
resources.cpu.load, resources.cpu.load,
resources.cpu.total_cores resources.cpu.total_cores
)} of ${resources.cpu.total_cores} CPU cores)</td> )} of ${resources.cpu.total_cores} CPU cores)</td>
</tr> </tr>
</tbody> </tbody>

View File

@ -211,4 +211,4 @@ export async function saveReportJson(content: string): Promise<void> {
`Failed to create pull request comment. Please make sure this job has 'write' permissions for the 'pull-requests' scope (see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions)? Internal error: ${err}` `Failed to create pull request comment. Please make sure this job has 'write' permissions for the 'pull-requests' scope (see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions)? Internal error: ${err}`
) )
} }
} }