mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
errorWhenMissingUnityBuildResults
exposed as with parameter
This commit is contained in:
parent
2190fd5667
commit
bc748ab851
@ -217,6 +217,12 @@ inputs:
|
||||
description:
|
||||
'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'
|
||||
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:
|
||||
volume:
|
||||
|
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.
@ -25,7 +25,13 @@ async function runMain() {
|
||||
if (process.platform === 'darwin') {
|
||||
MacBuilder.run(actionFolder);
|
||||
} else {
|
||||
await Docker.run(baseImage.toString(), { workspace, actionFolder, ...buildParameters });
|
||||
await Docker.run(
|
||||
baseImage.toString(),
|
||||
{ workspace, actionFolder, ...buildParameters },
|
||||
{
|
||||
errorWhenMissingUnityBuildResults: buildParameters.errorWhenMissingUnityBuildResults,
|
||||
},
|
||||
);
|
||||
}
|
||||
} else {
|
||||
await CloudRunner.run(buildParameters, baseImage.toString());
|
||||
|
@ -84,6 +84,7 @@ class BuildParameters {
|
||||
public cacheUnityInstallationOnMac!: boolean;
|
||||
public unityHubVersionOnMac!: string;
|
||||
public dockerWorkspacePath!: string;
|
||||
public errorWhenMissingUnityBuildResults!: boolean;
|
||||
|
||||
public static shouldUseRetainedWorkspaceMode(buildParameters: BuildParameters) {
|
||||
return buildParameters.maxRetainedWorkspaces > 0 && CloudRunner.lockedWorkspace !== ``;
|
||||
@ -192,6 +193,7 @@ class BuildParameters {
|
||||
cacheUnityInstallationOnMac: Input.cacheUnityInstallationOnMac,
|
||||
unityHubVersionOnMac: Input.unityHubVersionOnMac,
|
||||
dockerWorkspacePath: Input.dockerWorkspacePath,
|
||||
errorWhenMissingUnityBuildResults: Input.errorWhenMissingUnityBuildResults,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -136,21 +136,23 @@ cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||
await Docker.run(
|
||||
image,
|
||||
{ workspace, actionFolder, ...this.buildParameters },
|
||||
false,
|
||||
`chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}`,
|
||||
content,
|
||||
{
|
||||
listeners: {
|
||||
stdout: (data: Buffer) => {
|
||||
myOutput += data.toString();
|
||||
},
|
||||
stderr: (data: Buffer) => {
|
||||
myOutput += `[LOCAL-DOCKER-ERROR]${data.toString()}`;
|
||||
silent: false,
|
||||
overrideCommands: `chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}`,
|
||||
additionalVariables: content,
|
||||
options: {
|
||||
listeners: {
|
||||
stdout: (data: Buffer) => {
|
||||
myOutput += data.toString();
|
||||
},
|
||||
stderr: (data: Buffer) => {
|
||||
myOutput += `[LOCAL-DOCKER-ERROR]${data.toString()}`;
|
||||
},
|
||||
},
|
||||
},
|
||||
entrypointBash: true,
|
||||
errorWhenMissingUnityBuildResults: false,
|
||||
},
|
||||
true,
|
||||
false,
|
||||
);
|
||||
|
||||
return myOutput;
|
||||
|
@ -11,6 +11,6 @@ describe('Docker', () => {
|
||||
buildsPath: 'build',
|
||||
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 { DockerParameters, StringKeyValuePair } from './shared-types';
|
||||
|
||||
interface IDockerOptions {
|
||||
silent?: boolean;
|
||||
overrideCommands?: string;
|
||||
additionalVariables?: StringKeyValuePair[];
|
||||
options?: ExecOptions | undefined;
|
||||
entrypointBash?: boolean;
|
||||
errorWhenMissingUnityBuildResults?: boolean;
|
||||
}
|
||||
|
||||
class Docker {
|
||||
static async run(
|
||||
image: string,
|
||||
parameters: DockerParameters,
|
||||
silent: boolean = false,
|
||||
overrideCommands: string = '',
|
||||
additionalVariables: StringKeyValuePair[] = [],
|
||||
// eslint-disable-next-line unicorn/no-useless-undefined
|
||||
options: ExecOptions | undefined = undefined,
|
||||
entrypointBash: boolean = false,
|
||||
errorWhenMissingUnityBuildResults: boolean = true,
|
||||
{
|
||||
silent = false,
|
||||
overrideCommands = '',
|
||||
additionalVariables = [],
|
||||
// eslint-disable-next-line unicorn/no-useless-undefined
|
||||
options = undefined,
|
||||
entrypointBash = false,
|
||||
errorWhenMissingUnityBuildResults = true,
|
||||
}: IDockerOptions,
|
||||
) {
|
||||
let runCommand = '';
|
||||
switch (process.platform) {
|
||||
|
@ -285,4 +285,22 @@ describe('Input', () => {
|
||||
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';
|
||||
}
|
||||
|
||||
static get errorWhenMissingUnityBuildResults(): boolean {
|
||||
const input = Input.getInput('errorWhenMissingUnityBuildResults') || false;
|
||||
|
||||
return input === 'true';
|
||||
}
|
||||
|
||||
public static ToEnvVarFormat(input: string) {
|
||||
if (input.toUpperCase() === input) {
|
||||
return input;
|
||||
|
Loading…
Reference in New Issue
Block a user