pipeline improvements

pull/496/head
Frostebite 2023-02-12 14:23:16 +00:00
parent 6def7d36ae
commit ffeb59ea3d
4 changed files with 29 additions and 7 deletions

6
dist/index.js generated vendored
View File

@ -4757,13 +4757,13 @@ class CloudRunnerCustomHooks {
const results = [];
remote_client_logger_1.RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
try {
const gameCiCustomStepsPath = path_1.default.join(process.cwd(), `game-ci`, `hooks`);
const files = fs.readdirSync(gameCiCustomStepsPath);
const gameCiCustomHooksPath = path_1.default.join(process.cwd(), `game-ci`, `hooks`);
const files = fs.readdirSync(gameCiCustomHooksPath);
for (const file of files) {
if (!cloud_runner_options_1.default.customHookFiles.includes(file.replace(`.yaml`, ``))) {
continue;
}
const fileContents = fs.readFileSync(path_1.default.join(gameCiCustomStepsPath, file), `utf8`);
const fileContents = fs.readFileSync(path_1.default.join(gameCiCustomHooksPath, file), `utf8`);
const fileContentsObject = CloudRunnerCustomHooks.ParseHooks(fileContents)[0];
if (fileContentsObject.hook.includes(hookLifecycle)) {
results.push(fileContentsObject);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -46,13 +46,13 @@ export class CloudRunnerCustomHooks {
const results: Hook[] = [];
RemoteClientLogger.log(`GetCustomHookFiles: ${hookLifecycle}`);
try {
const gameCiCustomStepsPath = path.join(process.cwd(), `game-ci`, `hooks`);
const files = fs.readdirSync(gameCiCustomStepsPath);
const gameCiCustomHooksPath = path.join(process.cwd(), `game-ci`, `hooks`);
const files = fs.readdirSync(gameCiCustomHooksPath);
for (const file of files) {
if (!CloudRunnerOptions.customHookFiles.includes(file.replace(`.yaml`, ``))) {
continue;
}
const fileContents = fs.readFileSync(path.join(gameCiCustomStepsPath, file), `utf8`);
const fileContents = fs.readFileSync(path.join(gameCiCustomHooksPath, file), `utf8`);
const fileContentsObject = CloudRunnerCustomHooks.ParseHooks(fileContents)[0];
if (fileContentsObject.hook.includes(hookLifecycle)) {
results.push(fileContentsObject);

View File

@ -49,12 +49,34 @@ commands: echo "test"`;
});
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.cloudRunnerCluster !== `k8s`) {
it('Should be 1 before and 1 after hook', async () => {
const overrides = {
versioning: 'None',
projectPath: 'test-project',
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
targetPlatform: 'StandaloneLinux64',
cacheKey: `test-case-${uuidv4()}`,
customStepFiles: `my-test-step-pre-build,my-test-step-post-build`,
customHookFiles: `my-test-hook-pre-build,my-test-hook-post-build`,
};
const buildParameter2 = await CreateParameters(overrides);
await CloudRunner.setup(buildParameter2);
const beforeHooks = CloudRunnerCustomHooks.GetCustomHooksFromFiles(`before`);
const afterHooks = CloudRunnerCustomHooks.GetCustomHooksFromFiles(`after`);
expect(beforeHooks).toHaveLength(1);
expect(afterHooks).toHaveLength(1);
});
it('Should be 1 before and 1 after step', async () => {
const overrides = {
versioning: 'None',
projectPath: 'test-project',
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
targetPlatform: 'StandaloneLinux64',
cacheKey: `test-case-${uuidv4()}`,
customStepFiles: `my-test-step-pre-build,my-test-step-post-build`,
customHookFiles: `my-test-hook-pre-build,my-test-hook-post-build`,
};
const buildParameter2 = await CreateParameters(overrides);
await CloudRunner.setup(buildParameter2);
const beforeSteps = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`);
const afterSteps = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`after`);
expect(beforeSteps).toHaveLength(1);