mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
GAME_CI_BUILD_SUCCESS and GAME_CI_STEP_SUMMARY
This commit is contained in:
parent
2190fd5667
commit
4dd5a3fb85
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
@ -1,4 +1,5 @@
|
|||||||
import { getExecOutput, ExecOptions } from '@actions/exec';
|
import { getExecOutput, ExecOptions } from '@actions/exec';
|
||||||
|
import { summary } from '@actions/core';
|
||||||
|
|
||||||
export async function execWithErrorCheck(
|
export async function execWithErrorCheck(
|
||||||
commandLine: string,
|
commandLine: string,
|
||||||
@ -12,18 +13,35 @@ export async function execWithErrorCheck(
|
|||||||
return result.exitCode;
|
return result.exitCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for errors in the Build Results section
|
// Check for errors in the Unity Build Results section
|
||||||
const match = result.stdout.match(/^#\s*Build results\s*#(.*)^Size:/ms);
|
const unityMatch = result.stdout.match(/^#\s*Build results\s*#(.*)^Size:/ms);
|
||||||
|
|
||||||
if (match) {
|
if (unityMatch) {
|
||||||
const buildResults = match[1];
|
const buildResults = unityMatch[1];
|
||||||
const errorMatch = buildResults.match(/^Errors:\s*(\d+)$/m);
|
const errorMatch = buildResults.match(/^Errors:\s*(\d+)$/m);
|
||||||
if (errorMatch && Number.parseInt(errorMatch[1], 10) !== 0) {
|
if (errorMatch && Number.parseInt(errorMatch[1], 10) !== 0) {
|
||||||
throw new Error(`There was an error building the project. Please read the logs for details.`);
|
throw new Error(`There was an error building the project. Please read the logs for details.`);
|
||||||
}
|
}
|
||||||
} else {
|
await summary.addHeading('Build Results').addQuote(unityMatch[0]).write();
|
||||||
throw new Error(`There was an error building the project. Please read the logs for details.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.exitCode;
|
return result.exitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for presence of game-ci message(s)
|
||||||
|
const gameciMatch = result.stdout.match(/^GAME_CI_BUILD_SUCCESS$/ms);
|
||||||
|
|
||||||
|
if (gameciMatch) {
|
||||||
|
const quote =
|
||||||
|
result.stdout
|
||||||
|
.match(/^GAME_CI_STEP_SUMMARY.*$/gm)
|
||||||
|
?.map((x) => x.replace('GAME_CI_STEP_SUMMARY', ''))
|
||||||
|
.join('\n\n') ?? '<No GAME_CI_STEP_SUMMARY messages found>';
|
||||||
|
await summary.addHeading('Build Results').addQuote(quote).write();
|
||||||
|
|
||||||
|
return result.exitCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(
|
||||||
|
`There was an error building the project. Did not find success messages in logs (either Unity's build results or GAME_CI_BUILD_SUCCESS).`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user