local-system is now used for cloud runner test implementation AND correctly unset test CLI input
parent
3bc006b05d
commit
096443b669
|
|
@ -55,7 +55,7 @@ function runMain() {
|
||||||
const { workspace, actionFolder } = model_1.Action;
|
const { workspace, actionFolder } = model_1.Action;
|
||||||
const buildParameters = yield model_1.BuildParameters.create();
|
const buildParameters = yield model_1.BuildParameters.create();
|
||||||
const baseImage = new model_1.ImageTag(buildParameters);
|
const baseImage = new model_1.ImageTag(buildParameters);
|
||||||
if (buildParameters.cloudRunnerCluster !== undefined && buildParameters.cloudRunnerCluster !== '') {
|
if (buildParameters.cloudRunnerCluster !== 'local') {
|
||||||
yield model_1.CloudRunner.run(buildParameters, baseImage.toString());
|
yield model_1.CloudRunner.run(buildParameters, baseImage.toString());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -1870,7 +1870,7 @@ class CloudRunner {
|
||||||
case 'test':
|
case 'test':
|
||||||
CloudRunner.CloudRunnerProviderPlatform = new test_1.default();
|
CloudRunner.CloudRunnerProviderPlatform = new test_1.default();
|
||||||
break;
|
break;
|
||||||
case 'local':
|
case 'local-system':
|
||||||
CloudRunner.CloudRunnerProviderPlatform = new local_1.default();
|
CloudRunner.CloudRunnerProviderPlatform = new local_1.default();
|
||||||
break;
|
break;
|
||||||
case 'local-docker':
|
case 'local-docker':
|
||||||
|
|
@ -3804,8 +3804,9 @@ class ImageTag {
|
||||||
this.editorVersion = editorVersion;
|
this.editorVersion = editorVersion;
|
||||||
this.targetPlatform = targetPlatform;
|
this.targetPlatform = targetPlatform;
|
||||||
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
|
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(process.platform);
|
this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes(isCloudRunnerLocal ? process.platform : cloudRunnerBuilderPlatform);
|
||||||
this.imageRollingVersion = 1; // will automatically roll to the latest non-breaking version.
|
this.imageRollingVersion = 1; // will automatically roll to the latest non-breaking version.
|
||||||
}
|
}
|
||||||
static get versionPattern() {
|
static get versionPattern() {
|
||||||
|
|
@ -3909,7 +3910,7 @@ class ImageTag {
|
||||||
}
|
}
|
||||||
get tag() {
|
get tag() {
|
||||||
const versionAndPlatform = `${this.editorVersion}-${this.builderPlatform}`.replace(/-+$/, '');
|
const versionAndPlatform = `${this.editorVersion}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||||
return `${this.cloudRunnerBuilderPlatform ? this.cloudRunnerBuilderPlatform : this.imagePlatformPrefix}-${versionAndPlatform}-${this.imageRollingVersion}`;
|
return `${this.imagePlatformPrefix}-${versionAndPlatform}-${this.imageRollingVersion}`;
|
||||||
}
|
}
|
||||||
get image() {
|
get image() {
|
||||||
return `${this.repository}/${this.name}`.replace(/^\/+/, '');
|
return `${this.repository}/${this.name}`.replace(/^\/+/, '');
|
||||||
|
|
@ -4224,8 +4225,8 @@ class Input {
|
||||||
if (input) {
|
if (input) {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
if (this.cloudRunnerCluster) {
|
if (Input.cloudRunnerCluster !== 'local') {
|
||||||
return 'ubuntu';
|
return 'linux';
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -4349,7 +4350,7 @@ class Input {
|
||||||
if (cli_1.CLI.cliMode) {
|
if (cli_1.CLI.cliMode) {
|
||||||
return Input.getInput('cloudRunnerCluster') || 'aws';
|
return Input.getInput('cloudRunnerCluster') || 'aws';
|
||||||
}
|
}
|
||||||
return Input.getInput('cloudRunnerCluster') || undefined;
|
return Input.getInput('cloudRunnerCluster') || 'local';
|
||||||
}
|
}
|
||||||
static get cloudRunnerCpu() {
|
static get cloudRunnerCpu() {
|
||||||
return Input.getInput('cloudRunnerCpu') || '1.0';
|
return Input.getInput('cloudRunnerCpu') || '1.0';
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -17,7 +17,7 @@ async function runMain() {
|
||||||
const buildParameters = await BuildParameters.create();
|
const buildParameters = await BuildParameters.create();
|
||||||
const baseImage = new ImageTag(buildParameters);
|
const baseImage = new ImageTag(buildParameters);
|
||||||
|
|
||||||
if (buildParameters.cloudRunnerCluster !== undefined && buildParameters.cloudRunnerCluster !== '') {
|
if (buildParameters.cloudRunnerCluster !== 'local') {
|
||||||
await CloudRunner.run(buildParameters, baseImage.toString());
|
await CloudRunner.run(buildParameters, baseImage.toString());
|
||||||
} else {
|
} else {
|
||||||
core.info('Building locally');
|
core.info('Building locally');
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class BuildParameters {
|
||||||
public androidSdkManagerParameters!: string;
|
public androidSdkManagerParameters!: string;
|
||||||
public customParameters!: string;
|
public customParameters!: string;
|
||||||
public sshAgent!: string;
|
public sshAgent!: string;
|
||||||
public cloudRunnerCluster!: string | undefined;
|
public cloudRunnerCluster!: string;
|
||||||
public awsBaseStackName!: string;
|
public awsBaseStackName!: string;
|
||||||
public gitPrivateToken!: string;
|
public gitPrivateToken!: string;
|
||||||
public awsStackName!: string;
|
public awsStackName!: string;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ describe('Cloud Runner', () => {
|
||||||
versioning: 'None',
|
versioning: 'None',
|
||||||
projectPath: 'test-project',
|
projectPath: 'test-project',
|
||||||
unityVersion: UnityVersioning.read('test-project'),
|
unityVersion: UnityVersioning.read('test-project'),
|
||||||
cloudRunnerCluster: 'local',
|
cloudRunnerCluster: 'local-system',
|
||||||
targetPlatform: 'StandaloneLinux64',
|
targetPlatform: 'StandaloneLinux64',
|
||||||
customJob: `
|
customJob: `
|
||||||
- name: 'step 1'
|
- name: 'step 1'
|
||||||
|
|
@ -44,7 +44,7 @@ describe('Cloud Runner', () => {
|
||||||
// run the job
|
// run the job
|
||||||
await expect(CloudRunner.run(buildParameter, baseImage.toString())).resolves.not.toThrow();
|
await expect(CloudRunner.run(buildParameter, baseImage.toString())).resolves.not.toThrow();
|
||||||
Input.githubInputEnabled = true;
|
Input.githubInputEnabled = true;
|
||||||
CLI.options = undefined;
|
delete CLI.options;
|
||||||
}, 1000000);
|
}, 1000000);
|
||||||
it('Test cloud runner returns commands', async () => {
|
it('Test cloud runner returns commands', async () => {
|
||||||
// build parameters
|
// build parameters
|
||||||
|
|
@ -62,7 +62,7 @@ describe('Cloud Runner', () => {
|
||||||
// run the job
|
// run the job
|
||||||
await expect(CloudRunner.run(buildParameter, baseImage.toString())).resolves.not.toThrow();
|
await expect(CloudRunner.run(buildParameter, baseImage.toString())).resolves.not.toThrow();
|
||||||
Input.githubInputEnabled = true;
|
Input.githubInputEnabled = true;
|
||||||
CLI.options = undefined;
|
delete CLI.options;
|
||||||
}, 1000000);
|
}, 1000000);
|
||||||
if (Input.cloudRunnerTests) {
|
if (Input.cloudRunnerTests) {
|
||||||
it('All build parameters sent to cloud runner as env vars', async () => {
|
it('All build parameters sent to cloud runner as env vars', async () => {
|
||||||
|
|
@ -103,7 +103,7 @@ describe('Cloud Runner', () => {
|
||||||
expect(newLinePurgedFile).toContain(`${element.name}=${element.value}`);
|
expect(newLinePurgedFile).toContain(`${element.name}=${element.value}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CLI.options = undefined;
|
delete CLI.options;
|
||||||
}, 1000000);
|
}, 1000000);
|
||||||
it('Run one build it should not use cache, run subsequent build which should use cache', async () => {
|
it('Run one build it should not use cache, run subsequent build which should use cache', async () => {
|
||||||
CLI.options = {
|
CLI.options = {
|
||||||
|
|
@ -122,7 +122,7 @@ describe('Cloud Runner', () => {
|
||||||
expect(results).toContain(libraryString);
|
expect(results).toContain(libraryString);
|
||||||
const results2 = await CloudRunner.run(buildParameter, baseImage.toString());
|
const results2 = await CloudRunner.run(buildParameter, baseImage.toString());
|
||||||
expect(results2).toEqual(expect.not.stringContaining(libraryString));
|
expect(results2).toEqual(expect.not.stringContaining(libraryString));
|
||||||
CLI.options = undefined;
|
delete CLI.options;
|
||||||
}, 1000000);
|
}, 1000000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class CloudRunner {
|
||||||
case 'test':
|
case 'test':
|
||||||
CloudRunner.CloudRunnerProviderPlatform = new TestCloudRunner();
|
CloudRunner.CloudRunnerProviderPlatform = new TestCloudRunner();
|
||||||
break;
|
break;
|
||||||
case 'local':
|
case 'local-system':
|
||||||
CloudRunner.CloudRunnerProviderPlatform = new LocalCloudRunner();
|
CloudRunner.CloudRunnerProviderPlatform = new LocalCloudRunner();
|
||||||
break;
|
break;
|
||||||
case 'local-docker':
|
case 'local-docker':
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,11 @@ class ImageTag {
|
||||||
this.editorVersion = editorVersion;
|
this.editorVersion = editorVersion;
|
||||||
this.targetPlatform = targetPlatform;
|
this.targetPlatform = targetPlatform;
|
||||||
this.cloudRunnerBuilderPlatform = cloudRunnerBuilderPlatform;
|
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(process.platform);
|
this.imagePlatformPrefix = ImageTag.getImagePlatformPrefixes(
|
||||||
|
isCloudRunnerLocal ? process.platform : cloudRunnerBuilderPlatform,
|
||||||
|
);
|
||||||
this.imageRollingVersion = 1; // will automatically roll to the latest non-breaking version.
|
this.imageRollingVersion = 1; // will automatically roll to the latest non-breaking version.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,9 +146,7 @@ class ImageTag {
|
||||||
get tag() {
|
get tag() {
|
||||||
const versionAndPlatform = `${this.editorVersion}-${this.builderPlatform}`.replace(/-+$/, '');
|
const versionAndPlatform = `${this.editorVersion}-${this.builderPlatform}`.replace(/-+$/, '');
|
||||||
|
|
||||||
return `${
|
return `${this.imagePlatformPrefix}-${versionAndPlatform}-${this.imageRollingVersion}`;
|
||||||
this.cloudRunnerBuilderPlatform ? this.cloudRunnerBuilderPlatform : this.imagePlatformPrefix
|
|
||||||
}-${versionAndPlatform}-${this.imageRollingVersion}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get image() {
|
get image() {
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,8 @@ class Input {
|
||||||
if (input) {
|
if (input) {
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
if (this.cloudRunnerCluster) {
|
if (Input.cloudRunnerCluster !== 'local') {
|
||||||
return 'ubuntu';
|
return 'linux';
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +225,7 @@ class Input {
|
||||||
if (CLI.cliMode) {
|
if (CLI.cliMode) {
|
||||||
return Input.getInput('cloudRunnerCluster') || 'aws';
|
return Input.getInput('cloudRunnerCluster') || 'aws';
|
||||||
}
|
}
|
||||||
return Input.getInput('cloudRunnerCluster') || undefined;
|
return Input.getInput('cloudRunnerCluster') || 'local';
|
||||||
}
|
}
|
||||||
|
|
||||||
static get cloudRunnerCpu() {
|
static get cloudRunnerCpu() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue