Compare commits
5 Commits
Author | SHA1 | Date |
---|---|---|
|
61fd9aa167 | |
|
0483262850 | |
|
05a00ef5ac | |
|
0ff419b913 | |
|
e0e796f3d9 |
|
@ -45,7 +45,7 @@ GameCI is free for everyone forever.
|
||||||
|
|
||||||
You can support us at [OpenCollective](https://opencollective.com/game-ci).
|
You can support us at [OpenCollective](https://opencollective.com/game-ci).
|
||||||
|
|
||||||
## Licence
|
## License
|
||||||
|
|
||||||
This repository is [MIT](./LICENSE) licensed.
|
This repository is [MIT](./LICENSE) licensed.
|
||||||
|
|
||||||
|
|
|
@ -1014,9 +1014,19 @@ const ResultsCheck = {
|
||||||
if (!filepath.endsWith('.xml'))
|
if (!filepath.endsWith('.xml'))
|
||||||
return;
|
return;
|
||||||
core.info(`Processing file ${filepath}...`);
|
core.info(`Processing file ${filepath}...`);
|
||||||
const fileData = yield results_parser_1.default.parseResults(path_1.default.join(artifactsPath, filepath));
|
try {
|
||||||
core.info(fileData.summary);
|
const content = fs.readFileSync(path_1.default.join(artifactsPath, filepath), 'utf8');
|
||||||
runs.push(fileData);
|
if (!content.includes('<test-results') && !content.includes('<test-run')) {
|
||||||
|
// noinspection ExceptionCaughtLocallyJS
|
||||||
|
throw new Error('File does not appear to be a NUnit XML file');
|
||||||
|
}
|
||||||
|
const fileData = yield results_parser_1.default.parseResults(path_1.default.join(artifactsPath, filepath));
|
||||||
|
core.info(fileData.summary);
|
||||||
|
runs.push(fileData);
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.warning(`Failed to parse ${filepath}: ${error.message}`);
|
||||||
|
}
|
||||||
})));
|
})));
|
||||||
// Combine all results into a single run summary
|
// Combine all results into a single run summary
|
||||||
const runSummary = new results_meta_1.RunMeta(checkName);
|
const runSummary = new results_meta_1.RunMeta(checkName);
|
||||||
|
@ -1063,10 +1073,12 @@ const ResultsCheck = {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const pullRequest = github.context.payload.pull_request;
|
const pullRequest = github.context.payload.pull_request;
|
||||||
const headSha = (pullRequest && pullRequest.head.sha) || github.context.sha;
|
const headSha = (pullRequest && pullRequest.head.sha) || github.context.sha;
|
||||||
|
// Check max length for https://github.com/game-ci/unity-test-runner/issues/214
|
||||||
const maxLength = 65534;
|
const maxLength = 65534;
|
||||||
if (output.length > maxLength) {
|
if (output.text.length > maxLength) {
|
||||||
core.warning(`Output too long (${output.length}) truncating to ${maxLength}`);
|
core.warning(`Test details of ${output.text.length} surpass limit of ${maxLength}`);
|
||||||
output = output.slice(0, maxLength);
|
output.text =
|
||||||
|
'Test details omitted from GitHub UI due to length. See console logs for details.';
|
||||||
}
|
}
|
||||||
core.info(`Posting results for ${headSha}`);
|
core.info(`Posting results for ${headSha}`);
|
||||||
const createCheckRequest = Object.assign(Object.assign({}, github.context.repo), { name: checkName, head_sha: headSha, status: 'completed', conclusion: 'neutral', output });
|
const createCheckRequest = Object.assign(Object.assign({}, github.context.repo), { name: checkName, head_sha: headSha, status: 'completed', conclusion: 'neutral', output });
|
||||||
|
@ -1368,12 +1380,13 @@ const ResultsParser = {
|
||||||
return testMeta;
|
return testMeta;
|
||||||
},
|
},
|
||||||
findAnnotationPoint(trace) {
|
findAnnotationPoint(trace) {
|
||||||
|
const regex = /at(?: .* in)? ((?<path>[^:]+):(?<line>\d+))/;
|
||||||
// Find first entry with non-zero line number in stack trace
|
// Find first entry with non-zero line number in stack trace
|
||||||
const items = trace.match(/at .* in ((?<path>[^:]+):(?<line>\d+))/g);
|
const items = trace.match(new RegExp(regex, 'g'));
|
||||||
if (Array.isArray(items)) {
|
if (Array.isArray(items)) {
|
||||||
const result = [];
|
const result = [];
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
const match = item.match(/at .* in ((?<path>[^:]+):(?<line>\d+))/);
|
const match = item.match(regex);
|
||||||
const point = {
|
const point = {
|
||||||
path: match ? match.groups.path : '',
|
path: match ? match.groups.path : '',
|
||||||
line: match ? Number(match.groups.line) : 0,
|
line: match ? Number(match.groups.line) : 0,
|
||||||
|
@ -1387,7 +1400,7 @@ const ResultsParser = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If all entries have zero line number match fallback pattern
|
// If all entries have zero line number match fallback pattern
|
||||||
const match = trace.match(/at .* in ((?<path>[^:]+):(?<line>\d+))/);
|
const match = trace.match(regex);
|
||||||
return {
|
return {
|
||||||
path: match ? match.groups.path : '',
|
path: match ? match.groups.path : '',
|
||||||
line: match ? Number(match.groups.line) : 0,
|
line: match ? Number(match.groups.line) : 0,
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -65,7 +65,14 @@ elif [[ -n "$UNITY_LICENSING_SERVER" ]]; then
|
||||||
FLOATING_LICENSE=$(sed -n 2p <<< "$PARSEDFILE")
|
FLOATING_LICENSE=$(sed -n 2p <<< "$PARSEDFILE")
|
||||||
FLOATING_LICENSE_TIMEOUT=$(sed -n 4p <<< "$PARSEDFILE")
|
FLOATING_LICENSE_TIMEOUT=$(sed -n 4p <<< "$PARSEDFILE")
|
||||||
|
|
||||||
echo "Acquired floating license: \"$FLOATING_LICENSE\" with timeout $FLOATING_LICENSE_TIMEOUT"
|
if [[ -z "$FLOATING_LICENSE" || -z "$FLOATING_LICENSE_TIMEOUT" ]]; then
|
||||||
|
echo "::error ::Failed to acquire floating license from Unity Licensing Server."
|
||||||
|
echo "Check the activation log below for more details."
|
||||||
|
cat license.txt
|
||||||
|
else
|
||||||
|
echo "Acquired floating license: \"$FLOATING_LICENSE\" with timeout $FLOATING_LICENSE_TIMEOUT"
|
||||||
|
fi
|
||||||
|
|
||||||
# Store the exit code from the verify command
|
# Store the exit code from the verify command
|
||||||
else
|
else
|
||||||
#
|
#
|
||||||
|
|
|
@ -22,9 +22,18 @@ const ResultsCheck = {
|
||||||
files.map(async filepath => {
|
files.map(async filepath => {
|
||||||
if (!filepath.endsWith('.xml')) return;
|
if (!filepath.endsWith('.xml')) return;
|
||||||
core.info(`Processing file ${filepath}...`);
|
core.info(`Processing file ${filepath}...`);
|
||||||
const fileData = await ResultsParser.parseResults(path.join(artifactsPath, filepath));
|
try {
|
||||||
core.info(fileData.summary);
|
const content = fs.readFileSync(path.join(artifactsPath, filepath), 'utf8');
|
||||||
runs.push(fileData);
|
if (!content.includes('<test-run')) {
|
||||||
|
// noinspection ExceptionCaughtLocallyJS
|
||||||
|
throw new Error('File does not appear to be a NUnit XML file');
|
||||||
|
}
|
||||||
|
const fileData = await ResultsParser.parseResults(path.join(artifactsPath, filepath));
|
||||||
|
core.info(fileData.summary);
|
||||||
|
runs.push(fileData);
|
||||||
|
} catch (error: any) {
|
||||||
|
core.warning(`Failed to parse ${filepath}: ${error.message}`);
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -76,10 +85,12 @@ const ResultsCheck = {
|
||||||
const pullRequest = github.context.payload.pull_request;
|
const pullRequest = github.context.payload.pull_request;
|
||||||
const headSha = (pullRequest && pullRequest.head.sha) || github.context.sha;
|
const headSha = (pullRequest && pullRequest.head.sha) || github.context.sha;
|
||||||
|
|
||||||
|
// Check max length for https://github.com/game-ci/unity-test-runner/issues/214
|
||||||
const maxLength = 65_534;
|
const maxLength = 65_534;
|
||||||
if (output.length > maxLength) {
|
if (output.text.length > maxLength) {
|
||||||
core.warning(`Output too long (${output.length}) truncating to ${maxLength}`);
|
core.warning(`Test details of ${output.text.length} surpass limit of ${maxLength}`);
|
||||||
output = output.slice(0, maxLength);
|
output.text =
|
||||||
|
'Test details omitted from GitHub UI due to length. See console logs for details.';
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info(`Posting results for ${headSha}`);
|
core.info(`Posting results for ${headSha}`);
|
||||||
|
|
|
@ -248,5 +248,13 @@ at Tests.SetupFailedTest.SetUp () [0x00000] in /github/workspace/unity-project/A
|
||||||
expect(result.path).toBe('/github/workspace/unity-project/Assets/Tests/SetupFailedTest.cs');
|
expect(result.path).toBe('/github/workspace/unity-project/Assets/Tests/SetupFailedTest.cs');
|
||||||
expect(result.line).toBe(10);
|
expect(result.line).toBe(10);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Debug.LogError annotation point', () => {
|
||||||
|
const result = ResultsParser.findAnnotationPoint(
|
||||||
|
`FMODUnity.RuntimeUtils:DebugLogError (string) (at Assets/Plugins/FMOD/src/RuntimeUtils.cs:580)`,
|
||||||
|
);
|
||||||
|
expect(result.path).toBe('Assets/Plugins/FMOD/src/RuntimeUtils.cs');
|
||||||
|
expect(result.line).toBe(580);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -127,12 +127,13 @@ const ResultsParser = {
|
||||||
},
|
},
|
||||||
|
|
||||||
findAnnotationPoint(trace) {
|
findAnnotationPoint(trace) {
|
||||||
|
const regex = /at(?: .* in)? ((?<path>[^:]+):(?<line>\d+))/;
|
||||||
// Find first entry with non-zero line number in stack trace
|
// Find first entry with non-zero line number in stack trace
|
||||||
const items = trace.match(/at .* in ((?<path>[^:]+):(?<line>\d+))/g);
|
const items = trace.match(new RegExp(regex, 'g'));
|
||||||
if (Array.isArray(items)) {
|
if (Array.isArray(items)) {
|
||||||
const result: { path: any; line: number }[] = [];
|
const result: { path: any; line: number }[] = [];
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
const match = item.match(/at .* in ((?<path>[^:]+):(?<line>\d+))/);
|
const match = item.match(regex);
|
||||||
const point = {
|
const point = {
|
||||||
path: match ? match.groups.path : '',
|
path: match ? match.groups.path : '',
|
||||||
line: match ? Number(match.groups.line) : 0,
|
line: match ? Number(match.groups.line) : 0,
|
||||||
|
@ -146,7 +147,7 @@ const ResultsParser = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If all entries have zero line number match fallback pattern
|
// If all entries have zero line number match fallback pattern
|
||||||
const match = trace.match(/at .* in ((?<path>[^:]+):(?<line>\d+))/);
|
const match = trace.match(regex);
|
||||||
return {
|
return {
|
||||||
path: match ? match.groups.path : '',
|
path: match ? match.groups.path : '',
|
||||||
line: match ? Number(match.groups.line) : 0,
|
line: match ? Number(match.groups.line) : 0,
|
||||||
|
|
Loading…
Reference in New Issue