mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-09-29 12:07:05 -07:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd95ad9604 |
+9
-9
@@ -128,13 +128,6 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
description: 'Number of CPU cores to assign the docker container. Defaults to all available cores on all platforms.'
|
description: 'Number of CPU cores to assign the docker container. Defaults to all available cores on all platforms.'
|
||||||
dockerShmSize:
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
description:
|
|
||||||
'Size of /dev/shm to assign the docker container, using the format <number><unit> (m or g). Unity 6.6+ editors
|
|
||||||
request 1GiB of shared memory and fail with "Insufficient shared memory available" against Docker''s 64m
|
|
||||||
default. Defaults to 1025m; set to "0" or "none" to use Docker''s own default.'
|
|
||||||
dockerMemoryLimit:
|
dockerMemoryLimit:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
@@ -175,6 +168,14 @@ inputs:
|
|||||||
default: ''
|
default: ''
|
||||||
required: false
|
required: false
|
||||||
description: 'The Unity licensing server address to use for activating Unity.'
|
description: 'The Unity licensing server address to use for activating Unity.'
|
||||||
|
unityLicensingToolset:
|
||||||
|
default: ''
|
||||||
|
required: false
|
||||||
|
description:
|
||||||
|
'Optional toolset identifier for Unity floating-license servers that host multiple toolsets (e.g.
|
||||||
|
"LicenseServer_1234567890_3"). When set, written to services-config.json so the Licensing Client
|
||||||
|
requests entitlements from the named toolset instead of relying on the server-side default. Leave
|
||||||
|
empty to preserve previous behavior.'
|
||||||
dockerWorkspacePath:
|
dockerWorkspacePath:
|
||||||
default: '/github/workspace'
|
default: '/github/workspace'
|
||||||
required: false
|
required: false
|
||||||
@@ -188,8 +189,7 @@ inputs:
|
|||||||
linux64RemoveExecutableExtension:
|
linux64RemoveExecutableExtension:
|
||||||
default: 'false'
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
description:
|
description: 'When building for StandaloneLinux64, remove the default file extension of `.x86_64`. Set to true to restore the extensionless behavior from v4.'
|
||||||
'When building for StandaloneLinux64, remove the default file extension of `.x86_64`. Set to true to restore the extensionless behavior from v4.'
|
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
volume:
|
volume:
|
||||||
|
|||||||
+12
-29
@@ -269,6 +269,7 @@ class BuildParameters {
|
|||||||
customImage;
|
customImage;
|
||||||
unitySerial;
|
unitySerial;
|
||||||
unityLicensingServer;
|
unityLicensingServer;
|
||||||
|
unityLicensingToolset;
|
||||||
skipActivation;
|
skipActivation;
|
||||||
runnerTempPath;
|
runnerTempPath;
|
||||||
targetPlatform;
|
targetPlatform;
|
||||||
@@ -293,7 +294,6 @@ class BuildParameters {
|
|||||||
androidSymbolType;
|
androidSymbolType;
|
||||||
dockerCpuLimit;
|
dockerCpuLimit;
|
||||||
dockerMemoryLimit;
|
dockerMemoryLimit;
|
||||||
dockerShmSize;
|
|
||||||
dockerIsolationMode;
|
dockerIsolationMode;
|
||||||
containerRegistryRepository;
|
containerRegistryRepository;
|
||||||
containerRegistryImageVersion;
|
containerRegistryImageVersion;
|
||||||
@@ -359,6 +359,7 @@ class BuildParameters {
|
|||||||
customImage: input_1.default.customImage,
|
customImage: input_1.default.customImage,
|
||||||
unitySerial,
|
unitySerial,
|
||||||
unityLicensingServer: input_1.default.unityLicensingServer,
|
unityLicensingServer: input_1.default.unityLicensingServer,
|
||||||
|
unityLicensingToolset: input_1.default.unityLicensingToolset,
|
||||||
skipActivation: input_1.default.skipActivation,
|
skipActivation: input_1.default.skipActivation,
|
||||||
runnerTempPath: input_1.default.runnerTempPath,
|
runnerTempPath: input_1.default.runnerTempPath,
|
||||||
targetPlatform: input_1.default.targetPlatform,
|
targetPlatform: input_1.default.targetPlatform,
|
||||||
@@ -390,7 +391,6 @@ class BuildParameters {
|
|||||||
chownFilesTo: input_1.default.chownFilesTo,
|
chownFilesTo: input_1.default.chownFilesTo,
|
||||||
dockerCpuLimit: input_1.default.dockerCpuLimit,
|
dockerCpuLimit: input_1.default.dockerCpuLimit,
|
||||||
dockerMemoryLimit: input_1.default.dockerMemoryLimit,
|
dockerMemoryLimit: input_1.default.dockerMemoryLimit,
|
||||||
dockerShmSize: input_1.default.dockerShmSize,
|
|
||||||
dockerIsolationMode: input_1.default.dockerIsolationMode,
|
dockerIsolationMode: input_1.default.dockerIsolationMode,
|
||||||
containerRegistryRepository: input_1.default.containerRegistryRepository,
|
containerRegistryRepository: input_1.default.containerRegistryRepository,
|
||||||
containerRegistryImageVersion: input_1.default.containerRegistryImageVersion,
|
containerRegistryImageVersion: input_1.default.containerRegistryImageVersion,
|
||||||
@@ -517,19 +517,6 @@ 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));
|
||||||
const exec_1 = __nccwpck_require__(71514);
|
const exec_1 = __nccwpck_require__(71514);
|
||||||
/**
|
|
||||||
* Unity 6.6+ editors request 1GiB of shared memory and hard-fail with
|
|
||||||
* "Insufficient shared memory available" against Docker's 64m default
|
|
||||||
* (game-ci/unity-builder#840). BuildParameters defaults this to 1025m, the
|
|
||||||
* value unity-test-runner has always passed. '0'/'none' omits the flag so
|
|
||||||
* Docker's own default applies.
|
|
||||||
*/
|
|
||||||
function shmSizeFlag(dockerShmSize) {
|
|
||||||
const value = String(dockerShmSize ?? '').trim();
|
|
||||||
if (value === '' || value === '0' || value.toLowerCase() === 'none')
|
|
||||||
return '';
|
|
||||||
return `--shm-size=${value}`;
|
|
||||||
}
|
|
||||||
class Docker {
|
class Docker {
|
||||||
static async run(image, parameters, silent = false, overrideCommands = '', additionalVariables = [], options = {}, entrypointBash = false) {
|
static async run(image, parameters, silent = false, overrideCommands = '', additionalVariables = [], options = {}, entrypointBash = false) {
|
||||||
let runCommand = '';
|
let runCommand = '';
|
||||||
@@ -548,7 +535,7 @@ class Docker {
|
|||||||
return await (0, exec_1.exec)(runCommand, undefined, options);
|
return await (0, exec_1.exec)(runCommand, undefined, options);
|
||||||
}
|
}
|
||||||
static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) {
|
static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) {
|
||||||
const { workspace, actionFolder, useHostNetwork, runnerTempPath, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, dockerWorkspacePath, dockerCpuLimit, dockerMemoryLimit, dockerShmSize, } = parameters;
|
const { workspace, actionFolder, useHostNetwork, runnerTempPath, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, dockerWorkspacePath, dockerCpuLimit, dockerMemoryLimit, } = parameters;
|
||||||
const githubHome = node_path_1.default.join(runnerTempPath, '_github_home');
|
const githubHome = node_path_1.default.join(runnerTempPath, '_github_home');
|
||||||
if (!(0, node_fs_1.existsSync)(githubHome))
|
if (!(0, node_fs_1.existsSync)(githubHome))
|
||||||
(0, node_fs_1.mkdirSync)(githubHome);
|
(0, node_fs_1.mkdirSync)(githubHome);
|
||||||
@@ -576,7 +563,6 @@ class Docker {
|
|||||||
--volume "${actionFolder}/BlankProject":"/BlankProject:z" \
|
--volume "${actionFolder}/BlankProject":"/BlankProject:z" \
|
||||||
--cpus=${dockerCpuLimit} \
|
--cpus=${dockerCpuLimit} \
|
||||||
--memory=${dockerMemoryLimit} \
|
--memory=${dockerMemoryLimit} \
|
||||||
${shmSizeFlag(dockerShmSize)} \
|
|
||||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||||
${sshAgent && !sshPublicKeysDirectoryPath
|
${sshAgent && !sshPublicKeysDirectoryPath
|
||||||
? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro'
|
? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro'
|
||||||
@@ -589,7 +575,7 @@ class Docker {
|
|||||||
"${overrideCommands !== '' ? overrideCommands : `/entrypoint.sh`}"`;
|
"${overrideCommands !== '' ? overrideCommands : `/entrypoint.sh`}"`;
|
||||||
}
|
}
|
||||||
static getWindowsCommand(image, parameters) {
|
static getWindowsCommand(image, parameters) {
|
||||||
const { workspace, actionFolder, runnerTempPath, gitPrivateToken, dockerWorkspacePath, dockerCpuLimit, dockerMemoryLimit, dockerShmSize, dockerIsolationMode, } = parameters;
|
const { workspace, actionFolder, runnerTempPath, gitPrivateToken, dockerWorkspacePath, dockerCpuLimit, dockerMemoryLimit, dockerIsolationMode, } = parameters;
|
||||||
const githubHome = node_path_1.default.join(runnerTempPath, '_github_home');
|
const githubHome = node_path_1.default.join(runnerTempPath, '_github_home');
|
||||||
if (!(0, node_fs_1.existsSync)(githubHome))
|
if (!(0, node_fs_1.existsSync)(githubHome))
|
||||||
(0, node_fs_1.mkdirSync)(githubHome);
|
(0, node_fs_1.mkdirSync)(githubHome);
|
||||||
@@ -613,7 +599,6 @@ class Docker {
|
|||||||
--volume "${actionFolder}/BlankProject":"c:/BlankProject" \
|
--volume "${actionFolder}/BlankProject":"c:/BlankProject" \
|
||||||
--cpus=${dockerCpuLimit} \
|
--cpus=${dockerCpuLimit} \
|
||||||
--memory=${dockerMemoryLimit} \
|
--memory=${dockerMemoryLimit} \
|
||||||
${shmSizeFlag(dockerShmSize)} \
|
|
||||||
--isolation=${dockerIsolationMode} \
|
--isolation=${dockerIsolationMode} \
|
||||||
${image} \
|
${image} \
|
||||||
powershell c:/steps/entrypoint.ps1`;
|
powershell c:/steps/entrypoint.ps1`;
|
||||||
@@ -1262,6 +1247,9 @@ class Input {
|
|||||||
static get unityLicensingServer() {
|
static get unityLicensingServer() {
|
||||||
return Input.getInput('unityLicensingServer') ?? '';
|
return Input.getInput('unityLicensingServer') ?? '';
|
||||||
}
|
}
|
||||||
|
static get unityLicensingToolset() {
|
||||||
|
return Input.getInput('unityLicensingToolset') ?? '';
|
||||||
|
}
|
||||||
static get buildMethod() {
|
static get buildMethod() {
|
||||||
return Input.getInput('buildMethod') ?? ''; // Processed in docker file
|
return Input.getInput('buildMethod') ?? ''; // Processed in docker file
|
||||||
}
|
}
|
||||||
@@ -1349,16 +1337,6 @@ class Input {
|
|||||||
static get dockerWorkspacePath() {
|
static get dockerWorkspacePath() {
|
||||||
return Input.getInput('dockerWorkspacePath') ?? '/github/workspace';
|
return Input.getInput('dockerWorkspacePath') ?? '/github/workspace';
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Unity 6.6+ editors request 1GiB of shared memory and hard-fail with
|
|
||||||
* "Insufficient shared memory available" against Docker's 64m default
|
|
||||||
* (game-ci/unity-builder#840). unity-test-runner has always passed 1025m,
|
|
||||||
* so match it here rather than leaving builds broken by default. '0' or
|
|
||||||
* 'none' omits the flag and uses Docker's own default.
|
|
||||||
*/
|
|
||||||
static get dockerShmSize() {
|
|
||||||
return Input.getInput('dockerShmSize') ?? '1025m';
|
|
||||||
}
|
|
||||||
static get dockerCpuLimit() {
|
static get dockerCpuLimit() {
|
||||||
return Input.getInput('dockerCpuLimit') ?? node_os_1.default.cpus().length.toString();
|
return Input.getInput('dockerCpuLimit') ?? node_os_1.default.cpus().length.toString();
|
||||||
}
|
}
|
||||||
@@ -1536,6 +1514,11 @@ class PlatformSetup {
|
|||||||
}
|
}
|
||||||
let servicesConfig = node_fs_1.default.readFileSync(servicesConfigPathTemplate).toString();
|
let servicesConfig = node_fs_1.default.readFileSync(servicesConfigPathTemplate).toString();
|
||||||
servicesConfig = servicesConfig.replace('%URL%', buildParameters.unityLicensingServer);
|
servicesConfig = servicesConfig.replace('%URL%', buildParameters.unityLicensingServer);
|
||||||
|
if (buildParameters.unityLicensingToolset) {
|
||||||
|
const parsed = JSON.parse(servicesConfig);
|
||||||
|
parsed.toolset = buildParameters.unityLicensingToolset;
|
||||||
|
servicesConfig = JSON.stringify(parsed, undefined, 2);
|
||||||
|
}
|
||||||
node_fs_1.default.writeFileSync(servicesConfigPath, servicesConfig);
|
node_fs_1.default.writeFileSync(servicesConfigPath, servicesConfig);
|
||||||
platform_setup_1.SetupAndroid.setup(buildParameters);
|
platform_setup_1.SetupAndroid.setup(buildParameters);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+6
-2
@@ -71,8 +71,12 @@ if [[ "$RUN_AS_HOST_USER" == "true" ]]; then
|
|||||||
# Don't stop on error when running our scripts as error handling is baked in
|
# Don't stop on error when running our scripts as error handling is baked in
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
# Switch to the host user so we can create files with the correct ownership
|
# Switch to the host user so we can create files with the correct ownership.
|
||||||
su $USERNAME -c "$SHELL -c 'source /steps/runsteps.sh'"
|
# Pass HOME/USER explicitly so the Unity Licensing Client (which writes to
|
||||||
|
# ~/.config/unity3d) resolves a real, writable home directory rather than
|
||||||
|
# falling back to /home/UNKNOWN when getpwuid() inside the container has no
|
||||||
|
# entry for the host UID. -p preserves the rest of the env from root.
|
||||||
|
su -p $USERNAME -c "HOME=/home/$USERNAME USER=$USERNAME LOGNAME=$USERNAME $SHELL -c 'source /steps/runsteps.sh'"
|
||||||
else
|
else
|
||||||
echo "Running as root"
|
echo "Running as root"
|
||||||
|
|
||||||
|
|||||||
@@ -127,11 +127,18 @@ describe('BuildParameters', () => {
|
|||||||
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${true}
|
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${true}
|
||||||
`(
|
`(
|
||||||
'appends $expectedExtension for $targetPlatform with linux64RemoveExecutableExtension=$linux64RemoveExecutableExtension',
|
'appends $expectedExtension for $targetPlatform with linux64RemoveExecutableExtension=$linux64RemoveExecutableExtension',
|
||||||
async ({ targetPlatform, expectedExtension, androidExportType, linux64RemoveExecutableExtension }) => {
|
async ({
|
||||||
|
targetPlatform,
|
||||||
|
expectedExtension,
|
||||||
|
androidExportType,
|
||||||
|
linux64RemoveExecutableExtension,
|
||||||
|
}) => {
|
||||||
vi.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
vi.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
|
||||||
vi.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
vi.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
|
||||||
vi.spyOn(Input, 'androidExportType', 'get').mockReturnValue(androidExportType);
|
vi.spyOn(Input, 'androidExportType', 'get').mockReturnValue(androidExportType);
|
||||||
vi.spyOn(Input, 'linux64RemoveExecutableExtension', 'get').mockReturnValue(linux64RemoveExecutableExtension);
|
vi.spyOn(Input, 'linux64RemoveExecutableExtension', 'get').mockReturnValue(
|
||||||
|
linux64RemoveExecutableExtension,
|
||||||
|
);
|
||||||
await expect(BuildParameters.create()).resolves.toEqual(
|
await expect(BuildParameters.create()).resolves.toEqual(
|
||||||
expect.objectContaining({ buildFile: `${targetPlatform}${expectedExtension}` }),
|
expect.objectContaining({ buildFile: `${targetPlatform}${expectedExtension}` }),
|
||||||
);
|
);
|
||||||
@@ -221,6 +228,14 @@ describe('BuildParameters', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('returns the unity licensing toolset', async () => {
|
||||||
|
const mockValue = 'LicenseServer_1234567890_3';
|
||||||
|
vi.spyOn(Input, 'unityLicensingToolset', 'get').mockReturnValue(mockValue);
|
||||||
|
await expect(BuildParameters.create()).resolves.toEqual(
|
||||||
|
expect.objectContaining({ unityLicensingToolset: mockValue }),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('throws error when no unity license provider provided', async () => {
|
it('throws error when no unity license provider provided', async () => {
|
||||||
delete process.env.UNITY_LICENSE; // Need to delete this as it is set for every test currently
|
delete process.env.UNITY_LICENSE; // Need to delete this as it is set for every test currently
|
||||||
await expect(BuildParameters.create()).rejects.toThrowError();
|
await expect(BuildParameters.create()).rejects.toThrowError();
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class BuildParameters {
|
|||||||
public customImage!: string;
|
public customImage!: string;
|
||||||
public unitySerial!: string;
|
public unitySerial!: string;
|
||||||
public unityLicensingServer!: string;
|
public unityLicensingServer!: string;
|
||||||
|
public unityLicensingToolset!: string;
|
||||||
public skipActivation!: string;
|
public skipActivation!: string;
|
||||||
public runnerTempPath!: string;
|
public runnerTempPath!: string;
|
||||||
public targetPlatform!: string;
|
public targetPlatform!: string;
|
||||||
@@ -42,7 +43,6 @@ class BuildParameters {
|
|||||||
public androidSymbolType!: string;
|
public androidSymbolType!: string;
|
||||||
public dockerCpuLimit!: string;
|
public dockerCpuLimit!: string;
|
||||||
public dockerMemoryLimit!: string;
|
public dockerMemoryLimit!: string;
|
||||||
public dockerShmSize!: string;
|
|
||||||
public dockerIsolationMode!: string;
|
public dockerIsolationMode!: string;
|
||||||
public containerRegistryRepository!: string;
|
public containerRegistryRepository!: string;
|
||||||
public containerRegistryImageVersion!: string;
|
public containerRegistryImageVersion!: string;
|
||||||
@@ -137,6 +137,7 @@ class BuildParameters {
|
|||||||
customImage: Input.customImage,
|
customImage: Input.customImage,
|
||||||
unitySerial,
|
unitySerial,
|
||||||
unityLicensingServer: Input.unityLicensingServer,
|
unityLicensingServer: Input.unityLicensingServer,
|
||||||
|
unityLicensingToolset: Input.unityLicensingToolset,
|
||||||
skipActivation: Input.skipActivation,
|
skipActivation: Input.skipActivation,
|
||||||
runnerTempPath: Input.runnerTempPath,
|
runnerTempPath: Input.runnerTempPath,
|
||||||
targetPlatform: Input.targetPlatform,
|
targetPlatform: Input.targetPlatform,
|
||||||
@@ -168,7 +169,6 @@ class BuildParameters {
|
|||||||
chownFilesTo: Input.chownFilesTo,
|
chownFilesTo: Input.chownFilesTo,
|
||||||
dockerCpuLimit: Input.dockerCpuLimit,
|
dockerCpuLimit: Input.dockerCpuLimit,
|
||||||
dockerMemoryLimit: Input.dockerMemoryLimit,
|
dockerMemoryLimit: Input.dockerMemoryLimit,
|
||||||
dockerShmSize: Input.dockerShmSize,
|
|
||||||
dockerIsolationMode: Input.dockerIsolationMode,
|
dockerIsolationMode: Input.dockerIsolationMode,
|
||||||
containerRegistryRepository: Input.containerRegistryRepository,
|
containerRegistryRepository: Input.containerRegistryRepository,
|
||||||
containerRegistryImageVersion: Input.containerRegistryImageVersion,
|
containerRegistryImageVersion: Input.containerRegistryImageVersion,
|
||||||
|
|||||||
@@ -14,55 +14,4 @@ describe('Docker', () => {
|
|||||||
};
|
};
|
||||||
await Docker.run(image, parameters);
|
await Docker.run(image, parameters);
|
||||||
});
|
});
|
||||||
|
|
||||||
// game-ci/unity-builder#840: Unity 6.6+ editors request 1GiB of shared
|
|
||||||
// memory and hard-fail against Docker's 64m default. This action never
|
|
||||||
// passed --shm-size at all, and exposed no input to work around it.
|
|
||||||
describe('--shm-size', () => {
|
|
||||||
const baseParameters = {
|
|
||||||
workspace: '/github/workspace',
|
|
||||||
actionFolder: '/action',
|
|
||||||
runnerTempPath: Action.rootFolder,
|
|
||||||
sshAgent: '',
|
|
||||||
sshPublicKeysDirectoryPath: '',
|
|
||||||
gitPrivateToken: '',
|
|
||||||
dockerWorkspacePath: '/github/workspace',
|
|
||||||
dockerCpuLimit: '4',
|
|
||||||
dockerMemoryLimit: '8192m',
|
|
||||||
dockerIsolationMode: 'default',
|
|
||||||
};
|
|
||||||
|
|
||||||
it('passes --shm-size on Linux when dockerShmSize is set', () => {
|
|
||||||
const command = Docker.getLinuxCommand('unityci/editor:latest', {
|
|
||||||
...baseParameters,
|
|
||||||
dockerShmSize: '1025m',
|
|
||||||
} as any);
|
|
||||||
|
|
||||||
expect(command).toContain('--shm-size=1025m');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('passes --shm-size on Windows when dockerShmSize is set', () => {
|
|
||||||
const command = Docker.getWindowsCommand('unityci/editor:latest', {
|
|
||||||
...baseParameters,
|
|
||||||
dockerShmSize: '2g',
|
|
||||||
} as any);
|
|
||||||
|
|
||||||
expect(command).toContain('--shm-size=2g');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('omits --shm-size when explicitly disabled with "0"', () => {
|
|
||||||
const command = Docker.getLinuxCommand('unityci/editor:latest', {
|
|
||||||
...baseParameters,
|
|
||||||
dockerShmSize: '0',
|
|
||||||
} as any);
|
|
||||||
|
|
||||||
expect(command).not.toContain('--shm-size');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('omits --shm-size when unset, rather than emitting "--shm-size=undefined"', () => {
|
|
||||||
const command = Docker.getLinuxCommand('unityci/editor:latest', baseParameters as any);
|
|
||||||
|
|
||||||
expect(command).not.toContain('--shm-size');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,20 +4,6 @@ import path from 'node:path';
|
|||||||
import { ExecOptions, exec } from '@actions/exec';
|
import { ExecOptions, exec } from '@actions/exec';
|
||||||
import { DockerParameters, StringKeyValuePair } from './shared-types';
|
import { DockerParameters, StringKeyValuePair } from './shared-types';
|
||||||
|
|
||||||
/**
|
|
||||||
* Unity 6.6+ editors request 1GiB of shared memory and hard-fail with
|
|
||||||
* "Insufficient shared memory available" against Docker's 64m default
|
|
||||||
* (game-ci/unity-builder#840). BuildParameters defaults this to 1025m, the
|
|
||||||
* value unity-test-runner has always passed. '0'/'none' omits the flag so
|
|
||||||
* Docker's own default applies.
|
|
||||||
*/
|
|
||||||
function shmSizeFlag(dockerShmSize?: string): string {
|
|
||||||
const value = String(dockerShmSize ?? '').trim();
|
|
||||||
if (value === '' || value === '0' || value.toLowerCase() === 'none') return '';
|
|
||||||
|
|
||||||
return `--shm-size=${value}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Docker {
|
class Docker {
|
||||||
static async run(
|
static async run(
|
||||||
image: string,
|
image: string,
|
||||||
@@ -70,7 +56,6 @@ class Docker {
|
|||||||
dockerWorkspacePath,
|
dockerWorkspacePath,
|
||||||
dockerCpuLimit,
|
dockerCpuLimit,
|
||||||
dockerMemoryLimit,
|
dockerMemoryLimit,
|
||||||
dockerShmSize,
|
|
||||||
} = parameters;
|
} = parameters;
|
||||||
|
|
||||||
const githubHome = path.join(runnerTempPath, '_github_home');
|
const githubHome = path.join(runnerTempPath, '_github_home');
|
||||||
@@ -100,7 +85,6 @@ class Docker {
|
|||||||
--volume "${actionFolder}/BlankProject":"/BlankProject:z" \
|
--volume "${actionFolder}/BlankProject":"/BlankProject:z" \
|
||||||
--cpus=${dockerCpuLimit} \
|
--cpus=${dockerCpuLimit} \
|
||||||
--memory=${dockerMemoryLimit} \
|
--memory=${dockerMemoryLimit} \
|
||||||
${shmSizeFlag(dockerShmSize)} \
|
|
||||||
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
${sshAgent ? `--volume ${sshAgent}:/ssh-agent` : ''} \
|
||||||
${
|
${
|
||||||
sshAgent && !sshPublicKeysDirectoryPath
|
sshAgent && !sshPublicKeysDirectoryPath
|
||||||
@@ -124,7 +108,6 @@ class Docker {
|
|||||||
dockerWorkspacePath,
|
dockerWorkspacePath,
|
||||||
dockerCpuLimit,
|
dockerCpuLimit,
|
||||||
dockerMemoryLimit,
|
dockerMemoryLimit,
|
||||||
dockerShmSize,
|
|
||||||
dockerIsolationMode,
|
dockerIsolationMode,
|
||||||
} = parameters;
|
} = parameters;
|
||||||
|
|
||||||
@@ -151,7 +134,6 @@ class Docker {
|
|||||||
--volume "${actionFolder}/BlankProject":"c:/BlankProject" \
|
--volume "${actionFolder}/BlankProject":"c:/BlankProject" \
|
||||||
--cpus=${dockerCpuLimit} \
|
--cpus=${dockerCpuLimit} \
|
||||||
--memory=${dockerMemoryLimit} \
|
--memory=${dockerMemoryLimit} \
|
||||||
${shmSizeFlag(dockerShmSize)} \
|
|
||||||
--isolation=${dockerIsolationMode} \
|
--isolation=${dockerIsolationMode} \
|
||||||
${image} \
|
${image} \
|
||||||
powershell c:/steps/entrypoint.ps1`;
|
powershell c:/steps/entrypoint.ps1`;
|
||||||
|
|||||||
+4
-11
@@ -122,6 +122,10 @@ class Input {
|
|||||||
return Input.getInput('unityLicensingServer') ?? '';
|
return Input.getInput('unityLicensingServer') ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get unityLicensingToolset(): string {
|
||||||
|
return Input.getInput('unityLicensingToolset') ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
static get buildMethod(): string {
|
static get buildMethod(): string {
|
||||||
return Input.getInput('buildMethod') ?? ''; // Processed in docker file
|
return Input.getInput('buildMethod') ?? ''; // Processed in docker file
|
||||||
}
|
}
|
||||||
@@ -242,17 +246,6 @@ class Input {
|
|||||||
return Input.getInput('dockerWorkspacePath') ?? '/github/workspace';
|
return Input.getInput('dockerWorkspacePath') ?? '/github/workspace';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Unity 6.6+ editors request 1GiB of shared memory and hard-fail with
|
|
||||||
* "Insufficient shared memory available" against Docker's 64m default
|
|
||||||
* (game-ci/unity-builder#840). unity-test-runner has always passed 1025m,
|
|
||||||
* so match it here rather than leaving builds broken by default. '0' or
|
|
||||||
* 'none' omits the flag and uses Docker's own default.
|
|
||||||
*/
|
|
||||||
static get dockerShmSize(): string {
|
|
||||||
return Input.getInput('dockerShmSize') ?? '1025m';
|
|
||||||
}
|
|
||||||
|
|
||||||
static get dockerCpuLimit(): string {
|
static get dockerCpuLimit(): string {
|
||||||
return Input.getInput('dockerCpuLimit') ?? os.cpus().length.toString();
|
return Input.getInput('dockerCpuLimit') ?? os.cpus().length.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,13 @@ class PlatformSetup {
|
|||||||
|
|
||||||
let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString();
|
let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString();
|
||||||
servicesConfig = servicesConfig.replace('%URL%', buildParameters.unityLicensingServer);
|
servicesConfig = servicesConfig.replace('%URL%', buildParameters.unityLicensingServer);
|
||||||
|
|
||||||
|
if (buildParameters.unityLicensingToolset) {
|
||||||
|
const parsed = JSON.parse(servicesConfig);
|
||||||
|
parsed.toolset = buildParameters.unityLicensingToolset;
|
||||||
|
servicesConfig = JSON.stringify(parsed, undefined, 2);
|
||||||
|
}
|
||||||
|
|
||||||
fs.writeFileSync(servicesConfigPath, servicesConfig);
|
fs.writeFileSync(servicesConfigPath, servicesConfig);
|
||||||
|
|
||||||
SetupAndroid.setup(buildParameters);
|
SetupAndroid.setup(buildParameters);
|
||||||
|
|||||||
Reference in New Issue
Block a user