Various fixes
commit
b969dbb14a
|
|
@ -245,8 +245,8 @@ class BuildParameters {
|
||||||
static create() {
|
static create() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidAppBundle);
|
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidAppBundle);
|
||||||
const unityVersion = unity_versioning_1.default.determineUnityVersion(input_1.default.projectPath, input_1.default.unityVersion);
|
const editorVersion = unity_versioning_1.default.determineUnityVersion(input_1.default.projectPath, input_1.default.unityVersion);
|
||||||
const buildVersion = yield versioning_1.default.determineVersion(input_1.default.versioningStrategy, input_1.default.specifiedVersion);
|
const buildVersion = yield versioning_1.default.determineBuildVersion(input_1.default.versioningStrategy, input_1.default.specifiedVersion);
|
||||||
const androidVersionCode = android_versioning_1.default.determineVersionCode(buildVersion, input_1.default.androidVersionCode);
|
const androidVersionCode = android_versioning_1.default.determineVersionCode(buildVersion, input_1.default.androidVersionCode);
|
||||||
const androidSdkManagerParameters = android_versioning_1.default.determineSdkManagerParameters(input_1.default.androidTargetSdkVersion);
|
const androidSdkManagerParameters = android_versioning_1.default.determineSdkManagerParameters(input_1.default.androidTargetSdkVersion);
|
||||||
// Todo - Don't use process.env directly, that's what the input model class is for.
|
// Todo - Don't use process.env directly, that's what the input model class is for.
|
||||||
|
|
@ -269,11 +269,11 @@ class BuildParameters {
|
||||||
core.setSecret(unitySerial);
|
core.setSecret(unitySerial);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
version: unityVersion,
|
editorVersion,
|
||||||
customImage: input_1.default.customImage,
|
customImage: input_1.default.customImage,
|
||||||
unitySerial,
|
unitySerial,
|
||||||
runnerTempPath: process.env.RUNNER_TEMP,
|
runnerTempPath: process.env.RUNNER_TEMP,
|
||||||
platform: input_1.default.targetPlatform,
|
targetPlatform: input_1.default.targetPlatform,
|
||||||
projectPath: input_1.default.projectPath,
|
projectPath: input_1.default.projectPath,
|
||||||
buildName: input_1.default.buildName,
|
buildName: input_1.default.buildName,
|
||||||
buildPath: `${input_1.default.buildsPath}/${input_1.default.targetPlatform}`,
|
buildPath: `${input_1.default.buildsPath}/${input_1.default.targetPlatform}`,
|
||||||
|
|
@ -501,6 +501,7 @@ const remote_client_logger_1 = __nccwpck_require__(28082);
|
||||||
const setup_cloud_runner_repository_1 = __nccwpck_require__(39656);
|
const setup_cloud_runner_repository_1 = __nccwpck_require__(39656);
|
||||||
const SDK = __importStar(__nccwpck_require__(71786));
|
const SDK = __importStar(__nccwpck_require__(71786));
|
||||||
const caching_1 = __nccwpck_require__(38759);
|
const caching_1 = __nccwpck_require__(38759);
|
||||||
|
const cloud_runner_query_override_1 = __importDefault(__nccwpck_require__(31011));
|
||||||
class CLI {
|
class CLI {
|
||||||
static InitCliMode() {
|
static InitCliMode() {
|
||||||
const program = new commander_ts_1.Command();
|
const program = new commander_ts_1.Command();
|
||||||
|
|
@ -514,6 +515,9 @@ class CLI {
|
||||||
.map((x) => `${x.key} (${x.description})`)
|
.map((x) => `${x.key} (${x.description})`)
|
||||||
.join(` | `));
|
.join(` | `));
|
||||||
program.option('--populateOverride <populate>', 'should use override query to pull input false by default');
|
program.option('--populateOverride <populate>', 'should use override query to pull input false by default');
|
||||||
|
program.option('--cachePushFrom <cachePushFrom>', 'cache push from source folder');
|
||||||
|
program.option('--cachePushTo <cachePushTo>', 'cache push to caching folder');
|
||||||
|
program.option('--artifactName <artifactName>', 'caching artifact name');
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
CLI.options = program.opts();
|
CLI.options = program.opts();
|
||||||
__1.Input.cliOptions = CLI.options;
|
__1.Input.cliOptions = CLI.options;
|
||||||
|
|
@ -523,7 +527,7 @@ class CLI {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
__1.Input.githubInputEnabled = false;
|
__1.Input.githubInputEnabled = false;
|
||||||
if (CLI.options['populate'] === `true`) {
|
if (CLI.options['populate'] === `true`) {
|
||||||
yield __1.Input.PopulateQueryOverrideInput();
|
yield cloud_runner_query_override_1.default.PopulateQueryOverrideInput();
|
||||||
}
|
}
|
||||||
CLI.logInput();
|
CLI.logInput();
|
||||||
const results = cli_decorator_1.GetCliFunctions(CLI.options.mode);
|
const results = cli_decorator_1.GetCliFunctions(CLI.options.mode);
|
||||||
|
|
@ -2185,7 +2189,7 @@ class KubernetesJobSpecFactory {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'BUILD_TARGET',
|
name: 'BUILD_TARGET',
|
||||||
value: buildParameters.platform,
|
value: buildParameters.targetPlatform,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ANDROID_VERSION_CODE',
|
name: 'ANDROID_VERSION_CODE',
|
||||||
|
|
@ -2873,6 +2877,70 @@ class CloudRunnerNamespace {
|
||||||
exports["default"] = CloudRunnerNamespace;
|
exports["default"] = CloudRunnerNamespace;
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 31011:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||||
|
const generic_input_reader_1 = __nccwpck_require__(2263);
|
||||||
|
const formatFunction = (value, arguments_) => {
|
||||||
|
for (const element of arguments_) {
|
||||||
|
value = value.replace(`{${element.key}}`, element.value);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
class CloudRunnerQueryOverride {
|
||||||
|
static shouldUseOverride(query) {
|
||||||
|
if (input_1.default.readInputOverrideCommand() !== '') {
|
||||||
|
if (input_1.default.readInputFromOverrideList() !== '') {
|
||||||
|
const doesInclude = input_1.default.readInputFromOverrideList().split(',').includes(query) ||
|
||||||
|
input_1.default.readInputFromOverrideList().split(',').includes(input_1.default.ToEnvVarFormat(query));
|
||||||
|
return doesInclude ? true : false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static queryOverride(query) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!this.shouldUseOverride(query)) {
|
||||||
|
throw new Error(`Should not be trying to run override query on ${query}`);
|
||||||
|
}
|
||||||
|
return yield generic_input_reader_1.GenericInputReader.Run(formatFunction(input_1.default.readInputOverrideCommand(), [{ key: 0, value: query }]));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
static PopulateQueryOverrideInput() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const queries = input_1.default.readInputFromOverrideList().split(',');
|
||||||
|
input_1.default.queryOverrides = new Array();
|
||||||
|
for (const element of queries) {
|
||||||
|
if (CloudRunnerQueryOverride.shouldUseOverride(element)) {
|
||||||
|
input_1.default.queryOverrides[element] = yield CloudRunnerQueryOverride.queryOverride(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports["default"] = CloudRunnerQueryOverride;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 69862:
|
/***/ 69862:
|
||||||
|
|
@ -2948,7 +3016,7 @@ class TaskParameterSerializer {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'BUILD_TARGET',
|
name: 'BUILD_TARGET',
|
||||||
value: __1.CloudRunner.buildParameters.platform,
|
value: __1.CloudRunner.buildParameters.targetPlatform,
|
||||||
},
|
},
|
||||||
...TaskParameterSerializer.serializeBuildParamsAndInput,
|
...TaskParameterSerializer.serializeBuildParamsAndInput,
|
||||||
];
|
];
|
||||||
|
|
@ -3140,12 +3208,11 @@ class BuildAutomationWorkflow {
|
||||||
}
|
}
|
||||||
static get SetupCommands() {
|
static get SetupCommands() {
|
||||||
return `export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
return `export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
||||||
echo "cloning"
|
echo "cloning game ci"
|
||||||
mkdir -p ${cloud_runner_folders_1.CloudRunnerFolders.builderPathFull.replace(/\\/g, `/`)}
|
mkdir -p ${cloud_runner_folders_1.CloudRunnerFolders.builderPathFull.replace(/\\/g, `/`)}
|
||||||
git clone -q -b ${cloud_runner_1.default.buildParameters.cloudRunnerBranch} ${cloud_runner_folders_1.CloudRunnerFolders.unityBuilderRepoUrl} "${cloud_runner_folders_1.CloudRunnerFolders.builderPathFull.replace(/\\/g, `/`)}"
|
git clone -q -b ${cloud_runner_1.default.buildParameters.cloudRunnerBranch} ${cloud_runner_folders_1.CloudRunnerFolders.unityBuilderRepoUrl} "${cloud_runner_folders_1.CloudRunnerFolders.builderPathFull.replace(/\\/g, `/`)}"
|
||||||
${cloud_runner_1.default.buildParameters.cloudRunnerIntegrationTests ? '' : '#'} tree ${cloud_runner_folders_1.CloudRunnerFolders.builderPathFull.replace(/\\/g, `/`)}
|
|
||||||
chmod +x ${path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)}
|
chmod +x ${path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)}
|
||||||
echo "caching"
|
echo "cloud runner remote cli"
|
||||||
node --version
|
node --version
|
||||||
node ${path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)} -m remote-cli`;
|
node ${path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)} -m remote-cli`;
|
||||||
}
|
}
|
||||||
|
|
@ -3451,10 +3518,10 @@ class ImageEnvironmentFactory {
|
||||||
{ name: 'UNITY_EMAIL', value: process.env.UNITY_EMAIL },
|
{ name: 'UNITY_EMAIL', value: process.env.UNITY_EMAIL },
|
||||||
{ name: 'UNITY_PASSWORD', value: process.env.UNITY_PASSWORD },
|
{ name: 'UNITY_PASSWORD', value: process.env.UNITY_PASSWORD },
|
||||||
{ name: 'UNITY_SERIAL', value: parameters.unitySerial },
|
{ 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: 'USYM_UPLOAD_AUTH_TOKEN', value: process.env.USYM_UPLOAD_AUTH_TOKEN },
|
||||||
{ name: 'PROJECT_PATH', value: parameters.projectPath },
|
{ 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_NAME', value: parameters.buildName },
|
||||||
{ name: 'BUILD_PATH', value: parameters.buildPath },
|
{ name: 'BUILD_PATH', value: parameters.buildPath },
|
||||||
{ name: 'BUILD_FILE', value: parameters.buildFile },
|
{ name: 'BUILD_FILE', value: parameters.buildFile },
|
||||||
|
|
@ -3507,23 +3574,27 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
||||||
class ImageTag {
|
class ImageTag {
|
||||||
constructor(imageProperties) {
|
constructor(imageProperties) {
|
||||||
const { repository = 'unityci', name = 'editor', version = '2019.2.11f1', platform, cloudRunnerBuilderPlatform, customImage, } = imageProperties;
|
const { editorVersion = '2019.2.11f1', targetPlatform, customImage, cloudRunnerBuilderPlatform } = imageProperties;
|
||||||
if (!ImageTag.versionPattern.test(version)) {
|
if (!ImageTag.versionPattern.test(editorVersion)) {
|
||||||
throw new Error(`Invalid version "${version}".`);
|
throw new Error(`Invalid version "${editorVersion}".`);
|
||||||
}
|
}
|
||||||
const builderPlatformSuffix = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
// Todo we might as well skip this class for customImage.
|
||||||
this.repository = repository;
|
// Either
|
||||||
this.name = name;
|
|
||||||
this.version = version;
|
|
||||||
this.platform = platform;
|
|
||||||
this.builderPlatformSuffix = builderPlatformSuffix;
|
|
||||||
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
|
|
||||||
this.customImage = customImage;
|
this.customImage = customImage;
|
||||||
|
// Or
|
||||||
|
this.repository = 'unityci';
|
||||||
|
this.name = 'editor';
|
||||||
|
this.editorVersion = editorVersion;
|
||||||
|
this.targetPlatform = targetPlatform;
|
||||||
|
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
|
||||||
|
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() {
|
static get versionPattern() {
|
||||||
return /^20\d{2}\.\d\.\w{3,4}|3$/;
|
return /^20\d{2}\.\d\.\w{3,4}|3$/;
|
||||||
}
|
}
|
||||||
static get imageSuffixes() {
|
static get targetPlatformSuffixes() {
|
||||||
return {
|
return {
|
||||||
generic: '',
|
generic: '',
|
||||||
webgl: 'webgl',
|
webgl: 'webgl',
|
||||||
|
|
@ -3539,8 +3610,18 @@ class ImageTag {
|
||||||
facebook: 'facebook',
|
facebook: 'facebook',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
static getTargetPlatformToImageSuffixMap(platform, version) {
|
static getImagePlatformPrefixes(platform) {
|
||||||
const { generic, webgl, mac, windows, windowsIl2cpp, wsaPlayer, linux, linuxIl2cpp, android, ios, tvos, facebook } = ImageTag.imageSuffixes;
|
switch (platform) {
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
case 'linux':
|
||||||
|
return 'ubuntu';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static getTargetPlatformToTargetPlatformSuffixMap(platform, version) {
|
||||||
|
const { generic, webgl, mac, windows, windowsIl2cpp, wsaPlayer, linux, linuxIl2cpp, android, ios, tvos, facebook } = ImageTag.targetPlatformSuffixes;
|
||||||
const [major, minor] = version.split('.').map((digit) => Number(digit));
|
const [major, minor] = version.split('.').map((digit) => Number(digit));
|
||||||
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
|
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
|
|
@ -3610,26 +3691,17 @@ class ImageTag {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get tag() {
|
get tag() {
|
||||||
const tagPlatform = this.cloudRunnerBuilderPlatform ? this.cloudRunnerBuilderPlatform : process.platform;
|
const versionAndPlatform = `${this.editorVersion}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||||
//We check the host os so we know what type of the images we need to pull
|
return `${this.cloudRunnerBuilderPlatform ? this.cloudRunnerBuilderPlatform : this.imagePlatformPrefix}-${versionAndPlatform}-${this.imageRollingVersion}`;
|
||||||
switch (tagPlatform) {
|
|
||||||
case 'win32':
|
|
||||||
return `windows-${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
|
||||||
case 'linux':
|
|
||||||
return `${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
get image() {
|
get image() {
|
||||||
return `${this.repository}/${this.name}`.replace(/^\/+/, '');
|
return `${this.repository}/${this.name}`.replace(/^\/+/, '');
|
||||||
}
|
}
|
||||||
toString() {
|
toString() {
|
||||||
const { image, tag, customImage } = this;
|
const { image, tag, customImage } = this;
|
||||||
if (customImage && customImage !== '') {
|
if (customImage)
|
||||||
return customImage;
|
return customImage;
|
||||||
}
|
return `${image}:${tag}`; // '0' here represents the docker repo version
|
||||||
return `${image}:${tag}-0`; // '0' here represents the docker repo version
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports["default"] = ImageTag;
|
exports["default"] = ImageTag;
|
||||||
|
|
@ -3868,74 +3940,29 @@ exports.ReadLicense = ReadLicense;
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(57147));
|
const fs_1 = __importDefault(__nccwpck_require__(57147));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(71017));
|
const path_1 = __importDefault(__nccwpck_require__(71017));
|
||||||
const generic_input_reader_1 = __nccwpck_require__(2263);
|
|
||||||
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
||||||
const formatFunction = (value, arguments_) => {
|
|
||||||
for (const element of arguments_) {
|
|
||||||
value = value.replace(`{${element.key}}`, element.value);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
};
|
|
||||||
const core = __nccwpck_require__(42186);
|
const core = __nccwpck_require__(42186);
|
||||||
/**
|
/**
|
||||||
* Input variables specified in workflows using "with" prop.
|
* Input variables specified in workflows using "with" prop.
|
||||||
*
|
*
|
||||||
* Note that input is always passed as a string, even booleans.
|
* 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 {
|
class Input {
|
||||||
// also enabled debug logging for cloud runner
|
// also enabled debug logging for cloud runner
|
||||||
static get cloudRunnerTests() {
|
static get cloudRunnerTests() {
|
||||||
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
|
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
|
||||||
}
|
}
|
||||||
static shouldUseOverride(query) {
|
|
||||||
if (Input.readInputOverrideCommand() !== '') {
|
|
||||||
if (Input.readInputFromOverrideList() !== '') {
|
|
||||||
const doesInclude = Input.readInputFromOverrideList().split(',').includes(query) ||
|
|
||||||
Input.readInputFromOverrideList().split(',').includes(Input.ToEnvVarFormat(query));
|
|
||||||
return doesInclude ? true : false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static get cliMode() {
|
static get cliMode() {
|
||||||
return Input.cliOptions !== undefined && Input.cliOptions.mode !== undefined && Input.cliOptions.mode !== '';
|
return Input.cliOptions !== undefined && Input.cliOptions.mode !== undefined && Input.cliOptions.mode !== '';
|
||||||
}
|
}
|
||||||
static queryOverride(query) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
if (!this.shouldUseOverride(query)) {
|
|
||||||
throw new Error(`Should not be trying to run override query on ${query}`);
|
|
||||||
}
|
|
||||||
return yield generic_input_reader_1.GenericInputReader.Run(formatFunction(Input.readInputOverrideCommand(), [{ key: 0, value: query }]));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
static PopulateQueryOverrideInput() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const queries = Input.readInputFromOverrideList().split(',');
|
|
||||||
Input.queryOverrides = new Array();
|
|
||||||
for (const element of queries) {
|
|
||||||
if (Input.shouldUseOverride(element)) {
|
|
||||||
Input.queryOverrides[element] = yield Input.queryOverride(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
static getInput(query) {
|
static getInput(query) {
|
||||||
const coreInput = core.getInput(query);
|
const coreInput = core.getInput(query);
|
||||||
if (Input.githubInputEnabled && coreInput && coreInput !== '') {
|
if (Input.githubInputEnabled && coreInput && coreInput !== '') {
|
||||||
|
|
@ -4283,7 +4310,7 @@ const fs_1 = __importDefault(__nccwpck_require__(57147));
|
||||||
class SetupMac {
|
class SetupMac {
|
||||||
static setup(buildParameters, actionFolder) {
|
static setup(buildParameters, actionFolder) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
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
|
// Only install unity if the editor doesn't already exist
|
||||||
if (!fs_1.default.existsSync(unityEditorPath)) {
|
if (!fs_1.default.existsSync(unityEditorPath)) {
|
||||||
yield SetupMac.installUnityHub();
|
yield SetupMac.installUnityHub();
|
||||||
|
|
@ -4307,9 +4334,9 @@ class SetupMac {
|
||||||
}
|
}
|
||||||
static installUnity(buildParameters, silent = false) {
|
static installUnity(buildParameters, silent = false) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const unityChangeset = yield unity_changeset_1.getUnityChangeset(buildParameters.version);
|
const unityChangeset = yield unity_changeset_1.getUnityChangeset(buildParameters.editorVersion);
|
||||||
const command = `${this.unityHubPath} -- --headless install \
|
const command = `${this.unityHubPath} -- --headless install \
|
||||||
--version ${buildParameters.version} \
|
--version ${buildParameters.editorVersion} \
|
||||||
--changeset ${unityChangeset.changeset} \
|
--changeset ${unityChangeset.changeset} \
|
||||||
--module mac-il2cpp \
|
--module mac-il2cpp \
|
||||||
--childModules`;
|
--childModules`;
|
||||||
|
|
@ -4326,10 +4353,10 @@ class SetupMac {
|
||||||
// Need to set environment variables from here because we execute
|
// Need to set environment variables from here because we execute
|
||||||
// the scripts on the host for mac
|
// the scripts on the host for mac
|
||||||
process.env.ACTION_FOLDER = actionFolder;
|
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.UNITY_SERIAL = buildParameters.unitySerial;
|
||||||
process.env.PROJECT_PATH = buildParameters.projectPath;
|
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_NAME = buildParameters.buildName;
|
||||||
process.env.BUILD_PATH = buildParameters.buildPath;
|
process.env.BUILD_PATH = buildParameters.buildPath;
|
||||||
process.env.BUILD_FILE = buildParameters.buildFile;
|
process.env.BUILD_FILE = buildParameters.buildFile;
|
||||||
|
|
@ -4377,28 +4404,28 @@ const fs_1 = __importDefault(__nccwpck_require__(57147));
|
||||||
class SetupWindows {
|
class SetupWindows {
|
||||||
static setup(buildParameters) {
|
static setup(buildParameters) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
yield SetupWindows.setupWindowsRun(buildParameters.platform);
|
const { targetPlatform } = buildParameters;
|
||||||
|
yield SetupWindows.setupWindowsRun(targetPlatform);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//Setup prerequisite files/folders for a windows-based docker run
|
static setupWindowsRun(targetPlatform, silent = false) {
|
||||||
static setupWindowsRun(platform, silent = false) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (!fs_1.default.existsSync('c:/regkeys')) {
|
if (!fs_1.default.existsSync('c:/regkeys')) {
|
||||||
fs_1.default.mkdirSync('c:/regkeys');
|
fs_1.default.mkdirSync('c:/regkeys');
|
||||||
}
|
}
|
||||||
switch (platform) {
|
switch (targetPlatform) {
|
||||||
//These all need the Windows 10 SDK
|
//These all need the Windows 10 SDK
|
||||||
case 'StandaloneWindows':
|
case 'StandaloneWindows':
|
||||||
case 'StandaloneWindows64':
|
case 'StandaloneWindows64':
|
||||||
case 'WSAPlayer':
|
case 'WSAPlayer':
|
||||||
this.generateWinSDKRegKeys(silent);
|
yield this.generateWinSDKRegKeys(silent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
static generateWinSDKRegKeys(silent = false) {
|
static generateWinSDKRegKeys(silent = false) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// 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';
|
const exportWinSDKRegKeysCommand = 'reg export "HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0" c:/regkeys/winsdk.reg /y';
|
||||||
yield exec_1.exec(exportWinSDKRegKeysCommand, undefined, { silent });
|
yield exec_1.exec(exportWinSDKRegKeysCommand, undefined, { silent });
|
||||||
});
|
});
|
||||||
|
|
@ -4421,7 +4448,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const fs_1 = __importDefault(__nccwpck_require__(57147));
|
const fs_1 = __importDefault(__nccwpck_require__(57147));
|
||||||
class ValidateWindows {
|
class ValidateWindows {
|
||||||
static validate(buildParameters) {
|
static validate(buildParameters) {
|
||||||
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.platform);
|
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform);
|
||||||
if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) {
|
if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) {
|
||||||
throw new Error(`Unity email and password must be set for Windows based builds to
|
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
|
authenticate the license. Make sure to set them inside UNITY_EMAIL
|
||||||
|
|
@ -4839,7 +4866,7 @@ class Versioning {
|
||||||
static get descriptionRegex3() {
|
static get descriptionRegex3() {
|
||||||
return /^v?([\d.]+-\w+\.\d+)-(\d+)-g(\w+)-?(\w+)*/g;
|
return /^v?([\d.]+-\w+\.\d+)-(\d+)-g(\w+)-?(\w+)*/g;
|
||||||
}
|
}
|
||||||
static determineVersion(strategy, inputVersion) {
|
static determineBuildVersion(strategy, inputVersion) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Validate input
|
// Validate input
|
||||||
if (!Object.hasOwnProperty.call(this.strategies, strategy)) {
|
if (!Object.hasOwnProperty.call(this.strategies, strategy)) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -2,7 +2,7 @@
|
||||||
import Platform from '../platform';
|
import Platform from '../platform';
|
||||||
|
|
||||||
export const mockGetFromUser = jest.fn().mockResolvedValue({
|
export const mockGetFromUser = jest.fn().mockResolvedValue({
|
||||||
version: '',
|
editorVersion: '',
|
||||||
targetPlatform: Platform.types.Test,
|
targetPlatform: Platform.types.Test,
|
||||||
projectPath: '.',
|
projectPath: '.',
|
||||||
buildName: Platform.types.Test,
|
buildName: Platform.types.Test,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// 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."`;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ const testLicense =
|
||||||
'<?xml version="1.0" encoding="UTF-8"?><root>\n <License id="Terms">\n <MachineBindings>\n <Binding Key="1" Value="576562626572264761624c65526f7578"/>\n <Binding Key="2" Value="576562626572264761624c65526f7578"/>\n </MachineBindings>\n <MachineID Value="D7nTUnjNAmtsUMcnoyrqkgIbYdM="/>\n <SerialHash Value="2033b8ac3e6faa3742ca9f0bfae44d18f2a96b80"/>\n <Features>\n <Feature Value="33"/>\n <Feature Value="1"/>\n <Feature Value="12"/>\n <Feature Value="2"/>\n <Feature Value="24"/>\n <Feature Value="3"/>\n <Feature Value="36"/>\n <Feature Value="17"/>\n <Feature Value="19"/>\n <Feature Value="62"/>\n </Features>\n <DeveloperData Value="AQAAAEY0LUJHUlgtWEQ0RS1aQ1dWLUM1SlctR0RIQg=="/>\n <SerialMasked Value="F4-BGRX-XD4E-ZCWV-C5JW-XXXX"/>\n <StartDate Value="2021-02-08T00:00:00"/>\n <UpdateDate Value="2021-02-09T00:34:57"/>\n <InitialActivationDate Value="2021-02-08T00:34:56"/>\n <LicenseVersion Value="6.x"/>\n <ClientProvidedVersion Value="2018.4.30f1"/>\n <AlwaysOnline Value="false"/>\n <Entitlements>\n <Entitlement Ns="unity_editor" Tag="UnityPersonal" Type="EDITOR" ValidTo="9999-12-31T00:00:00"/>\n <Entitlement Ns="unity_editor" Tag="DarkSkin" Type="EDITOR_FEATURE" ValidTo="9999-12-31T00:00:00"/>\n </Entitlements>\n </License>\n<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><Reference URI="#Terms"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>m0Db8UK+ktnOLJBtHybkfetpcKo=</DigestValue></Reference></SignedInfo><SignatureValue>o/pUbSQAukz7+ZYAWhnA0AJbIlyyCPL7bKVEM2lVqbrXt7cyey+umkCXamuOgsWPVUKBMkXtMH8L\n5etLmD0getWIhTGhzOnDCk+gtIPfL4jMo9tkEuOCROQAXCci23VFscKcrkB+3X6h4wEOtA2APhOY\nB+wvC794o8/82ffjP79aVAi57rp3Wmzx+9pe9yMwoJuljAy2sc2tIMgdQGWVmOGBpQm3JqsidyzI\nJWG2kjnc7pDXK9pwYzXoKiqUqqrut90d+kQqRyv7MSZXR50HFqD/LI69h68b7P8Bjo3bPXOhNXGR\n9YCoemH6EkfCJxp2gIjzjWW+l2Hj2EsFQi8YXw==</SignatureValue></Signature></root>';
|
'<?xml version="1.0" encoding="UTF-8"?><root>\n <License id="Terms">\n <MachineBindings>\n <Binding Key="1" Value="576562626572264761624c65526f7578"/>\n <Binding Key="2" Value="576562626572264761624c65526f7578"/>\n </MachineBindings>\n <MachineID Value="D7nTUnjNAmtsUMcnoyrqkgIbYdM="/>\n <SerialHash Value="2033b8ac3e6faa3742ca9f0bfae44d18f2a96b80"/>\n <Features>\n <Feature Value="33"/>\n <Feature Value="1"/>\n <Feature Value="12"/>\n <Feature Value="2"/>\n <Feature Value="24"/>\n <Feature Value="3"/>\n <Feature Value="36"/>\n <Feature Value="17"/>\n <Feature Value="19"/>\n <Feature Value="62"/>\n </Features>\n <DeveloperData Value="AQAAAEY0LUJHUlgtWEQ0RS1aQ1dWLUM1SlctR0RIQg=="/>\n <SerialMasked Value="F4-BGRX-XD4E-ZCWV-C5JW-XXXX"/>\n <StartDate Value="2021-02-08T00:00:00"/>\n <UpdateDate Value="2021-02-09T00:34:57"/>\n <InitialActivationDate Value="2021-02-08T00:34:56"/>\n <LicenseVersion Value="6.x"/>\n <ClientProvidedVersion Value="2018.4.30f1"/>\n <AlwaysOnline Value="false"/>\n <Entitlements>\n <Entitlement Ns="unity_editor" Tag="UnityPersonal" Type="EDITOR" ValidTo="9999-12-31T00:00:00"/>\n <Entitlement Ns="unity_editor" Tag="DarkSkin" Type="EDITOR_FEATURE" ValidTo="9999-12-31T00:00:00"/>\n </Entitlements>\n </License>\n<Signature xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><Reference URI="#Terms"><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><DigestValue>m0Db8UK+ktnOLJBtHybkfetpcKo=</DigestValue></Reference></SignedInfo><SignatureValue>o/pUbSQAukz7+ZYAWhnA0AJbIlyyCPL7bKVEM2lVqbrXt7cyey+umkCXamuOgsWPVUKBMkXtMH8L\n5etLmD0getWIhTGhzOnDCk+gtIPfL4jMo9tkEuOCROQAXCci23VFscKcrkB+3X6h4wEOtA2APhOY\nB+wvC794o8/82ffjP79aVAi57rp3Wmzx+9pe9yMwoJuljAy2sc2tIMgdQGWVmOGBpQm3JqsidyzI\nJWG2kjnc7pDXK9pwYzXoKiqUqqrut90d+kQqRyv7MSZXR50HFqD/LI69h68b7P8Bjo3bPXOhNXGR\n9YCoemH6EkfCJxp2gIjzjWW+l2Hj2EsFQi8YXw==</SignatureValue></Signature></root>';
|
||||||
process.env.UNITY_LICENSE = testLicense;
|
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
|
const determineUnityVersion = jest
|
||||||
.spyOn(UnityVersioning, 'determineUnityVersion')
|
.spyOn(UnityVersioning, 'determineUnityVersion')
|
||||||
.mockImplementation(() => '2019.2.11f1');
|
.mockImplementation(() => '2019.2.11f1');
|
||||||
|
|
@ -55,10 +55,10 @@ describe('BuildParameters', () => {
|
||||||
expect(determineSdkManagerParameters).toHaveBeenCalledTimes(1);
|
expect(determineSdkManagerParameters).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns the platform', async () => {
|
it('returns the targetPlatform', async () => {
|
||||||
const mockValue = 'somePlatform';
|
const mockValue = 'somePlatform';
|
||||||
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(mockValue);
|
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 () => {
|
it('returns the project path', async () => {
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ import { GitRepoReader } from './input-readers/git-repo';
|
||||||
import { GithubCliReader } from './input-readers/github-cli';
|
import { GithubCliReader } from './input-readers/github-cli';
|
||||||
|
|
||||||
class BuildParameters {
|
class BuildParameters {
|
||||||
public version!: string;
|
public editorVersion!: string;
|
||||||
public customImage!: string;
|
public customImage!: string;
|
||||||
public unitySerial!: string;
|
public unitySerial!: string;
|
||||||
public runnerTempPath: string | undefined;
|
public runnerTempPath: string | undefined;
|
||||||
public platform!: string;
|
public targetPlatform!: string;
|
||||||
public projectPath!: string;
|
public projectPath!: string;
|
||||||
public buildName!: string;
|
public buildName!: string;
|
||||||
public buildPath!: string;
|
public buildPath!: string;
|
||||||
|
|
@ -69,8 +69,8 @@ class BuildParameters {
|
||||||
|
|
||||||
static async create(): Promise<BuildParameters> {
|
static async create(): Promise<BuildParameters> {
|
||||||
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidAppBundle);
|
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidAppBundle);
|
||||||
const unityVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
|
const editorVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
|
||||||
const buildVersion = await Versioning.determineVersion(Input.versioningStrategy, Input.specifiedVersion);
|
const buildVersion = await Versioning.determineBuildVersion(Input.versioningStrategy, Input.specifiedVersion);
|
||||||
const androidVersionCode = AndroidVersioning.determineVersionCode(buildVersion, Input.androidVersionCode);
|
const androidVersionCode = AndroidVersioning.determineVersionCode(buildVersion, Input.androidVersionCode);
|
||||||
const androidSdkManagerParameters = AndroidVersioning.determineSdkManagerParameters(Input.androidTargetSdkVersion);
|
const androidSdkManagerParameters = AndroidVersioning.determineSdkManagerParameters(Input.androidTargetSdkVersion);
|
||||||
|
|
||||||
|
|
@ -94,12 +94,12 @@ class BuildParameters {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
version: unityVersion,
|
editorVersion,
|
||||||
customImage: Input.customImage,
|
customImage: Input.customImage,
|
||||||
unitySerial,
|
unitySerial,
|
||||||
|
|
||||||
runnerTempPath: process.env.RUNNER_TEMP,
|
runnerTempPath: process.env.RUNNER_TEMP,
|
||||||
platform: Input.targetPlatform,
|
targetPlatform: Input.targetPlatform,
|
||||||
projectPath: Input.projectPath,
|
projectPath: Input.projectPath,
|
||||||
buildName: Input.buildName,
|
buildName: Input.buildName,
|
||||||
buildPath: `${Input.buildsPath}/${Input.targetPlatform}`,
|
buildPath: `${Input.buildsPath}/${Input.targetPlatform}`,
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { RemoteClientLogger } from './remote-client/remote-client-services/remot
|
||||||
import { SetupCloudRunnerRepository } from './remote-client/setup-cloud-runner-repository';
|
import { SetupCloudRunnerRepository } from './remote-client/setup-cloud-runner-repository';
|
||||||
import * as SDK from 'aws-sdk';
|
import * as SDK from 'aws-sdk';
|
||||||
import { Caching } from './remote-client/remote-client-services/caching';
|
import { Caching } from './remote-client/remote-client-services/caching';
|
||||||
|
import CloudRunnerQueryOverride from '../cloud-runner/services/cloud-runner-query-override';
|
||||||
|
|
||||||
export class CLI {
|
export class CLI {
|
||||||
private static options;
|
private static options;
|
||||||
|
|
@ -27,6 +28,9 @@ export class CLI {
|
||||||
.join(` | `),
|
.join(` | `),
|
||||||
);
|
);
|
||||||
program.option('--populateOverride <populate>', 'should use override query to pull input false by default');
|
program.option('--populateOverride <populate>', 'should use override query to pull input false by default');
|
||||||
|
program.option('--cachePushFrom <cachePushFrom>', 'cache push from source folder');
|
||||||
|
program.option('--cachePushTo <cachePushTo>', 'cache push to caching folder');
|
||||||
|
program.option('--artifactName <artifactName>', 'caching artifact name');
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
CLI.options = program.opts();
|
CLI.options = program.opts();
|
||||||
Input.cliOptions = CLI.options;
|
Input.cliOptions = CLI.options;
|
||||||
|
|
@ -36,7 +40,7 @@ export class CLI {
|
||||||
static async RunCli(): Promise<void> {
|
static async RunCli(): Promise<void> {
|
||||||
Input.githubInputEnabled = false;
|
Input.githubInputEnabled = false;
|
||||||
if (CLI.options['populate'] === `true`) {
|
if (CLI.options['populate'] === `true`) {
|
||||||
await Input.PopulateQueryOverrideInput();
|
await CloudRunnerQueryOverride.PopulateQueryOverrideInput();
|
||||||
}
|
}
|
||||||
CLI.logInput();
|
CLI.logInput();
|
||||||
const results = GetCliFunctions(CLI.options.mode);
|
const results = GetCliFunctions(CLI.options.mode);
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class KubernetesJobSpecFactory {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'BUILD_TARGET',
|
name: 'BUILD_TARGET',
|
||||||
value: buildParameters.platform,
|
value: buildParameters.targetPlatform,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'ANDROID_VERSION_CODE',
|
name: 'ANDROID_VERSION_CODE',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
import Input from '../../input';
|
||||||
|
import { GenericInputReader } from '../../input-readers/generic-input-reader';
|
||||||
|
|
||||||
|
const formatFunction = (value, arguments_) => {
|
||||||
|
for (const element of arguments_) {
|
||||||
|
value = value.replace(`{${element.key}}`, element.value);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CloudRunnerQueryOverride {
|
||||||
|
private static shouldUseOverride(query) {
|
||||||
|
if (Input.readInputOverrideCommand() !== '') {
|
||||||
|
if (Input.readInputFromOverrideList() !== '') {
|
||||||
|
const doesInclude =
|
||||||
|
Input.readInputFromOverrideList().split(',').includes(query) ||
|
||||||
|
Input.readInputFromOverrideList().split(',').includes(Input.ToEnvVarFormat(query));
|
||||||
|
return doesInclude ? true : false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async queryOverride(query) {
|
||||||
|
if (!this.shouldUseOverride(query)) {
|
||||||
|
throw new Error(`Should not be trying to run override query on ${query}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await GenericInputReader.Run(formatFunction(Input.readInputOverrideCommand(), [{ key: 0, value: query }]));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async PopulateQueryOverrideInput() {
|
||||||
|
const queries = Input.readInputFromOverrideList().split(',');
|
||||||
|
Input.queryOverrides = new Array();
|
||||||
|
for (const element of queries) {
|
||||||
|
if (CloudRunnerQueryOverride.shouldUseOverride(element)) {
|
||||||
|
Input.queryOverrides[element] = await CloudRunnerQueryOverride.queryOverride(element);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default CloudRunnerQueryOverride;
|
||||||
|
|
@ -17,7 +17,7 @@ export class TaskParameterSerializer {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'BUILD_TARGET',
|
name: 'BUILD_TARGET',
|
||||||
value: CloudRunner.buildParameters.platform,
|
value: CloudRunner.buildParameters.targetPlatform,
|
||||||
},
|
},
|
||||||
...TaskParameterSerializer.serializeBuildParamsAndInput,
|
...TaskParameterSerializer.serializeBuildParamsAndInput,
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -83,16 +83,13 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
||||||
|
|
||||||
private static get SetupCommands() {
|
private static get SetupCommands() {
|
||||||
return `export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
return `export GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
||||||
echo "cloning"
|
echo "cloning game ci"
|
||||||
mkdir -p ${CloudRunnerFolders.builderPathFull.replace(/\\/g, `/`)}
|
mkdir -p ${CloudRunnerFolders.builderPathFull.replace(/\\/g, `/`)}
|
||||||
git clone -q -b ${CloudRunner.buildParameters.cloudRunnerBranch} ${
|
git clone -q -b ${CloudRunner.buildParameters.cloudRunnerBranch} ${
|
||||||
CloudRunnerFolders.unityBuilderRepoUrl
|
CloudRunnerFolders.unityBuilderRepoUrl
|
||||||
} "${CloudRunnerFolders.builderPathFull.replace(/\\/g, `/`)}"
|
} "${CloudRunnerFolders.builderPathFull.replace(/\\/g, `/`)}"
|
||||||
${
|
|
||||||
CloudRunner.buildParameters.cloudRunnerIntegrationTests ? '' : '#'
|
|
||||||
} tree ${CloudRunnerFolders.builderPathFull.replace(/\\/g, `/`)}
|
|
||||||
chmod +x ${path.join(CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)}
|
chmod +x ${path.join(CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)}
|
||||||
echo "caching"
|
echo "cloud runner remote cli"
|
||||||
node --version
|
node --version
|
||||||
node ${path.join(CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)} -m remote-cli`;
|
node ${path.join(CloudRunnerFolders.builderPathFull, 'dist', `index.js`).replace(/\\/g, `/`)} -m remote-cli`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,10 +30,10 @@ class ImageEnvironmentFactory {
|
||||||
{ name: 'UNITY_EMAIL', value: process.env.UNITY_EMAIL },
|
{ name: 'UNITY_EMAIL', value: process.env.UNITY_EMAIL },
|
||||||
{ name: 'UNITY_PASSWORD', value: process.env.UNITY_PASSWORD },
|
{ name: 'UNITY_PASSWORD', value: process.env.UNITY_PASSWORD },
|
||||||
{ name: 'UNITY_SERIAL', value: parameters.unitySerial },
|
{ 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: 'USYM_UPLOAD_AUTH_TOKEN', value: process.env.USYM_UPLOAD_AUTH_TOKEN },
|
||||||
{ name: 'PROJECT_PATH', value: parameters.projectPath },
|
{ 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_NAME', value: parameters.buildName },
|
||||||
{ name: 'BUILD_PATH', value: parameters.buildPath },
|
{ name: 'BUILD_PATH', value: parameters.buildPath },
|
||||||
{ name: 'BUILD_FILE', value: parameters.buildFile },
|
{ name: 'BUILD_FILE', value: parameters.buildFile },
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,8 @@ import ImageTag from './image-tag';
|
||||||
|
|
||||||
describe('ImageTag', () => {
|
describe('ImageTag', () => {
|
||||||
const some = {
|
const some = {
|
||||||
repository: 'test1',
|
editorVersion: '2099.9.f9f9',
|
||||||
name: 'test2',
|
targetPlatform: 'Test',
|
||||||
version: '2099.9.f9f9',
|
|
||||||
platform: 'Test',
|
|
||||||
builderPlatform: '',
|
builderPlatform: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -17,50 +15,51 @@ describe('ImageTag', () => {
|
||||||
|
|
||||||
describe('constructor', () => {
|
describe('constructor', () => {
|
||||||
it('can be called', () => {
|
it('can be called', () => {
|
||||||
const { platform } = some;
|
const { targetPlatform } = some;
|
||||||
expect(() => new ImageTag({ platform })).not.toThrow();
|
|
||||||
|
expect(() => new ImageTag({ targetPlatform })).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('accepts parameters and sets the right properties', () => {
|
it('accepts parameters and sets the right properties', () => {
|
||||||
const image = new ImageTag(some);
|
const image = new ImageTag(some);
|
||||||
|
|
||||||
expect(image.repository).toStrictEqual(some.repository);
|
expect(image.repository).toStrictEqual('unityci');
|
||||||
expect(image.name).toStrictEqual(some.name);
|
expect(image.name).toStrictEqual('editor');
|
||||||
expect(image.version).toStrictEqual(some.version);
|
expect(image.editorVersion).toStrictEqual(some.editorVersion);
|
||||||
expect(image.platform).toStrictEqual(some.platform);
|
expect(image.targetPlatform).toStrictEqual(some.targetPlatform);
|
||||||
expect(image.builderPlatformSuffix).toStrictEqual(some.builderPlatform);
|
expect(image.builderPlatform).toStrictEqual(some.builderPlatform);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.each(['2000.0.0f0', '2011.1.11f1'])('accepts %p version format', (version) => {
|
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) => {
|
test.each(['some version', ''])('throws for incorrect version %p', (editorVersion) => {
|
||||||
const { platform } = some;
|
const { targetPlatform } = some;
|
||||||
expect(() => new ImageTag({ version, platform })).toThrow();
|
expect(() => new ImageTag({ editorVersion, targetPlatform })).toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
test.each([undefined, 'nonExisting'])('throws for unsupported target %p', (platform) => {
|
test.each([undefined, 'nonExisting'])('throws for unsupported target %p', (targetPlatform) => {
|
||||||
expect(() => new ImageTag({ platform })).toThrow();
|
expect(() => new ImageTag({ targetPlatform })).toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('toString', () => {
|
describe('toString', () => {
|
||||||
it('returns the correct version', () => {
|
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) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
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;
|
break;
|
||||||
case 'linux':
|
case 'linux':
|
||||||
expect(image.toString()).toStrictEqual(`${defaults.image}:2099.1.1111-0`);
|
expect(image.toString()).toStrictEqual(`${defaults.image}:ubuntu-2099.1.1111-1`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
it('returns customImage if given', () => {
|
it('returns customImage if given', () => {
|
||||||
const image = new ImageTag({
|
const image = new ImageTag({
|
||||||
version: '2099.1.1111',
|
editorVersion: '2099.1.1111',
|
||||||
platform: some.platform,
|
targetPlatform: some.targetPlatform,
|
||||||
customImage: `${defaults.image}:2099.1.1111@347598437689743986`,
|
customImage: `${defaults.image}:2099.1.1111@347598437689743986`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -68,27 +67,27 @@ describe('ImageTag', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
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({ editorVersion: '2019.2.11f1', targetPlatform: 'WebGL' });
|
||||||
|
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
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;
|
break;
|
||||||
case 'linux':
|
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;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns no specific build platform for generic targetPlatforms', () => {
|
it('returns no specific build platform for generic targetPlatforms', () => {
|
||||||
const image = new ImageTag({ platform: 'NoTarget' });
|
const image = new ImageTag({ targetPlatform: 'NoTarget' });
|
||||||
|
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'win32':
|
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;
|
break;
|
||||||
case 'linux':
|
case 'linux':
|
||||||
expect(image.toString()).toStrictEqual(`${defaults.image}:2019.2.11f1-0`);
|
expect(image.toString()).toStrictEqual(`${defaults.image}:ubuntu-2019.2.11f1-1`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,45 @@
|
||||||
import Platform from './platform';
|
import Platform from './platform';
|
||||||
|
|
||||||
|
import BuildParameters from './build-parameters';
|
||||||
|
|
||||||
class ImageTag {
|
class ImageTag {
|
||||||
public repository: string;
|
public repository: string;
|
||||||
public name: string;
|
public name: string;
|
||||||
public version: string;
|
public cloudRunnerBuilderPlatform!: string | undefined;
|
||||||
public platform: any;
|
public editorVersion: string;
|
||||||
public builderPlatformSuffix: string;
|
public targetPlatform: any;
|
||||||
public cloudRunnerBuilderPlatform: string;
|
public builderPlatform: string;
|
||||||
public customImage: any;
|
public customImage: any;
|
||||||
|
public imageRollingVersion: number;
|
||||||
|
public imagePlatformPrefix: string;
|
||||||
|
|
||||||
constructor(imageProperties) {
|
constructor(imageProperties: Partial<BuildParameters>) {
|
||||||
const {
|
const { editorVersion = '2019.2.11f1', targetPlatform, customImage, cloudRunnerBuilderPlatform } = imageProperties;
|
||||||
repository = 'unityci',
|
|
||||||
name = 'editor',
|
|
||||||
version = '2019.2.11f1',
|
|
||||||
platform,
|
|
||||||
cloudRunnerBuilderPlatform,
|
|
||||||
customImage,
|
|
||||||
} = imageProperties;
|
|
||||||
|
|
||||||
if (!ImageTag.versionPattern.test(version)) {
|
if (!ImageTag.versionPattern.test(editorVersion)) {
|
||||||
throw new Error(`Invalid version "${version}".`);
|
throw new Error(`Invalid version "${editorVersion}".`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const builderPlatformSuffix = ImageTag.getTargetPlatformToImageSuffixMap(platform, version);
|
// Todo we might as well skip this class for customImage.
|
||||||
|
// Either
|
||||||
this.repository = repository;
|
|
||||||
this.name = name;
|
|
||||||
this.version = version;
|
|
||||||
this.platform = platform;
|
|
||||||
this.builderPlatformSuffix = builderPlatformSuffix;
|
|
||||||
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
|
|
||||||
this.customImage = customImage;
|
this.customImage = customImage;
|
||||||
|
|
||||||
|
// Or
|
||||||
|
this.repository = 'unityci';
|
||||||
|
this.name = 'editor';
|
||||||
|
this.editorVersion = editorVersion;
|
||||||
|
this.targetPlatform = targetPlatform;
|
||||||
|
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
|
||||||
|
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() {
|
static get versionPattern() {
|
||||||
return /^20\d{2}\.\d\.\w{3,4}|3$/;
|
return /^20\d{2}\.\d\.\w{3,4}|3$/;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get imageSuffixes() {
|
static get targetPlatformSuffixes() {
|
||||||
return {
|
return {
|
||||||
generic: '',
|
generic: '',
|
||||||
webgl: 'webgl',
|
webgl: 'webgl',
|
||||||
|
|
@ -55,9 +56,20 @@ class ImageTag {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static getTargetPlatformToImageSuffixMap(platform, version) {
|
static getImagePlatformPrefixes(platform) {
|
||||||
|
switch (platform) {
|
||||||
|
case 'win32':
|
||||||
|
return 'windows';
|
||||||
|
case 'linux':
|
||||||
|
return 'ubuntu';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static getTargetPlatformToTargetPlatformSuffixMap(platform, version) {
|
||||||
const { generic, webgl, mac, windows, windowsIl2cpp, wsaPlayer, linux, linuxIl2cpp, android, ios, tvos, facebook } =
|
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));
|
const [major, minor] = version.split('.').map((digit) => Number(digit));
|
||||||
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
|
// @see: https://docs.unity3d.com/ScriptReference/BuildTarget.html
|
||||||
|
|
@ -129,16 +141,11 @@ class ImageTag {
|
||||||
}
|
}
|
||||||
|
|
||||||
get tag() {
|
get tag() {
|
||||||
const tagPlatform = this.cloudRunnerBuilderPlatform ? this.cloudRunnerBuilderPlatform : process.platform;
|
const versionAndPlatform = `${this.editorVersion}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||||
//We check the host os so we know what type of the images we need to pull
|
|
||||||
switch (tagPlatform) {
|
return `${
|
||||||
case 'win32':
|
this.cloudRunnerBuilderPlatform ? this.cloudRunnerBuilderPlatform : this.imagePlatformPrefix
|
||||||
return `windows-${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
}-${versionAndPlatform}-${this.imageRollingVersion}`;
|
||||||
case 'linux':
|
|
||||||
return `${this.version}-${this.builderPlatformSuffix}`.replace(/-+$/, '');
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get image() {
|
get image() {
|
||||||
|
|
@ -148,12 +155,9 @@ class ImageTag {
|
||||||
toString() {
|
toString() {
|
||||||
const { image, tag, customImage } = this;
|
const { image, tag, customImage } = this;
|
||||||
|
|
||||||
if (customImage && customImage !== '') {
|
if (customImage) return customImage;
|
||||||
return customImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
return `${image}:${tag}-0`; // '0' here represents the docker repo version
|
return `${image}:${tag}`; // '0' here represents the docker repo version
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ImageTag;
|
export default ImageTag;
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,15 @@
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { GenericInputReader } from './input-readers/generic-input-reader';
|
|
||||||
import Platform from './platform';
|
import Platform from './platform';
|
||||||
|
|
||||||
const formatFunction = (value, arguments_) => {
|
|
||||||
for (const element of arguments_) {
|
|
||||||
value = value.replace(`{${element.key}}`, element.value);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
};
|
|
||||||
|
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Input variables specified in workflows using "with" prop.
|
* Input variables specified in workflows using "with" prop.
|
||||||
*
|
*
|
||||||
* Note that input is always passed as a string, even booleans.
|
* 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 {
|
class Input {
|
||||||
public static cliOptions;
|
public static cliOptions;
|
||||||
|
|
@ -26,40 +20,11 @@ class Input {
|
||||||
static get cloudRunnerTests(): boolean {
|
static get cloudRunnerTests(): boolean {
|
||||||
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
|
return Input.getInput(`cloudRunnerTests`) || Input.getInput(`CloudRunnerTests`) || false;
|
||||||
}
|
}
|
||||||
private static shouldUseOverride(query) {
|
|
||||||
if (Input.readInputOverrideCommand() !== '') {
|
|
||||||
if (Input.readInputFromOverrideList() !== '') {
|
|
||||||
const doesInclude =
|
|
||||||
Input.readInputFromOverrideList().split(',').includes(query) ||
|
|
||||||
Input.readInputFromOverrideList().split(',').includes(Input.ToEnvVarFormat(query));
|
|
||||||
return doesInclude ? true : false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
static get cliMode() {
|
static get cliMode() {
|
||||||
return Input.cliOptions !== undefined && Input.cliOptions.mode !== undefined && Input.cliOptions.mode !== '';
|
return Input.cliOptions !== undefined && Input.cliOptions.mode !== undefined && Input.cliOptions.mode !== '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async queryOverride(query) {
|
|
||||||
if (!this.shouldUseOverride(query)) {
|
|
||||||
throw new Error(`Should not be trying to run override query on ${query}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return await GenericInputReader.Run(formatFunction(Input.readInputOverrideCommand(), [{ key: 0, value: query }]));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async PopulateQueryOverrideInput() {
|
|
||||||
const queries = Input.readInputFromOverrideList().split(',');
|
|
||||||
Input.queryOverrides = new Array();
|
|
||||||
for (const element of queries) {
|
|
||||||
if (Input.shouldUseOverride(element)) {
|
|
||||||
Input.queryOverrides[element] = await Input.queryOverride(element);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static getInput(query) {
|
public static getInput(query) {
|
||||||
const coreInput = core.getInput(query);
|
const coreInput = core.getInput(query);
|
||||||
if (Input.githubInputEnabled && coreInput && coreInput !== '') {
|
if (Input.githubInputEnabled && coreInput && coreInput !== '') {
|
||||||
|
|
@ -84,6 +49,7 @@ class Input {
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get region(): string {
|
static get region(): string {
|
||||||
return Input.getInput('region') || 'eu-west-2';
|
return Input.getInput('region') || 'eu-west-2';
|
||||||
}
|
}
|
||||||
|
|
@ -111,6 +77,7 @@ class Input {
|
||||||
return Input.getInput(`GitSHA`);
|
return Input.getInput(`GitSHA`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static get runNumber() {
|
static get runNumber() {
|
||||||
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
|
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
|
||||||
}
|
}
|
||||||
|
|
@ -135,6 +102,7 @@ class Input {
|
||||||
!fs.existsSync(path.join('ProjectSettings', 'ProjectVersion.txt'))
|
!fs.existsSync(path.join('ProjectSettings', 'ProjectVersion.txt'))
|
||||||
? 'test-project'
|
? 'test-project'
|
||||||
: '.';
|
: '.';
|
||||||
|
|
||||||
return rawProjectPath.replace(/\/$/, '');
|
return rawProjectPath.replace(/\/$/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ class SetupMac {
|
||||||
static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
|
static unityHubPath = `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub"`;
|
||||||
|
|
||||||
public static async setup(buildParameters: BuildParameters, actionFolder: string) {
|
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
|
// Only install unity if the editor doesn't already exist
|
||||||
if (!fs.existsSync(unityEditorPath)) {
|
if (!fs.existsSync(unityEditorPath)) {
|
||||||
|
|
@ -31,9 +31,9 @@ class SetupMac {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async installUnity(buildParameters: BuildParameters, silent = false) {
|
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 \
|
const command = `${this.unityHubPath} -- --headless install \
|
||||||
--version ${buildParameters.version} \
|
--version ${buildParameters.editorVersion} \
|
||||||
--changeset ${unityChangeset.changeset} \
|
--changeset ${unityChangeset.changeset} \
|
||||||
--module mac-il2cpp \
|
--module mac-il2cpp \
|
||||||
--childModules`;
|
--childModules`;
|
||||||
|
|
@ -50,10 +50,10 @@ class SetupMac {
|
||||||
// Need to set environment variables from here because we execute
|
// Need to set environment variables from here because we execute
|
||||||
// the scripts on the host for mac
|
// the scripts on the host for mac
|
||||||
process.env.ACTION_FOLDER = actionFolder;
|
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.UNITY_SERIAL = buildParameters.unitySerial;
|
||||||
process.env.PROJECT_PATH = buildParameters.projectPath;
|
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_NAME = buildParameters.buildName;
|
||||||
process.env.BUILD_PATH = buildParameters.buildPath;
|
process.env.BUILD_PATH = buildParameters.buildPath;
|
||||||
process.env.BUILD_FILE = buildParameters.buildFile;
|
process.env.BUILD_FILE = buildParameters.buildFile;
|
||||||
|
|
|
||||||
|
|
@ -4,26 +4,27 @@ import { BuildParameters } from '..';
|
||||||
|
|
||||||
class SetupWindows {
|
class SetupWindows {
|
||||||
public static async setup(buildParameters: BuildParameters) {
|
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(targetPlatform, silent = false) {
|
||||||
private static async setupWindowsRun(platform, silent = false) {
|
|
||||||
if (!fs.existsSync('c:/regkeys')) {
|
if (!fs.existsSync('c:/regkeys')) {
|
||||||
fs.mkdirSync('c:/regkeys');
|
fs.mkdirSync('c:/regkeys');
|
||||||
}
|
}
|
||||||
switch (platform) {
|
switch (targetPlatform) {
|
||||||
//These all need the Windows 10 SDK
|
//These all need the Windows 10 SDK
|
||||||
case 'StandaloneWindows':
|
case 'StandaloneWindows':
|
||||||
case 'StandaloneWindows64':
|
case 'StandaloneWindows64':
|
||||||
case 'WSAPlayer':
|
case 'WSAPlayer':
|
||||||
this.generateWinSDKRegKeys(silent);
|
await this.generateWinSDKRegKeys(silent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static async generateWinSDKRegKeys(silent = false) {
|
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 =
|
const exportWinSDKRegKeysCommand =
|
||||||
'reg export "HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0" c:/regkeys/winsdk.reg /y';
|
'reg export "HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0" c:/regkeys/winsdk.reg /y';
|
||||||
await exec(exportWinSDKRegKeysCommand, undefined, { silent });
|
await exec(exportWinSDKRegKeysCommand, undefined, { silent });
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { BuildParameters } from '..';
|
||||||
|
|
||||||
class ValidateWindows {
|
class ValidateWindows {
|
||||||
public static validate(buildParameters: BuildParameters) {
|
public static validate(buildParameters: BuildParameters) {
|
||||||
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.platform);
|
ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform);
|
||||||
if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) {
|
if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) {
|
||||||
throw new Error(`Unity email and password must be set for Windows based builds to
|
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
|
authenticate the license. Make sure to set them inside UNITY_EMAIL
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ describe('Versioning', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('descriptionRegex', () => {
|
describe('descriptionRegex1', () => {
|
||||||
it('is a valid regex', () => {
|
it('is a valid regex', () => {
|
||||||
expect(Versioning.descriptionRegex1).toBeInstanceOf(RegExp);
|
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) => {
|
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();
|
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();
|
expect(Versioning.descriptionRegex1.test(description?.slice(1))).toBeFalsy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('determineVersion', () => {
|
describe('determineBuildVersion', () => {
|
||||||
test.each(['somethingRandom'])('throws for invalid strategy %s', async (strategy) => {
|
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', () => {
|
describe('opt out strategy', () => {
|
||||||
it("returns 'none'", async () => {
|
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'])(
|
test.each(['v0.1', '1', 'CamelCase', 'dashed-version'])(
|
||||||
'returns the inputVersion for %s',
|
'returns the inputVersion for %s',
|
||||||
async (inputVersion) => {
|
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 () => {
|
it('refers to generateSemanticVersion', async () => {
|
||||||
const generateSemanticVersion = jest.spyOn(Versioning, 'generateSemanticVersion').mockResolvedValue('1.3.37');
|
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);
|
expect(generateSemanticVersion).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -175,7 +175,7 @@ describe('Versioning', () => {
|
||||||
it('refers to generateTagVersion', async () => {
|
it('refers to generateTagVersion', async () => {
|
||||||
const generateTagVersion = jest.spyOn(Versioning, 'generateTagVersion').mockResolvedValue('0.1');
|
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);
|
expect(generateTagVersion).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -185,7 +185,7 @@ describe('Versioning', () => {
|
||||||
const strategy = 'Test';
|
const strategy = 'Test';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
jest.spyOn(Versioning, 'strategies', 'get').mockReturnValue({ [strategy]: strategy });
|
jest.spyOn(Versioning, 'strategies', 'get').mockReturnValue({ [strategy]: strategy });
|
||||||
await expect(Versioning.determineVersion(strategy, '')).rejects.toThrowError(NotImplementedException);
|
await expect(Versioning.determineBuildVersion(strategy, '')).rejects.toThrowError(NotImplementedException);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ export default class Versioning {
|
||||||
return /^v?([\d.]+-\w+\.\d+)-(\d+)-g(\w+)-?(\w+)*/g;
|
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
|
// Validate input
|
||||||
if (!Object.hasOwnProperty.call(this.strategies, strategy)) {
|
if (!Object.hasOwnProperty.call(this.strategies, strategy)) {
|
||||||
throw new ValidationError(`Versioning strategy should be one of ${Object.values(this.strategies).join(', ')}.`);
|
throw new ValidationError(`Versioning strategy should be one of ${Object.values(this.strategies).join(', ')}.`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue