mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
* add customImage attribute * add one more test for input passing && check for customImage == ''
This commit is contained in:
parent
cccd5074ea
commit
6a53a9e853
@ -6,6 +6,10 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
description: 'Version of unity to use for building the project.'
|
description: 'Version of unity to use for building the project.'
|
||||||
|
customImage:
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
description: 'Specific docker image that should be used for building the project'
|
||||||
targetPlatform:
|
targetPlatform:
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
|
File diff suppressed because one or more lines are too long
@ -25,6 +25,7 @@ class BuildParameters {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
version: Input.unityVersion,
|
version: Input.unityVersion,
|
||||||
|
customImage: Input.customImage,
|
||||||
uid,
|
uid,
|
||||||
gid,
|
gid,
|
||||||
runnerTempPath: process.env.RUNNER_TEMP,
|
runnerTempPath: process.env.RUNNER_TEMP,
|
||||||
|
@ -8,6 +8,7 @@ class ImageTag {
|
|||||||
name = 'unity3d',
|
name = 'unity3d',
|
||||||
version = '2019.2.11f1',
|
version = '2019.2.11f1',
|
||||||
platform,
|
platform,
|
||||||
|
customImage,
|
||||||
} = imageProperties;
|
} = imageProperties;
|
||||||
|
|
||||||
if (!ImageTag.versionPattern.test(version)) {
|
if (!ImageTag.versionPattern.test(version)) {
|
||||||
@ -24,7 +25,7 @@ class ImageTag {
|
|||||||
ImageTag.imageSuffixes.generic,
|
ImageTag.imageSuffixes.generic,
|
||||||
);
|
);
|
||||||
|
|
||||||
Object.assign(this, { repository, name, version, platform, builderPlatform });
|
Object.assign(this, { repository, name, version, platform, builderPlatform, customImage });
|
||||||
}
|
}
|
||||||
|
|
||||||
static get versionPattern() {
|
static get versionPattern() {
|
||||||
@ -82,6 +83,10 @@ class ImageTag {
|
|||||||
toString() {
|
toString() {
|
||||||
const { image, tag } = this;
|
const { image, tag } = this;
|
||||||
|
|
||||||
|
if (this.customImage && this.customImage !== '') {
|
||||||
|
return this.customImage;
|
||||||
|
}
|
||||||
|
|
||||||
return `${image}:${tag}`;
|
return `${image}:${tag}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,15 @@ describe('UnityImageVersion', () => {
|
|||||||
|
|
||||||
expect(image.toString()).toStrictEqual(`${defaults.image}:2099.1.1111`);
|
expect(image.toString()).toStrictEqual(`${defaults.image}:2099.1.1111`);
|
||||||
});
|
});
|
||||||
|
it('returns customImage if given', () => {
|
||||||
|
const image = new ImageTag({
|
||||||
|
version: '2099.1.1111',
|
||||||
|
platform: some.platform,
|
||||||
|
customImage: `${defaults.image}:2099.1.1111@347598437689743986`,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(image.toString()).toStrictEqual(image.customImage);
|
||||||
|
});
|
||||||
|
|
||||||
it('returns the specific build platform', () => {
|
it('returns the specific build platform', () => {
|
||||||
const image = new ImageTag({ version: '2019.2.11f1', platform: 'WebGL' });
|
const image = new ImageTag({ version: '2019.2.11f1', platform: 'WebGL' });
|
||||||
|
@ -12,6 +12,10 @@ class Input {
|
|||||||
return core.getInput('unityVersion');
|
return core.getInput('unityVersion');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get customImage() {
|
||||||
|
return core.getInput('customImage');
|
||||||
|
}
|
||||||
|
|
||||||
static get targetPlatform() {
|
static get targetPlatform() {
|
||||||
return core.getInput('targetPlatform') || Platform.default;
|
return core.getInput('targetPlatform') || Platform.default;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,18 @@ describe('Input', () => {
|
|||||||
expect(spy).toHaveBeenCalledTimes(1);
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe('customImage', () => {
|
||||||
|
it('returns the default value', () => {
|
||||||
|
expect(Input.customImage).toStrictEqual('');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('takes input from the users workflow', () => {
|
||||||
|
const mockValue = '2020.4.99f9';
|
||||||
|
const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue);
|
||||||
|
expect(Input.customImage).toStrictEqual(mockValue);
|
||||||
|
expect(spy).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('targetPlatform', () => {
|
describe('targetPlatform', () => {
|
||||||
it('returns the default value', () => {
|
it('returns the default value', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user