chore: debug build process for windows
parent
16c49480b5
commit
0379bceff3
|
|
@ -1,9 +1,8 @@
|
|||
import { exec, OutputMode } from 'https://deno.land/x/exec@0.0.5/mod.ts';
|
||||
import { CommandInterface } from '../command-interface.ts';
|
||||
import { Options } from '../../../config/options.ts';
|
||||
import { Action, Cache, CloudRunner, Docker, ImageTag, Input, Output } from '../../../model/index.ts';
|
||||
import { Action, Cache, Docker, ImageTag, Input, Output } from '../../../model/index.ts';
|
||||
import PlatformSetup from '../../../model/platform-setup.ts';
|
||||
import { core, process } from '../../../dependencies.ts';
|
||||
import MacBuilder from '../../../model/mac-builder.ts';
|
||||
import Parameters from '../../../model/parameters.ts';
|
||||
|
||||
|
|
@ -19,31 +18,28 @@ export class BuildCommand implements CommandInterface {
|
|||
public async execute(options: Options): Promise<boolean> {
|
||||
try {
|
||||
const { workspace, actionFolder } = Action;
|
||||
const { buildParameters } = options;
|
||||
const { parameters, env } = options;
|
||||
|
||||
Action.checkCompatibility();
|
||||
Cache.verify();
|
||||
|
||||
const baseImage = new ImageTag(buildParameters);
|
||||
const baseImage = new ImageTag(parameters);
|
||||
log.debug('baseImage', baseImage);
|
||||
|
||||
if (buildParameters.cloudRunnerCluster !== 'local') {
|
||||
await CloudRunner.run(buildParameters, baseImage.toString());
|
||||
await PlatformSetup.setup(parameters, actionFolder);
|
||||
log.info('Platform setup done.');
|
||||
log.info('OS:', env.getOS());
|
||||
if (env.getOS() === 'darwin') {
|
||||
MacBuilder.run(actionFolder, workspace, parameters);
|
||||
} else {
|
||||
log.info('Building locally');
|
||||
await PlatformSetup.setup(buildParameters, actionFolder);
|
||||
if (process.platform === 'darwin') {
|
||||
MacBuilder.run(actionFolder, workspace, buildParameters);
|
||||
} else {
|
||||
await Docker.run(baseImage, { workspace, actionFolder, ...buildParameters });
|
||||
}
|
||||
await Docker.run(baseImage, { workspace, actionFolder, ...parameters });
|
||||
}
|
||||
|
||||
// Set output
|
||||
await Output.setBuildVersion(buildParameters.buildVersion);
|
||||
await Output.setBuildVersion(parameters.buildVersion);
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
core.setFailed((error as Error).message);
|
||||
Deno.exit(1);
|
||||
}
|
||||
|
||||
const result = await exec('docker run -it unityci/editor:2020.3.15f2-base-1 /bin/bash -c "echo test"', {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ export class BuildRemoteCommand implements CommandInterface {
|
|||
return status.success;
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
core.setFailed((error as Error).message);
|
||||
Deno.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { configureLogger, Verbosity } from './core/logger/index.ts';
|
||||
import './dependencies.ts';
|
||||
import { configureLogger } from './core/logger/index.ts';
|
||||
import { Options } from './config/options.ts';
|
||||
import { CommandFactory } from './commands/command-factory.ts';
|
||||
import { ArgumentsParser } from './core/cli/arguments-parser.ts';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Parameters } from '../index.ts';
|
||||
import { fsSync as fs, exec, getUnityChangeSet } from '../../dependencies.ts';
|
||||
import { Parameters } from '../../../model/index.ts';
|
||||
import { fsSync as fs, exec, getUnityChangeSet } from '../../../dependencies.ts';
|
||||
|
||||
class SetupMac {
|
||||
static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { fsSync as fs, exec } from '../../dependencies.ts';
|
||||
import { Parameters } from '../index.ts';
|
||||
import { fsSync as fs, exec } from '../../../dependencies.ts';
|
||||
import { Parameters } from '../../../model/index.ts';
|
||||
|
||||
class SetupWindows {
|
||||
public static async setup(buildParameters: Parameters) {
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
import { fsSync as fs } from '../../dependencies.ts';
|
||||
import { Parameters } from '../index.ts';
|
||||
import { fsSync as fs } from '../../../dependencies.ts';
|
||||
import { Parameters } from '../../../model/index.ts';
|
||||
|
||||
class ValidateWindows {
|
||||
public static validate(buildParameters: Parameters) {
|
||||
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform);
|
||||
if (!(Deno.env.get('UNITY_EMAIL') && Deno.env.get('UNITY_PASSWORD'))) {
|
||||
throw new Error(`Unity email and password must be set for Windows based builds to
|
||||
authenticate the license. Make sure to set them inside UNITY_EMAIL
|
||||
and UNITY_PASSWORD in Github Secrets and pass them into the environment.`);
|
||||
throw new Error(String.dedent`
|
||||
Unity email and password must be set for Windows based builds to authenticate the license.
|
||||
|
||||
Make sure to set them inside UNITY_EMAIL and UNITY_PASSWORD in Github Secrets and pass them into the environment.
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -35,9 +37,11 @@ class ValidateWindows {
|
|||
// Check for Windows 10 SDK on runner
|
||||
const windows10SDKPathExists = fs.existsSync('C:/Program Files (x86)/Windows Kits');
|
||||
if (!windows10SDKPathExists) {
|
||||
throw new Error(`Windows 10 SDK not found in default location. Make sure
|
||||
the runner has a Windows 10 SDK installed in the default
|
||||
location.`);
|
||||
throw new Error(String.dedent`
|
||||
Windows 10 SDK not found in default location. Make sure this machine has a Windows 10 SDK installed.
|
||||
|
||||
Download here: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/
|
||||
`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -47,9 +51,13 @@ class ValidateWindows {
|
|||
const visualStudioDataPathExists = fs.existsSync('C:/ProgramData/Microsoft/VisualStudio');
|
||||
|
||||
if (!visualStudioInstallPathExists || !visualStudioDataPathExists) {
|
||||
throw new Error(`Visual Studio not found at the default location.
|
||||
Make sure the runner has Visual Studio installed in the
|
||||
default location`);
|
||||
throw new Error(String.dedent`
|
||||
Visual Studio not found at the default location.
|
||||
|
||||
Make sure the runner has Visual Studio installed in the default location
|
||||
|
||||
Download here: https://visualstudio.microsoft.com/downloads/
|
||||
`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,12 +5,15 @@ import CloudRunner from '../cloud-runner.ts';
|
|||
export class CloudRunnerError {
|
||||
public static async handleException(error: unknown) {
|
||||
CloudRunnerLogger.error(JSON.stringify(error, undefined, 4));
|
||||
core.setFailed('Cloud Runner failed');
|
||||
log.error('Cloud runner failed');
|
||||
|
||||
await CloudRunner.Provider.cleanup(
|
||||
CloudRunner.buildParameters.buildGuid,
|
||||
CloudRunner.buildParameters,
|
||||
CloudRunner.buildParameters.branch,
|
||||
CloudRunner.defaultSecrets,
|
||||
);
|
||||
|
||||
Deno.exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ class AWSTaskRunner {
|
|||
const tasksDescription = await AWSTaskRunner.describeTasks(ECS, cluster, taskArn);
|
||||
CloudRunnerLogger.log(`Cloud runner job has ended ${tasksDescription.containers?.[0].lastStatus}`);
|
||||
|
||||
core.setFailed(error);
|
||||
log.error(error);
|
||||
Deno.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { exec } from '../../../dependencies.ts';
|
||||
import { RemoteClientLogger } from '../remote-client/remote-client-logger.ts';
|
||||
import { spawn } from 'https://deno.land/std@0.152.0/node/child_process.ts';
|
||||
|
||||
export class CloudRunnerSystem {
|
||||
public static async Run(command: string, suppressError = false, suppressLogs = false) {
|
||||
|
|
@ -11,7 +11,9 @@ export class CloudRunnerSystem {
|
|||
|
||||
return await new Promise<string>((promise, throwError) => {
|
||||
let output = '';
|
||||
const child = exec(command, (error, stdout, stderr) => {
|
||||
|
||||
// Todo - find Deno variant of child_process or rewrite this method to use execSync
|
||||
const child = spawn(command, (error, stdout, stderr) => {
|
||||
if (!suppressError && error) {
|
||||
RemoteClientLogger.log(error.toString());
|
||||
throwError(error);
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ export class FollowLogStreamService {
|
|||
core.setOutput('build-result', 'success');
|
||||
} else if (message.includes('Build fail')) {
|
||||
core.setOutput('build-result', 'failed');
|
||||
core.setFailed('unity build failed');
|
||||
log.error('BUILD FAILED!');
|
||||
log.error('build-result: failed');
|
||||
Deno.exit(1);
|
||||
} else if (CloudRunner.buildParameters.cloudRunnerIntegrationTests && message.includes(': Listening for Jobs')) {
|
||||
core.setOutput('cloud runner stop watching', 'true');
|
||||
shouldReadLogs = false;
|
||||
|
|
|
|||
|
|
@ -248,7 +248,8 @@ class Input {
|
|||
return this.getInput('awsBaseStackName') || 'game-ci';
|
||||
}
|
||||
|
||||
public get cloudRunnerCluster() {
|
||||
// Todo - move to parameters
|
||||
public static get cloudRunnerCluster() {
|
||||
if (Cli.isCliMode) {
|
||||
return this.getInput('cloudRunnerCluster') || 'aws';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class Parameters {
|
|||
);
|
||||
log.debug('buildFile:', buildFile);
|
||||
const editorVersion = UnityVersioning.determineUnityVersion(this.input.projectPath, this.input.unityVersion);
|
||||
log.debug('editorVersion:', editorVersion);
|
||||
log.info('Detected editorVersion', editorVersion);
|
||||
const buildVersion = await Versioning.determineBuildVersion(
|
||||
this.input.versioningStrategy,
|
||||
this.input.specifiedVersion,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Parameters } from './index.ts';
|
||||
import { SetupMac, SetupWindows } from './platform-setup/index.ts';
|
||||
import ValidateWindows from './platform-validation/validate-windows.ts';
|
||||
import { SetupMac, SetupWindows } from '../logic/unity/platform-setup/index.ts';
|
||||
import ValidateWindows from '../logic/unity/platform-validation/validate-windows.ts';
|
||||
|
||||
class PlatformSetup {
|
||||
static async setup(buildParameters: Parameters, actionFolder: string) {
|
||||
|
|
|
|||
|
|
@ -9,11 +9,6 @@ export const core = {
|
|||
console.error(error, error.stack);
|
||||
},
|
||||
|
||||
setFailed: (failure) => {
|
||||
console.error('setFailed:', failure);
|
||||
Deno.exit(1);
|
||||
},
|
||||
|
||||
// Adapted from: https://github.com/actions/toolkit/blob/9b7bcb1567c9b7f134eb3c2d6bbf409a5106a956/packages/core/src/core.ts#L128
|
||||
getInput: (name, options) => {
|
||||
const variable = `INPUT_${name.replace(/ /g, '_').toUpperCase()}`;
|
||||
|
|
|
|||
Loading…
Reference in New Issue