2022-05-04 23:25:17 +00:00
|
|
|
import CloudRunnerLogger from './cloud-runner-logger';
|
|
|
|
|
import * as core from '@actions/core';
|
|
|
|
|
import CloudRunner from '../cloud-runner';
|
|
|
|
|
import { CloudRunnerStatics } from '../cloud-runner-statics';
|
|
|
|
|
|
|
|
|
|
export class FollowLogStreamService {
|
|
|
|
|
public static handleIteration(message, shouldReadLogs, shouldCleanup, output) {
|
|
|
|
|
if (message.includes(`---${CloudRunner.buildParameters.logId}`)) {
|
|
|
|
|
CloudRunnerLogger.log('End of log transmission received');
|
|
|
|
|
shouldReadLogs = false;
|
|
|
|
|
} else if (message.includes('Rebuilding Library because the asset database could not be found!')) {
|
|
|
|
|
core.warning('LIBRARY NOT FOUND!');
|
|
|
|
|
core.setOutput('library-found', 'false');
|
|
|
|
|
} else if (message.includes('Build succeeded')) {
|
|
|
|
|
core.setOutput('build-result', 'success');
|
|
|
|
|
} else if (message.includes('Build fail')) {
|
|
|
|
|
core.setOutput('build-result', 'failed');
|
|
|
|
|
core.setFailed('unity build failed');
|
|
|
|
|
core.error('BUILD FAILED!');
|
2022-11-07 20:41:00 +00:00
|
|
|
} else if (CloudRunner.buildParameters.cloudRunnerDebug && message.includes(': Listening for Jobs')) {
|
2022-05-04 23:25:17 +00:00
|
|
|
core.setOutput('cloud runner stop watching', 'true');
|
|
|
|
|
shouldReadLogs = false;
|
|
|
|
|
shouldCleanup = false;
|
|
|
|
|
core.warning('cloud runner stop watching');
|
|
|
|
|
}
|
2022-11-07 20:41:00 +00:00
|
|
|
if (CloudRunner.buildParameters.cloudRunnerDebug) {
|
|
|
|
|
output += `${message}\n`;
|
2022-05-04 23:25:17 +00:00
|
|
|
}
|
2022-11-07 20:41:00 +00:00
|
|
|
CloudRunnerLogger.log(`[${CloudRunnerStatics.logPrefix}] ${message}`);
|
2022-05-04 23:25:17 +00:00
|
|
|
|
|
|
|
|
return { shouldReadLogs, shouldCleanup, output };
|
|
|
|
|
}
|
|
|
|
|
}
|