pull/531/head
Frostebite 2024-01-19 19:13:17 +00:00
parent cdd1bd2169
commit 74ad7d8498
5 changed files with 24 additions and 19 deletions

15
dist/index.js generated vendored
View File

@ -1193,13 +1193,13 @@ class CloudRunnerOptions {
// ### ### ### // ### ### ###
static get buildPlatform() { static get buildPlatform() {
const input = CloudRunnerOptions.getInput('buildPlatform'); const input = CloudRunnerOptions.getInput('buildPlatform');
if (input) { if (input && input !== '') {
return input; return input;
} }
if (CloudRunnerOptions.providerStrategy !== 'local') { if (CloudRunnerOptions.providerStrategy !== 'local') {
return 'linux'; return 'linux';
} }
return ``; return process.platform;
} }
static get cloudRunnerBranch() { static get cloudRunnerBranch() {
return CloudRunnerOptions.getInput('cloudRunnerBranch') || 'main'; return CloudRunnerOptions.getInput('cloudRunnerBranch') || 'main';
@ -6540,7 +6540,7 @@ 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 { editorVersion, targetPlatform, customImage, cloudRunnerBuilderPlatform, containerRegistryRepository, containerRegistryImageVersion, } = imageProperties; const { editorVersion, targetPlatform, customImage, buildPlatform, containerRegistryRepository, containerRegistryImageVersion, } = imageProperties;
if (!ImageTag.versionPattern.test(editorVersion)) { if (!ImageTag.versionPattern.test(editorVersion)) {
throw new Error(`Invalid version "${editorVersion}".`); throw new Error(`Invalid version "${editorVersion}".`);
} }
@ -6551,10 +6551,8 @@ class ImageTag {
this.repository = containerRegistryRepository; this.repository = containerRegistryRepository;
this.editorVersion = editorVersion; this.editorVersion = editorVersion;
this.targetPlatform = targetPlatform; this.targetPlatform = targetPlatform;
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
const isCloudRunnerLocal = cloudRunnerBuilderPlatform === 'local' || cloudRunnerBuilderPlatform === undefined;
this.builderPlatform = ImageTag.getTargetPlatformToTargetPlatformSuffixMap(targetPlatform, editorVersion); this.builderPlatform = ImageTag.getTargetPlatformToTargetPlatformSuffixMap(targetPlatform, editorVersion);
this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes(isCloudRunnerLocal ? process.platform : cloudRunnerBuilderPlatform); this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes(buildPlatform);
this.imageRollingVersion = Number(containerRegistryImageVersion); // Will automatically roll to the latest non-breaking version. this.imageRollingVersion = Number(containerRegistryImageVersion); // Will automatically roll to the latest non-breaking version.
} }
static get versionPattern() { static get versionPattern() {
@ -6577,6 +6575,9 @@ class ImageTag {
}; };
} }
static getImagePlatformPrefixes(platform) { static getImagePlatformPrefixes(platform) {
if (!platform || platform === '') {
platform = process.platform;
}
switch (platform) { switch (platform) {
case 'win32': case 'win32':
return 'windows'; return 'windows';
@ -6609,7 +6610,7 @@ class ImageTag {
return windows; return windows;
case platform_1.default.types.StandaloneLinux64: { case platform_1.default.types.StandaloneLinux64: {
// Unity versions before 2019.3 do not support il2cpp // Unity versions before 2019.3 do not support il2cpp
if (major >= 2020 || (major === 2019 && minor >= 3)) { if (process.env.USE_IL2CPP === 'true' && (major >= 2020 || (major === 2019 && minor >= 3))) {
return linuxIl2cpp; return linuxIl2cpp;
} }
return linux; return linux;

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -103,14 +103,14 @@ class CloudRunnerOptions {
static get buildPlatform(): string { static get buildPlatform(): string {
const input = CloudRunnerOptions.getInput('buildPlatform'); const input = CloudRunnerOptions.getInput('buildPlatform');
if (input) { if (input && input !== '') {
return input; return input;
} }
if (CloudRunnerOptions.providerStrategy !== 'local') { if (CloudRunnerOptions.providerStrategy !== 'local') {
return 'linux'; return 'linux';
} }
return ``; return process.platform;
} }
static get cloudRunnerBranch(): string { static get cloudRunnerBranch(): string {

View File

@ -19,23 +19,28 @@ async function CreateParameters(overrides: any) {
describe('Cloud Runner Kubernetes', () => { describe('Cloud Runner Kubernetes', () => {
it('Responds', () => {}); it('Responds', () => {});
setups(); setups();
if (CloudRunnerOptions.cloudRunnerDebug) { if (CloudRunnerOptions.cloudRunnerDebug) {
it('Run one build it using K8s without error', async () => { it('Run one build it using K8s without error', async () => {
if (CloudRunnerOptions.providerStrategy !== `k8s`) { if (CloudRunnerOptions.providerStrategy !== `k8s`) {
return; return;
} }
process.env.USE_IL2CPP = 'false';
const overrides = { const overrides = {
versioning: 'None', versioning: 'None',
projectPath: 'test-project', projectPath: 'test-project',
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')), unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
targetPlatform: 'StandaloneLinux64', targetPlatform: 'StandaloneLinux64',
cacheKey: `test-case-${uuidv4()}`, cacheKey: `test-case-${uuidv4()}`,
providerStrategy: 'k8s',
buildPlatform: 'linux',
}; };
const buildParameter = await CreateParameters(overrides); const buildParameter = await CreateParameters(overrides);
expect(buildParameter.projectPath).toEqual(overrides.projectPath); expect(buildParameter.projectPath).toEqual(overrides.projectPath);
const baseImage = new ImageTag(buildParameter); const baseImage = new ImageTag(buildParameter);
const results = await CloudRunner.run(buildParameter, baseImage.toString()); const resultsObject = await CloudRunner.run(buildParameter, baseImage.toString());
const results = resultsObject.BuildResults;
const libraryString = 'Rebuilding Library because the asset database could not be found!'; const libraryString = 'Rebuilding Library because the asset database could not be found!';
const cachePushFail = 'Did not push source folder to cache because it was empty Library'; const cachePushFail = 'Did not push source folder to cache because it was empty Library';
const buildSucceededString = 'Build succeeded'; const buildSucceededString = 'Build succeeded';

View File

@ -2,7 +2,6 @@ import Platform from './platform';
class ImageTag { class ImageTag {
public repository: string; public repository: string;
public cloudRunnerBuilderPlatform!: string;
public editorVersion: string; public editorVersion: string;
public targetPlatform: string; public targetPlatform: string;
public builderPlatform: string; public builderPlatform: string;
@ -15,7 +14,7 @@ class ImageTag {
editorVersion, editorVersion,
targetPlatform, targetPlatform,
customImage, customImage,
cloudRunnerBuilderPlatform, buildPlatform,
containerRegistryRepository, containerRegistryRepository,
containerRegistryImageVersion, containerRegistryImageVersion,
} = imageProperties; } = imageProperties;
@ -32,12 +31,8 @@ class ImageTag {
this.repository = containerRegistryRepository; this.repository = containerRegistryRepository;
this.editorVersion = editorVersion; this.editorVersion = editorVersion;
this.targetPlatform = targetPlatform; this.targetPlatform = targetPlatform;
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
const isCloudRunnerLocal = cloudRunnerBuilderPlatform === 'local' || cloudRunnerBuilderPlatform === undefined;
this.builderPlatform = ImageTag.getTargetPlatformToTargetPlatformSuffixMap(targetPlatform, editorVersion); this.builderPlatform = ImageTag.getTargetPlatformToTargetPlatformSuffixMap(targetPlatform, editorVersion);
this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes( this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes(buildPlatform);
isCloudRunnerLocal ? process.platform : cloudRunnerBuilderPlatform,
);
this.imageRollingVersion = Number(containerRegistryImageVersion); // Will automatically roll to the latest non-breaking version. this.imageRollingVersion = Number(containerRegistryImageVersion); // Will automatically roll to the latest non-breaking version.
} }
@ -63,6 +58,10 @@ class ImageTag {
} }
static getImagePlatformPrefixes(platform: string): string { static getImagePlatformPrefixes(platform: string): string {
if (!platform || platform === '') {
platform = process.platform;
}
switch (platform) { switch (platform) {
case 'win32': case 'win32':
return 'windows'; return 'windows';
@ -101,7 +100,7 @@ class ImageTag {
return windows; return windows;
case Platform.types.StandaloneLinux64: { case Platform.types.StandaloneLinux64: {
// Unity versions before 2019.3 do not support il2cpp // Unity versions before 2019.3 do not support il2cpp
if (major >= 2020 || (major === 2019 && minor >= 3)) { if (process.env.USE_IL2CPP === 'true' && (major >= 2020 || (major === 2019 && minor >= 3))) {
return linuxIl2cpp; return linuxIl2cpp;
} }