Introduce retain workspace test and replace useIl2cpp env var with input
parent
03aae52afe
commit
d6c305b2b7
|
|
@ -5463,6 +5463,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
const platform_1 = __importDefault(__nccwpck_require__(9707));
|
||||||
|
const input_1 = __importDefault(__nccwpck_require__(91933));
|
||||||
class ImageTag {
|
class ImageTag {
|
||||||
constructor(imageProperties) {
|
constructor(imageProperties) {
|
||||||
const { editorVersion = '2019.2.11f1', targetPlatform, customImage, cloudRunnerBuilderPlatform } = imageProperties;
|
const { editorVersion = '2019.2.11f1', targetPlatform, customImage, cloudRunnerBuilderPlatform } = imageProperties;
|
||||||
|
|
@ -5522,7 +5523,7 @@ class ImageTag {
|
||||||
case platform_1.default.types.StandaloneWindows:
|
case platform_1.default.types.StandaloneWindows:
|
||||||
case platform_1.default.types.StandaloneWindows64:
|
case platform_1.default.types.StandaloneWindows64:
|
||||||
// Can only build windows-il2cpp on a windows based system
|
// Can only build windows-il2cpp on a windows based system
|
||||||
if (process.env.il2cppEnabled && process.platform === 'win32') {
|
if (input_1.default.useIL2Cpp && process.platform === 'win32') {
|
||||||
// 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 (major >= 2020 || (major === 2019 && minor >= 3)) {
|
||||||
return windowsIl2cpp;
|
return windowsIl2cpp;
|
||||||
|
|
@ -5535,7 +5536,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 ((process.env.il2cppEnabled && major >= 2020) || (major === 2019 && minor >= 3)) {
|
if ((input_1.default.useIL2Cpp && major >= 2020) || (major === 2019 && minor >= 3)) {
|
||||||
return linuxIl2cpp;
|
return linuxIl2cpp;
|
||||||
}
|
}
|
||||||
return linux;
|
return linux;
|
||||||
|
|
@ -5929,6 +5930,9 @@ class Input {
|
||||||
return Input.getInput(`GitSHA`);
|
return Input.getInput(`GitSHA`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static get useIL2Cpp() {
|
||||||
|
return Input.getInput(`useIL2Cpp`) || true;
|
||||||
|
}
|
||||||
static get runNumber() {
|
static get runNumber() {
|
||||||
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
|
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -0,0 +1,69 @@
|
||||||
|
import CloudRunner from '../cloud-runner';
|
||||||
|
import { BuildParameters, ImageTag } from '../..';
|
||||||
|
import UnityVersioning from '../../unity-versioning';
|
||||||
|
import { Cli } from '../../cli/cli';
|
||||||
|
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
||||||
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
|
import CloudRunnerOptions from '../cloud-runner-options';
|
||||||
|
import setups from './cloud-runner-suite.test';
|
||||||
|
|
||||||
|
async function CreateParameters(overrides) {
|
||||||
|
if (overrides) {
|
||||||
|
Cli.options = overrides;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await BuildParameters.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('Cloud Runner Retain Workspace', () => {
|
||||||
|
it('Responds', () => {});
|
||||||
|
setups();
|
||||||
|
if (CloudRunnerOptions.cloudRunnerTests && CloudRunnerOptions.cloudRunnerCluster !== `k8s`) {
|
||||||
|
it('Run one build it should not use cache, run subsequent build which should use cache', async () => {
|
||||||
|
const overrides = {
|
||||||
|
versioning: 'None',
|
||||||
|
projectPath: 'test-project',
|
||||||
|
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
||||||
|
targetPlatform: 'StandaloneLinux64',
|
||||||
|
cacheKey: `test-case-${uuidv4()}`,
|
||||||
|
retainWorkspaces: true,
|
||||||
|
};
|
||||||
|
const buildParameter = await CreateParameters(overrides);
|
||||||
|
expect(buildParameter.projectPath).toEqual(overrides.projectPath);
|
||||||
|
|
||||||
|
const baseImage = new ImageTag(buildParameter);
|
||||||
|
const results = await CloudRunner.run(buildParameter, baseImage.toString());
|
||||||
|
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 buildSucceededString = 'Build succeeded';
|
||||||
|
|
||||||
|
expect(results).toContain(libraryString);
|
||||||
|
expect(results).toContain(buildSucceededString);
|
||||||
|
expect(results).not.toContain(cachePushFail);
|
||||||
|
|
||||||
|
CloudRunnerLogger.log(`run 1 succeeded`);
|
||||||
|
const buildParameter2 = await CreateParameters(overrides);
|
||||||
|
|
||||||
|
buildParameter2.cacheKey = buildParameter.cacheKey;
|
||||||
|
const baseImage2 = new ImageTag(buildParameter2);
|
||||||
|
const results2 = await CloudRunner.run(buildParameter2, baseImage2.toString());
|
||||||
|
CloudRunnerLogger.log(`run 2 succeeded`);
|
||||||
|
|
||||||
|
const build2ContainsCacheKey = results2.includes(buildParameter.cacheKey);
|
||||||
|
const build2ContainsBuildSucceeded = results2.includes(buildSucceededString);
|
||||||
|
const build2NotContainsNoLibraryMessage = !results2.includes(libraryString);
|
||||||
|
const build2NotContainsZeroLibraryCacheFilesMessage = !results2.includes(
|
||||||
|
'There is 0 files/dir in the cache pulled contents for Library',
|
||||||
|
);
|
||||||
|
const build2NotContainsZeroLFSCacheFilesMessage = !results2.includes(
|
||||||
|
'There is 0 files/dir in the cache pulled contents for LFS',
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(build2ContainsCacheKey).toBeTruthy();
|
||||||
|
expect(build2ContainsBuildSucceeded).toBeTruthy();
|
||||||
|
expect(build2NotContainsZeroLibraryCacheFilesMessage).toBeTruthy();
|
||||||
|
expect(build2NotContainsZeroLFSCacheFilesMessage).toBeTruthy();
|
||||||
|
expect(build2NotContainsNoLibraryMessage).toBeTruthy();
|
||||||
|
}, 10000000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import Platform from './platform';
|
import Platform from './platform';
|
||||||
|
|
||||||
import BuildParameters from './build-parameters';
|
import BuildParameters from './build-parameters';
|
||||||
|
import Input from './input';
|
||||||
|
|
||||||
class ImageTag {
|
class ImageTag {
|
||||||
public repository: string;
|
public repository: string;
|
||||||
|
|
@ -83,7 +84,7 @@ class ImageTag {
|
||||||
case Platform.types.StandaloneWindows:
|
case Platform.types.StandaloneWindows:
|
||||||
case Platform.types.StandaloneWindows64:
|
case Platform.types.StandaloneWindows64:
|
||||||
// Can only build windows-il2cpp on a windows based system
|
// Can only build windows-il2cpp on a windows based system
|
||||||
if (process.env.il2cppEnabled && process.platform === 'win32') {
|
if (Input.useIL2Cpp && process.platform === 'win32') {
|
||||||
// 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 (major >= 2020 || (major === 2019 && minor >= 3)) {
|
||||||
return windowsIl2cpp;
|
return windowsIl2cpp;
|
||||||
|
|
@ -96,7 +97,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 ((process.env.il2cppEnabled && major >= 2020) || (major === 2019 && minor >= 3)) {
|
if ((Input.useIL2Cpp && major >= 2020) || (major === 2019 && minor >= 3)) {
|
||||||
return linuxIl2cpp;
|
return linuxIl2cpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,10 @@ class Input {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get useIL2Cpp() {
|
||||||
|
return Input.getInput(`useIL2Cpp`) || true;
|
||||||
|
}
|
||||||
|
|
||||||
static get runNumber() {
|
static get runNumber() {
|
||||||
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
|
return Input.getInput('GITHUB_RUN_NUMBER') || '0';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue