diff --git a/dist/index.js b/dist/index.js
index 9ba0dda0..f12bb8ba 100644
Binary files a/dist/index.js and b/dist/index.js differ
diff --git a/dist/index.js.map b/dist/index.js.map
index 72c9eac1..48c1482a 100644
Binary files a/dist/index.js.map and b/dist/index.js.map differ
diff --git a/src/model/__mocks__/input.ts b/src/model/__mocks__/input.ts
index 438496a1..72645c0f 100644
--- a/src/model/__mocks__/input.ts
+++ b/src/model/__mocks__/input.ts
@@ -2,7 +2,7 @@
import Platform from '../platform';
export const mockGetFromUser = jest.fn().mockResolvedValue({
- version: '',
+ editorVersion: '',
targetPlatform: Platform.types.Test,
projectPath: '.',
buildName: Platform.types.Test,
diff --git a/src/model/__snapshots__/versioning.test.ts.snap b/src/model/__snapshots__/versioning.test.ts.snap
index d5be7149..4e636047 100644
--- a/src/model/__snapshots__/versioning.test.ts.snap
+++ b/src/model/__snapshots__/versioning.test.ts.snap
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Versioning determineVersion throws for invalid strategy somethingRandom 1`] = `"Versioning strategy should be one of None, Semantic, Tag, Custom."`;
+exports[`Versioning determineBuildVersion throws for invalid strategy somethingRandom 1`] = `"Versioning strategy should be one of None, Semantic, Tag, Custom."`;
diff --git a/src/model/build-parameters.test.ts b/src/model/build-parameters.test.ts
index 5b3075c0..1cb37ae5 100644
--- a/src/model/build-parameters.test.ts
+++ b/src/model/build-parameters.test.ts
@@ -10,7 +10,7 @@ const testLicense =
'\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \nm0Db8UK+ktnOLJBtHybkfetpcKo=o/pUbSQAukz7+ZYAWhnA0AJbIlyyCPL7bKVEM2lVqbrXt7cyey+umkCXamuOgsWPVUKBMkXtMH8L\n5etLmD0getWIhTGhzOnDCk+gtIPfL4jMo9tkEuOCROQAXCci23VFscKcrkB+3X6h4wEOtA2APhOY\nB+wvC794o8/82ffjP79aVAi57rp3Wmzx+9pe9yMwoJuljAy2sc2tIMgdQGWVmOGBpQm3JqsidyzI\nJWG2kjnc7pDXK9pwYzXoKiqUqqrut90d+kQqRyv7MSZXR50HFqD/LI69h68b7P8Bjo3bPXOhNXGR\n9YCoemH6EkfCJxp2gIjzjWW+l2Hj2EsFQi8YXw==';
process.env.UNITY_LICENSE = testLicense;
-const determineVersion = jest.spyOn(Versioning, 'determineVersion').mockImplementation(async () => '1.3.37');
+const determineVersion = jest.spyOn(Versioning, 'determineBuildVersion').mockImplementation(async () => '1.3.37');
const determineUnityVersion = jest
.spyOn(UnityVersioning, 'determineUnityVersion')
.mockImplementation(() => '2019.2.11f1');
@@ -55,10 +55,10 @@ describe('BuildParameters', () => {
expect(determineSdkManagerParameters).toHaveBeenCalledTimes(1);
});
- it('returns the platform', async () => {
+ it('returns the targetPlatform', async () => {
const mockValue = 'somePlatform';
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(mockValue);
- expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ platform: mockValue }));
+ expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ targetPlatform: mockValue }));
});
it('returns the project path', async () => {
diff --git a/src/model/build-parameters.ts b/src/model/build-parameters.ts
index 17b650a9..064c5080 100644
--- a/src/model/build-parameters.ts
+++ b/src/model/build-parameters.ts
@@ -9,11 +9,11 @@ import UnityVersioning from './unity-versioning';
import Versioning from './versioning';
class BuildParameters {
- public version!: string;
+ public editorVersion!: string;
public customImage!: string;
public unitySerial!: string;
public runnerTempPath: string | undefined;
- public platform!: string;
+ public targetPlatform!: string;
public projectPath!: string;
public buildName!: string;
public buildPath!: string;
@@ -55,8 +55,8 @@ class BuildParameters {
static async create(): Promise {
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidAppBundle);
- const unityVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
- const buildVersion = await Versioning.determineVersion(Input.versioningStrategy, Input.specifiedVersion);
+ const editorVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
+ const buildVersion = await Versioning.determineBuildVersion(Input.versioningStrategy, Input.specifiedVersion);
const androidVersionCode = AndroidVersioning.determineVersionCode(buildVersion, Input.androidVersionCode);
const androidSdkManagerParameters = AndroidVersioning.determineSdkManagerParameters(Input.androidTargetSdkVersion);
@@ -79,12 +79,12 @@ class BuildParameters {
// ---
return {
- version: unityVersion,
+ editorVersion,
customImage: Input.customImage,
unitySerial,
runnerTempPath: process.env.RUNNER_TEMP,
- platform: Input.targetPlatform,
+ targetPlatform: Input.targetPlatform,
projectPath: Input.projectPath,
buildName: Input.buildName,
buildPath: `${Input.buildsPath}/${Input.targetPlatform}`,
@@ -116,6 +116,7 @@ class BuildParameters {
customJob: Input.customJob,
runNumber: Input.runNumber,
branch: await Input.branch(),
+ // Todo - move this out of UserInput and into some class that determines additional information (as needed)
githubRepo: await Input.githubRepo(),
remoteBuildCluster: Input.cloudRunnerCluster,
awsStackName: Input.awsBaseStackName,
diff --git a/src/model/cloud-runner/k8s/kubernetes-job-spec-factory.ts b/src/model/cloud-runner/k8s/kubernetes-job-spec-factory.ts
index 9b4765af..cfee9b93 100644
--- a/src/model/cloud-runner/k8s/kubernetes-job-spec-factory.ts
+++ b/src/model/cloud-runner/k8s/kubernetes-job-spec-factory.ts
@@ -60,7 +60,7 @@ class KubernetesJobSpecFactory {
},
{
name: 'BUILD_TARGET',
- value: buildParameters.platform,
+ value: buildParameters.targetPlatform,
},
{
name: 'ANDROID_VERSION_CODE',
diff --git a/src/model/cloud-runner/services/task-parameter-serializer.ts b/src/model/cloud-runner/services/task-parameter-serializer.ts
index e1bdcc4a..5e85a34a 100644
--- a/src/model/cloud-runner/services/task-parameter-serializer.ts
+++ b/src/model/cloud-runner/services/task-parameter-serializer.ts
@@ -18,7 +18,7 @@ export class TaskParameterSerializer {
},
{
name: 'BUILD_TARGET',
- value: CloudRunnerState.buildParams.platform,
+ value: CloudRunnerState.buildParams.targetPlatform,
},
...TaskParameterSerializer.serializeBuildParamsAndInput,
];
diff --git a/src/model/image-environment-factory.ts b/src/model/image-environment-factory.ts
index b8620c7c..f9a7dfb9 100644
--- a/src/model/image-environment-factory.ts
+++ b/src/model/image-environment-factory.ts
@@ -30,10 +30,10 @@ class ImageEnvironmentFactory {
{ name: 'UNITY_EMAIL', value: process.env.UNITY_EMAIL },
{ name: 'UNITY_PASSWORD', value: process.env.UNITY_PASSWORD },
{ name: 'UNITY_SERIAL', value: parameters.unitySerial },
- { name: 'UNITY_VERSION', value: parameters.version },
+ { name: 'UNITY_VERSION', value: parameters.editorVersion },
{ name: 'USYM_UPLOAD_AUTH_TOKEN', value: process.env.USYM_UPLOAD_AUTH_TOKEN },
{ name: 'PROJECT_PATH', value: parameters.projectPath },
- { name: 'BUILD_TARGET', value: parameters.platform },
+ { name: 'BUILD_TARGET', value: parameters.targetPlatform },
{ name: 'BUILD_NAME', value: parameters.buildName },
{ name: 'BUILD_PATH', value: parameters.buildPath },
{ name: 'BUILD_FILE', value: parameters.buildFile },
diff --git a/src/model/image-tag.test.ts b/src/model/image-tag.test.ts
index 62d6e24b..f7ac2e2b 100644
--- a/src/model/image-tag.test.ts
+++ b/src/model/image-tag.test.ts
@@ -2,10 +2,8 @@ import ImageTag from './image-tag';
describe('ImageTag', () => {
const some = {
- repository: 'test1',
- name: 'test2',
- version: '2099.9.f9f9',
- platform: 'Test',
+ editorVersion: '2099.9.f9f9',
+ targetPlatform: 'Test',
builderPlatform: '',
};
@@ -17,50 +15,51 @@ describe('ImageTag', () => {
describe('constructor', () => {
it('can be called', () => {
- const { platform } = some;
- expect(() => new ImageTag({ platform })).not.toThrow();
+ const { targetPlatform } = some;
+
+ expect(() => new ImageTag({ targetPlatform })).not.toThrow();
});
it('accepts parameters and sets the right properties', () => {
const image = new ImageTag(some);
- expect(image.repository).toStrictEqual(some.repository);
- expect(image.name).toStrictEqual(some.name);
- expect(image.version).toStrictEqual(some.version);
- expect(image.platform).toStrictEqual(some.platform);
+ expect(image.repository).toStrictEqual('unityci');
+ expect(image.name).toStrictEqual('editor');
+ expect(image.editorVersion).toStrictEqual(some.editorVersion);
+ expect(image.targetPlatform).toStrictEqual(some.targetPlatform);
expect(image.builderPlatform).toStrictEqual(some.builderPlatform);
});
test.each(['2000.0.0f0', '2011.1.11f1'])('accepts %p version format', (version) => {
- expect(() => new ImageTag({ version, platform: some.platform })).not.toThrow();
+ expect(() => new ImageTag({ editorVersion: version, targetPlatform: some.targetPlatform })).not.toThrow();
});
- test.each(['some version', '', 1])('throws for incorrect versions %p', (version) => {
- const { platform } = some;
- expect(() => new ImageTag({ version, platform })).toThrow();
+ test.each(['some version', ''])('throws for incorrect version %p', (editorVersion) => {
+ const { targetPlatform } = some;
+ expect(() => new ImageTag({ editorVersion, targetPlatform })).toThrow();
});
- test.each([undefined, 'nonExisting'])('throws for unsupported target %p', (platform) => {
- expect(() => new ImageTag({ platform })).toThrow();
+ test.each([undefined, 'nonExisting'])('throws for unsupported target %p', (targetPlatform) => {
+ expect(() => new ImageTag({ targetPlatform })).toThrow();
});
});
describe('toString', () => {
it('returns the correct version', () => {
- const image = new ImageTag({ version: '2099.1.1111', platform: some.platform });
+ const image = new ImageTag({ editorVersion: '2099.1.1111', targetPlatform: some.targetPlatform });
switch (process.platform) {
case 'win32':
- expect(image.toString()).toStrictEqual(`${defaults.image}:windows-2099.1.1111-0`);
+ expect(image.toString()).toStrictEqual(`${defaults.image}:windows-2099.1.1111-1`);
break;
case 'linux':
- expect(image.toString()).toStrictEqual(`${defaults.image}:2099.1.1111-0`);
+ expect(image.toString()).toStrictEqual(`${defaults.image}:ubuntu-2099.1.1111-1`);
break;
}
});
it('returns customImage if given', () => {
const image = new ImageTag({
- version: '2099.1.1111',
- platform: some.platform,
+ editorVersion: '2099.1.1111',
+ targetPlatform: some.targetPlatform,
customImage: `${defaults.image}:2099.1.1111@347598437689743986`,
});
@@ -68,27 +67,27 @@ describe('ImageTag', () => {
});
it('returns the specific build platform', () => {
- const image = new ImageTag({ version: '2019.2.11f1', platform: 'WebGL' });
+ const image = new ImageTag({ editorVersion: '2019.2.11f1', targetPlatform: 'WebGL' });
switch (process.platform) {
case 'win32':
- expect(image.toString()).toStrictEqual(`${defaults.image}:windows-2019.2.11f1-webgl-0`);
+ expect(image.toString()).toStrictEqual(`${defaults.image}:windows-2019.2.11f1-webgl-1`);
break;
case 'linux':
- expect(image.toString()).toStrictEqual(`${defaults.image}:2019.2.11f1-webgl-0`);
+ expect(image.toString()).toStrictEqual(`${defaults.image}:ubuntu-2019.2.11f1-webgl-1`);
break;
}
});
it('returns no specific build platform for generic targetPlatforms', () => {
- const image = new ImageTag({ platform: 'NoTarget' });
+ const image = new ImageTag({ targetPlatform: 'NoTarget' });
switch (process.platform) {
case 'win32':
- expect(image.toString()).toStrictEqual(`${defaults.image}:windows-2019.2.11f1-0`);
+ expect(image.toString()).toStrictEqual(`${defaults.image}:windows-2019.2.11f1-1`);
break;
case 'linux':
- expect(image.toString()).toStrictEqual(`${defaults.image}:2019.2.11f1-0`);
+ expect(image.toString()).toStrictEqual(`${defaults.image}:ubuntu-2019.2.11f1-1`);
break;
}
});
diff --git a/src/model/image-tag.ts b/src/model/image-tag.ts
index 72f9f742..a28cf265 100644
--- a/src/model/image-tag.ts
+++ b/src/model/image-tag.ts
@@ -1,35 +1,42 @@
import Platform from './platform';
+import BuildParameters from './build-parameters';
class ImageTag {
public repository: string;
public name: string;
- public version: string;
- public platform: any;
+ public editorVersion: string;
+ public targetPlatform: any;
public builderPlatform: string;
public customImage: any;
+ public imageRollingVersion: number;
+ public imagePlatformPrefix: string;
- constructor(imageProperties) {
- const { repository = 'unityci', name = 'editor', version = '2019.2.11f1', platform, customImage } = imageProperties;
+ constructor(imageProperties: Partial) {
+ const { editorVersion = '2019.2.11f1', targetPlatform, customImage } = imageProperties;
- if (!ImageTag.versionPattern.test(version)) {
- throw new Error(`Invalid version "${version}".`);
+ if (!ImageTag.versionPattern.test(editorVersion)) {
+ throw new Error(`Invalid version "${editorVersion}".`);
}
- const builderPlatform = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
-
- this.repository = repository;
- this.name = name;
- this.version = version;
- this.platform = platform;
- this.builderPlatform = builderPlatform;
+ // Todo we might as well skip this class for customImage.
+ // Either
this.customImage = customImage;
+
+ // Or
+ this.repository = 'unityci';
+ this.name = 'editor';
+ this.editorVersion = editorVersion;
+ this.targetPlatform = targetPlatform;
+ this.builderPlatform = ImageTag.getTargetPlatformToTargetPlatformSuffixMap(targetPlatform, editorVersion);
+ this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes(process.platform);
+ this.imageRollingVersion = 1; // will automatically roll to the latest non-breaking version.
}
static get versionPattern() {
return /^20\d{2}\.\d\.\w{3,4}|3$/;
}
- static get imageSuffixes() {
+ static get targetPlatformSuffixes() {
return {
generic: '',
webgl: 'webgl',
@@ -46,9 +53,20 @@ class ImageTag {
};
}
- static getTargetPlatformToImageSuffixMap(platform, version) {
+ static getImagePlatformPrefixes(platform) {
+ switch (platform) {
+ case 'win32':
+ return 'windows';
+ case 'linux':
+ return 'ubuntu';
+ default:
+ throw new Error('The Operating System of this runner is not yet supported.');
+ }
+ }
+
+ static getTargetPlatformToTargetPlatformSuffixMap(platform, version) {
const { generic, webgl, mac, windows, windowsIl2cpp, wsaPlayer, linux, linuxIl2cpp, android, ios, tvos, facebook } =
- ImageTag.imageSuffixes;
+ ImageTag.targetPlatformSuffixes;
const [major, minor] = version.split('.').map((digit) => Number(digit));
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
@@ -120,15 +138,9 @@ class ImageTag {
}
get tag() {
- //We check the host os so we know what type of the images we need to pull
- switch (process.platform) {
- case 'win32':
- return `windows-${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
- case 'linux':
- return `${this.version}-${this.builderPlatform}`.replace(/-+$/, '');
- default:
- break;
- }
+ const versionAndPlatform = `${this.editorVersion}-${this.builderPlatform}`.replace(/-+$/, '');
+
+ return `${this.imagePlatformPrefix}-${versionAndPlatform}-${this.imageRollingVersion}`;
}
get image() {
@@ -138,11 +150,9 @@ class ImageTag {
toString() {
const { image, tag, customImage } = this;
- if (customImage && customImage !== '') {
- return customImage;
- }
+ if (customImage) return customImage;
- return `${image}:${tag}-0`; // '0' here represents the docker repo version
+ return `${image}:${tag}`; // '0' here represents the docker repo version
}
}
diff --git a/src/model/input.ts b/src/model/input.ts
index cee2ec47..2c52abd9 100644
--- a/src/model/input.ts
+++ b/src/model/input.ts
@@ -10,6 +10,8 @@ const core = require('@actions/core');
* Input variables specified in workflows using "with" prop.
*
* Note that input is always passed as a string, even booleans.
+ *
+ * Todo: rename to UserInput and remove anything that is not direct input from the user / ci workflow
*/
class Input {
public static cliOptions;
@@ -19,6 +21,7 @@ class Input {
static get cloudRunnerTests(): boolean {
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
}
+
private static getInput(query) {
const coreInput = core.getInput(query);
if (Input.githubInputEnabled && coreInput && coreInput !== '') {
@@ -33,19 +36,24 @@ class Input {
? process.env[Input.ToEnvVarFormat(query)]
: '';
}
+
static get region(): string {
return Input.getInput('region') || 'eu-west-2';
}
+
static async githubRepo() {
return (
Input.getInput('GITHUB_REPOSITORY') ||
Input.getInput('GITHUB_REPO') ||
+ // todo - move this to some class specific for determining additional information
(await GitRepoReader.GetRemote()) ||
'game-ci/unity-builder'
);
}
+
static async branch() {
if (await GitRepoReader.GetBranch()) {
+ // todo - move this to some class specific for determining additional information
return await GitRepoReader.GetBranch();
} else if (Input.getInput(`GITHUB_REF`)) {
return Input.getInput(`GITHUB_REF`).replace('refs/', '').replace(`head/`, '');
@@ -62,9 +70,11 @@ class Input {
} else if (Input.getInput(`GitSHA`)) {
return Input.getInput(`GitSHA`);
} else if (GitRepoReader.GetSha()) {
+ // todo - move this to some class specific for determining additional information
return GitRepoReader.GetSha();
}
}
+
static get runNumber() {
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
}
@@ -89,6 +99,7 @@ class Input {
!fs.existsSync(path.join('ProjectSettings', 'ProjectVersion.txt'))
? 'test-project'
: '.';
+
return rawProjectPath.replace(/\/$/, '');
}
@@ -197,6 +208,7 @@ class Input {
}
static async githubToken() {
+ // Todo - move GitHubCLI out of the simple input class. It is in fact not input from the user.
return Input.getInput('githubToken') || (await GithubCliReader.GetGitHubAuthToken()) || '';
}
diff --git a/src/model/platform-setup/setup-mac.ts b/src/model/platform-setup/setup-mac.ts
index 33175424..beb55195 100644
--- a/src/model/platform-setup/setup-mac.ts
+++ b/src/model/platform-setup/setup-mac.ts
@@ -7,7 +7,7 @@ class SetupMac {
static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
public static async setup(buildParameters: BuildParameters, actionFolder: string) {
- const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.version}/Unity.app/Contents/MacOS/Unity`;
+ const unityEditorPath = `/Applications/Unity/Hub/Editor/${buildParameters.editorVersion}/Unity.app/Contents/MacOS/Unity`;
// Only install unity if the editor doesn't already exist
if (!fs.existsSync(unityEditorPath)) {
@@ -31,9 +31,9 @@ class SetupMac {
}
private static async installUnity(buildParameters: BuildParameters, silent = false) {
- const unityChangeset = await getUnityChangeset(buildParameters.version);
+ const unityChangeset = await getUnityChangeset(buildParameters.editorVersion);
const command = `${this.unityHubPath} -- --headless install \
- --version ${buildParameters.version} \
+ --version ${buildParameters.editorVersion} \
--changeset ${unityChangeset.changeset} \
--module mac-il2cpp \
--childModules`;
@@ -50,10 +50,10 @@ class SetupMac {
// Need to set environment variables from here because we execute
// the scripts on the host for mac
process.env.ACTION_FOLDER = actionFolder;
- process.env.UNITY_VERSION = buildParameters.version;
+ process.env.UNITY_VERSION = buildParameters.editorVersion;
process.env.UNITY_SERIAL = buildParameters.unitySerial;
process.env.PROJECT_PATH = buildParameters.projectPath;
- process.env.BUILD_TARGET = buildParameters.platform;
+ process.env.BUILD_TARGET = buildParameters.targetPlatform;
process.env.BUILD_NAME = buildParameters.buildName;
process.env.BUILD_PATH = buildParameters.buildPath;
process.env.BUILD_FILE = buildParameters.buildFile;
diff --git a/src/model/platform-setup/setup-windows.ts b/src/model/platform-setup/setup-windows.ts
index ae38acbf..12f5a612 100644
--- a/src/model/platform-setup/setup-windows.ts
+++ b/src/model/platform-setup/setup-windows.ts
@@ -4,26 +4,27 @@ import { BuildParameters } from '..';
class SetupWindows {
public static async setup(buildParameters: BuildParameters) {
- await SetupWindows.setupWindowsRun(buildParameters.platform);
+ const { targetPlatform } = buildParameters;
+
+ await SetupWindows.setupWindowsRun(targetPlatform);
}
- //Setup prerequisite files/folders for a windows-based docker run
- private static async setupWindowsRun(platform, silent = false) {
+ private static async setupWindowsRun(targetPlatform, silent = false) {
if (!fs.existsSync('c:/regkeys')) {
fs.mkdirSync('c:/regkeys');
}
- switch (platform) {
+ switch (targetPlatform) {
//These all need the Windows 10 SDK
case 'StandaloneWindows':
case 'StandaloneWindows64':
case 'WSAPlayer':
- this.generateWinSDKRegKeys(silent);
+ await this.generateWinSDKRegKeys(silent);
break;
}
}
private static async generateWinSDKRegKeys(silent = false) {
- // Export registry keys that point to the location of the windows 10 sdk
+ // Export registry keys that point to the Windows 10 SDK
const exportWinSDKRegKeysCommand =
'reg export "HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0" c:/regkeys/winsdk.reg /y';
await exec(exportWinSDKRegKeysCommand, undefined, { silent });
diff --git a/src/model/platform-validation/validate-windows.ts b/src/model/platform-validation/validate-windows.ts
index c05b1e62..904502d2 100644
--- a/src/model/platform-validation/validate-windows.ts
+++ b/src/model/platform-validation/validate-windows.ts
@@ -3,7 +3,7 @@ import { BuildParameters } from '..';
class ValidateWindows {
public static validate(buildParameters: BuildParameters) {
- ValidateWindows.validateWindowsPlatformRequirements(buildParameters.platform);
+ ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform);
if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) {
throw new Error(`Unity email and password must be set for Windows based builds to
authenticate the license. Make sure to set them inside UNITY_EMAIL
diff --git a/src/model/versioning.test.ts b/src/model/versioning.test.ts
index 84f1f550..a5760562 100644
--- a/src/model/versioning.test.ts
+++ b/src/model/versioning.test.ts
@@ -116,7 +116,7 @@ describe('Versioning', () => {
});
});
- describe('descriptionRegex', () => {
+ describe('descriptionRegex1', () => {
it('is a valid regex', () => {
expect(Versioning.descriptionRegex1).toBeInstanceOf(RegExp);
});
@@ -137,19 +137,19 @@ describe('Versioning', () => {
test.each(['v0', 'v0.1', 'v0.1.2', 'v0.1-2', 'v0.1-2-g'])('does not like %s', (description) => {
expect(Versioning.descriptionRegex1.test(description)).toBeFalsy();
- // Also never expect without the v to work for any of these cases.
+ // Also, never expect without the v to work for any of these cases.
expect(Versioning.descriptionRegex1.test(description?.slice(1))).toBeFalsy();
});
});
- describe('determineVersion', () => {
+ describe('determineBuildVersion', () => {
test.each(['somethingRandom'])('throws for invalid strategy %s', async (strategy) => {
- await expect(Versioning.determineVersion(strategy, '')).rejects.toThrowErrorMatchingSnapshot();
+ await expect(Versioning.determineBuildVersion(strategy, '')).rejects.toThrowErrorMatchingSnapshot();
});
describe('opt out strategy', () => {
it("returns 'none'", async () => {
- await expect(Versioning.determineVersion('None', 'v1.0')).resolves.toMatchInlineSnapshot(`"none"`);
+ await expect(Versioning.determineBuildVersion('None', 'v1.0')).resolves.toMatchInlineSnapshot(`"none"`);
});
});
@@ -157,7 +157,7 @@ describe('Versioning', () => {
test.each(['v0.1', '1', 'CamelCase', 'dashed-version'])(
'returns the inputVersion for %s',
async (inputVersion) => {
- await expect(Versioning.determineVersion('Custom', inputVersion)).resolves.toStrictEqual(inputVersion);
+ await expect(Versioning.determineBuildVersion('Custom', inputVersion)).resolves.toStrictEqual(inputVersion);
},
);
});
@@ -166,7 +166,7 @@ describe('Versioning', () => {
it('refers to generateSemanticVersion', async () => {
const generateSemanticVersion = jest.spyOn(Versioning, 'generateSemanticVersion').mockResolvedValue('1.3.37');
- await expect(Versioning.determineVersion('Semantic', '')).resolves.toStrictEqual('1.3.37');
+ await expect(Versioning.determineBuildVersion('Semantic', '')).resolves.toStrictEqual('1.3.37');
expect(generateSemanticVersion).toHaveBeenCalledTimes(1);
});
});
@@ -175,7 +175,7 @@ describe('Versioning', () => {
it('refers to generateTagVersion', async () => {
const generateTagVersion = jest.spyOn(Versioning, 'generateTagVersion').mockResolvedValue('0.1');
- await expect(Versioning.determineVersion('Tag', '')).resolves.toStrictEqual('0.1');
+ await expect(Versioning.determineBuildVersion('Tag', '')).resolves.toStrictEqual('0.1');
expect(generateTagVersion).toHaveBeenCalledTimes(1);
});
});
@@ -185,7 +185,7 @@ describe('Versioning', () => {
const strategy = 'Test';
// @ts-ignore
jest.spyOn(Versioning, 'strategies', 'get').mockReturnValue({ [strategy]: strategy });
- await expect(Versioning.determineVersion(strategy, '')).rejects.toThrowError(NotImplementedException);
+ await expect(Versioning.determineBuildVersion(strategy, '')).rejects.toThrowError(NotImplementedException);
});
});
});
diff --git a/src/model/versioning.ts b/src/model/versioning.ts
index 79f43749..210d5b37 100644
--- a/src/model/versioning.ts
+++ b/src/model/versioning.ts
@@ -79,7 +79,7 @@ export default class Versioning {
return /^v?([\d.]+-\w+\.\d+)-(\d+)-g(\w+)-?(\w+)*/g;
}
- static async determineVersion(strategy: string, inputVersion: string) {
+ static async determineBuildVersion(strategy: string, inputVersion: string) {
// Validate input
if (!Object.hasOwnProperty.call(this.strategies, strategy)) {
throw new ValidationError(`Versioning strategy should be one of ${Object.values(this.strategies).join(', ')}.`);