mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
errorWhenMissingUnityBuildResults
exposed as with parameter
This commit is contained in:
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:
|
||||||
|
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') {
|
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,10 +136,11 @@ 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,
|
|
||||||
{
|
{
|
||||||
|
silent: false,
|
||||||
|
overrideCommands: `chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}`,
|
||||||
|
additionalVariables: content,
|
||||||
|
options: {
|
||||||
listeners: {
|
listeners: {
|
||||||
stdout: (data: Buffer) => {
|
stdout: (data: Buffer) => {
|
||||||
myOutput += data.toString();
|
myOutput += data.toString();
|
||||||
@ -149,8 +150,9 @@ cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
true,
|
entrypointBash: true,
|
||||||
false,
|
errorWhenMissingUnityBuildResults: 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 = '',
|
||||||
|
additionalVariables = [],
|
||||||
// eslint-disable-next-line unicorn/no-useless-undefined
|
// eslint-disable-next-line unicorn/no-useless-undefined
|
||||||
options: ExecOptions | undefined = undefined,
|
options = undefined,
|
||||||
entrypointBash: boolean = false,
|
entrypointBash = false,
|
||||||
errorWhenMissingUnityBuildResults: boolean = true,
|
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
Block a user