`errorWhenMissingUnityBuildResults` exposed as with parameter
parent
2190fd5667
commit
bc748ab851
|
@ -217,6 +217,12 @@ inputs:
|
||||||
description:
|
description:
|
||||||
'The path to mount the workspace inside the docker container. For windows, leave out the drive letter. For example
|
'The path to mount the workspace inside the docker container. For windows, leave out the drive letter. For example
|
||||||
c:/github/workspace should be defined as /github/workspace'
|
c:/github/workspace should be defined as /github/workspace'
|
||||||
|
errorWhenMissingUnityBuildResults:
|
||||||
|
default: true
|
||||||
|
required: false
|
||||||
|
description:
|
||||||
|
'Check if Unity build product is present after build, and error if not. Set to false to not check, useful if
|
||||||
|
producing alternative build products.'
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
volume:
|
volume:
|
||||||
|
|
|
@ -56,7 +56,9 @@ async function runMain() {
|
||||||
mac_builder_1.default.run(actionFolder);
|
mac_builder_1.default.run(actionFolder);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await model_1.Docker.run(baseImage.toString(), { workspace, actionFolder, ...buildParameters });
|
await model_1.Docker.run(baseImage.toString(), { workspace, actionFolder, ...buildParameters }, {
|
||||||
|
errorWhenMissingUnityBuildResults: buildParameters.errorWhenMissingUnityBuildResults,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -318,6 +320,7 @@ class BuildParameters {
|
||||||
cacheUnityInstallationOnMac: input_1.default.cacheUnityInstallationOnMac,
|
cacheUnityInstallationOnMac: input_1.default.cacheUnityInstallationOnMac,
|
||||||
unityHubVersionOnMac: input_1.default.unityHubVersionOnMac,
|
unityHubVersionOnMac: input_1.default.unityHubVersionOnMac,
|
||||||
dockerWorkspacePath: input_1.default.dockerWorkspacePath,
|
dockerWorkspacePath: input_1.default.dockerWorkspacePath,
|
||||||
|
errorWhenMissingUnityBuildResults: input_1.default.errorWhenMissingUnityBuildResults,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
static parseBuildFile(filename, platform, androidExportType) {
|
static parseBuildFile(filename, platform, androidExportType) {
|
||||||
|
@ -3254,16 +3257,23 @@ cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||||
if (fs.existsSync(`${workspace}/cloud-runner-cache`)) {
|
if (fs.existsSync(`${workspace}/cloud-runner-cache`)) {
|
||||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`ls ${workspace}/cloud-runner-cache && du -sh ${workspace}/cloud-runner-cache`);
|
await cloud_runner_system_1.CloudRunnerSystem.Run(`ls ${workspace}/cloud-runner-cache && du -sh ${workspace}/cloud-runner-cache`);
|
||||||
}
|
}
|
||||||
await docker_1.default.run(image, { workspace, actionFolder, ...this.buildParameters }, false, `chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}`, content, {
|
await docker_1.default.run(image, { workspace, actionFolder, ...this.buildParameters }, {
|
||||||
listeners: {
|
silent: false,
|
||||||
stdout: (data) => {
|
overrideCommands: `chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}`,
|
||||||
myOutput += data.toString();
|
additionalVariables: content,
|
||||||
},
|
options: {
|
||||||
stderr: (data) => {
|
listeners: {
|
||||||
myOutput += `[LOCAL-DOCKER-ERROR]${data.toString()}`;
|
stdout: (data) => {
|
||||||
|
myOutput += data.toString();
|
||||||
|
},
|
||||||
|
stderr: (data) => {
|
||||||
|
myOutput += `[LOCAL-DOCKER-ERROR]${data.toString()}`;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}, true, false);
|
entrypointBash: true,
|
||||||
|
errorWhenMissingUnityBuildResults: false,
|
||||||
|
});
|
||||||
return myOutput;
|
return myOutput;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5861,9 +5871,9 @@ const image_environment_factory_1 = __importDefault(__nccwpck_require__(25145));
|
||||||
const node_fs_1 = __nccwpck_require__(87561);
|
const node_fs_1 = __nccwpck_require__(87561);
|
||||||
const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
||||||
class Docker {
|
class Docker {
|
||||||
static async run(image, parameters, silent = false, overrideCommands = '', additionalVariables = [],
|
static async run(image, parameters, { silent = false, overrideCommands = '', additionalVariables = [],
|
||||||
// eslint-disable-next-line unicorn/no-useless-undefined
|
// eslint-disable-next-line unicorn/no-useless-undefined
|
||||||
options = undefined, entrypointBash = false, errorWhenMissingUnityBuildResults = true) {
|
options = undefined, entrypointBash = false, errorWhenMissingUnityBuildResults = true, }) {
|
||||||
let runCommand = '';
|
let runCommand = '';
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'linux':
|
case 'linux':
|
||||||
|
@ -6897,6 +6907,10 @@ class Input {
|
||||||
static get dockerWorkspacePath() {
|
static get dockerWorkspacePath() {
|
||||||
return Input.getInput('dockerWorkspacePath') || '/github/workspace';
|
return Input.getInput('dockerWorkspacePath') || '/github/workspace';
|
||||||
}
|
}
|
||||||
|
static get errorWhenMissingUnityBuildResults() {
|
||||||
|
const input = Input.getInput('errorWhenMissingUnityBuildResults') || false;
|
||||||
|
return input === 'true';
|
||||||
|
}
|
||||||
static ToEnvVarFormat(input) {
|
static ToEnvVarFormat(input) {
|
||||||
if (input.toUpperCase() === input) {
|
if (input.toUpperCase() === input) {
|
||||||
return input;
|
return input;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -25,7 +25,13 @@ async function runMain() {
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
MacBuilder.run(actionFolder);
|
MacBuilder.run(actionFolder);
|
||||||
} else {
|
} else {
|
||||||
await Docker.run(baseImage.toString(), { workspace, actionFolder, ...buildParameters });
|
await Docker.run(
|
||||||
|
baseImage.toString(),
|
||||||
|
{ workspace, actionFolder, ...buildParameters },
|
||||||
|
{
|
||||||
|
errorWhenMissingUnityBuildResults: buildParameters.errorWhenMissingUnityBuildResults,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await CloudRunner.run(buildParameters, baseImage.toString());
|
await CloudRunner.run(buildParameters, baseImage.toString());
|
||||||
|
|
|
@ -84,6 +84,7 @@ class BuildParameters {
|
||||||
public cacheUnityInstallationOnMac!: boolean;
|
public cacheUnityInstallationOnMac!: boolean;
|
||||||
public unityHubVersionOnMac!: string;
|
public unityHubVersionOnMac!: string;
|
||||||
public dockerWorkspacePath!: string;
|
public dockerWorkspacePath!: string;
|
||||||
|
public errorWhenMissingUnityBuildResults!: boolean;
|
||||||
|
|
||||||
public static shouldUseRetainedWorkspaceMode(buildParameters: BuildParameters) {
|
public static shouldUseRetainedWorkspaceMode(buildParameters: BuildParameters) {
|
||||||
return buildParameters.maxRetainedWorkspaces > 0 && CloudRunner.lockedWorkspace !== ``;
|
return buildParameters.maxRetainedWorkspaces > 0 && CloudRunner.lockedWorkspace !== ``;
|
||||||
|
@ -192,6 +193,7 @@ class BuildParameters {
|
||||||
cacheUnityInstallationOnMac: Input.cacheUnityInstallationOnMac,
|
cacheUnityInstallationOnMac: Input.cacheUnityInstallationOnMac,
|
||||||
unityHubVersionOnMac: Input.unityHubVersionOnMac,
|
unityHubVersionOnMac: Input.unityHubVersionOnMac,
|
||||||
dockerWorkspacePath: Input.dockerWorkspacePath,
|
dockerWorkspacePath: Input.dockerWorkspacePath,
|
||||||
|
errorWhenMissingUnityBuildResults: Input.errorWhenMissingUnityBuildResults,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,21 +136,23 @@ cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||||
await Docker.run(
|
await Docker.run(
|
||||||
image,
|
image,
|
||||||
{ workspace, actionFolder, ...this.buildParameters },
|
{ workspace, actionFolder, ...this.buildParameters },
|
||||||
false,
|
|
||||||
`chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}`,
|
|
||||||
content,
|
|
||||||
{
|
{
|
||||||
listeners: {
|
silent: false,
|
||||||
stdout: (data: Buffer) => {
|
overrideCommands: `chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}`,
|
||||||
myOutput += data.toString();
|
additionalVariables: content,
|
||||||
},
|
options: {
|
||||||
stderr: (data: Buffer) => {
|
listeners: {
|
||||||
myOutput += `[LOCAL-DOCKER-ERROR]${data.toString()}`;
|
stdout: (data: Buffer) => {
|
||||||
|
myOutput += data.toString();
|
||||||
|
},
|
||||||
|
stderr: (data: Buffer) => {
|
||||||
|
myOutput += `[LOCAL-DOCKER-ERROR]${data.toString()}`;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
entrypointBash: true,
|
||||||
|
errorWhenMissingUnityBuildResults: false,
|
||||||
},
|
},
|
||||||
true,
|
|
||||||
false,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return myOutput;
|
return myOutput;
|
||||||
|
|
|
@ -11,6 +11,6 @@ describe('Docker', () => {
|
||||||
buildsPath: 'build',
|
buildsPath: 'build',
|
||||||
method: '',
|
method: '',
|
||||||
};
|
};
|
||||||
await Docker.run(image, parameters);
|
await Docker.run(image, parameters, {});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,17 +5,28 @@ import path from 'node:path';
|
||||||
import { ExecOptions } from '@actions/exec';
|
import { ExecOptions } from '@actions/exec';
|
||||||
import { DockerParameters, StringKeyValuePair } from './shared-types';
|
import { DockerParameters, StringKeyValuePair } from './shared-types';
|
||||||
|
|
||||||
|
interface IDockerOptions {
|
||||||
|
silent?: boolean;
|
||||||
|
overrideCommands?: string;
|
||||||
|
additionalVariables?: StringKeyValuePair[];
|
||||||
|
options?: ExecOptions | undefined;
|
||||||
|
entrypointBash?: boolean;
|
||||||
|
errorWhenMissingUnityBuildResults?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
class Docker {
|
class Docker {
|
||||||
static async run(
|
static async run(
|
||||||
image: string,
|
image: string,
|
||||||
parameters: DockerParameters,
|
parameters: DockerParameters,
|
||||||
silent: boolean = false,
|
{
|
||||||
overrideCommands: string = '',
|
silent = false,
|
||||||
additionalVariables: StringKeyValuePair[] = [],
|
overrideCommands = '',
|
||||||
// eslint-disable-next-line unicorn/no-useless-undefined
|
additionalVariables = [],
|
||||||
options: ExecOptions | undefined = undefined,
|
// eslint-disable-next-line unicorn/no-useless-undefined
|
||||||
entrypointBash: boolean = false,
|
options = undefined,
|
||||||
errorWhenMissingUnityBuildResults: boolean = true,
|
entrypointBash = false,
|
||||||
|
errorWhenMissingUnityBuildResults = true,
|
||||||
|
}: IDockerOptions,
|
||||||
) {
|
) {
|
||||||
let runCommand = '';
|
let runCommand = '';
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
|
|
|
@ -285,4 +285,22 @@ describe('Input', () => {
|
||||||
expect(spy).toHaveBeenCalledTimes(1);
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('errorWhenMissingUnityBuildResults', () => {
|
||||||
|
it('returns the default value', () => {
|
||||||
|
expect(Input.errorWhenMissingUnityBuildResults).toStrictEqual(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns true when string true is passed', () => {
|
||||||
|
const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
|
||||||
|
expect(Input.errorWhenMissingUnityBuildResults).toStrictEqual(true);
|
||||||
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns false when string false is passed', () => {
|
||||||
|
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
|
||||||
|
expect(Input.errorWhenMissingUnityBuildResults).toStrictEqual(false);
|
||||||
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -220,6 +220,12 @@ class Input {
|
||||||
return Input.getInput('dockerWorkspacePath') || '/github/workspace';
|
return Input.getInput('dockerWorkspacePath') || '/github/workspace';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get errorWhenMissingUnityBuildResults(): boolean {
|
||||||
|
const input = Input.getInput('errorWhenMissingUnityBuildResults') || false;
|
||||||
|
|
||||||
|
return input === 'true';
|
||||||
|
}
|
||||||
|
|
||||||
public static ToEnvVarFormat(input: string) {
|
public static ToEnvVarFormat(input: string) {
|
||||||
if (input.toUpperCase() === input) {
|
if (input.toUpperCase() === input) {
|
||||||
return input;
|
return input;
|
||||||
|
|
Loading…
Reference in New Issue