mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00

* Enable noImplicitAny Add types to all implicit any variables Bump target to ES2020 for recent language features (optional chaining) Code cleanup Add debug configuration for vscode Remove autorun flag from jest to remove warning Bump packages to fix dependency version mismatch warning Changed @arkweid/lefthook to @evilmartians/lefthook as @arkweid/lefthook has been deprecated in favor of @evilmartians/lefthook Added concurrency groups to integrity check and build workflows. New commits to branches will cancel superseded runs on the same branch/pr Update imports to not use require syntax Use node packages (ie node:fs rather than fs) AndroidVersionCode is now a string rather than a number as it gets converted to a string when passed out of the system Reduce timeout for windows builds Remove 2020.1.17f1 from windows builds due to repeated license activation errors Update naming scheme of workflows for consistency Update build names so target platform and unity version aren't cut off by github actions UI * Add exclude to test matrix for 2022.2 on android until Unity bug is fixed --------- Co-authored-by: AndrewKahr <AndrewKahr@users.noreply.github.com>
80 lines
3.5 KiB
TypeScript
80 lines
3.5 KiB
TypeScript
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';
|
|
import { CloudRunnerCustomSteps } from '../services/cloud-runner-custom-steps';
|
|
import { OptionValues } from 'commander';
|
|
|
|
async function CreateParameters(overrides: OptionValues | undefined) {
|
|
if (overrides) {
|
|
Cli.options = overrides;
|
|
}
|
|
|
|
return await BuildParameters.create();
|
|
}
|
|
|
|
describe('Cloud Runner Custom Hooks And Steps', () => {
|
|
it('Responds', () => {});
|
|
setups();
|
|
it('Check parsing and reading of steps', async () => {
|
|
const yamlString = `hook: before
|
|
commands: echo "test"`;
|
|
const yamlString2 = `- hook: before
|
|
commands: echo "test"`;
|
|
const overrides = {
|
|
versioning: 'None',
|
|
projectPath: 'test-project',
|
|
unityVersion: UnityVersioning.determineUnityVersion('test-project', UnityVersioning.read('test-project')),
|
|
targetPlatform: 'StandaloneLinux64',
|
|
cacheKey: `test-case-${uuidv4()}`,
|
|
};
|
|
CloudRunner.setup(await CreateParameters(overrides));
|
|
const stringObject = CloudRunnerCustomSteps.ParseSteps(yamlString);
|
|
const stringObject2 = CloudRunnerCustomSteps.ParseSteps(yamlString2);
|
|
|
|
CloudRunnerLogger.log(yamlString);
|
|
CloudRunnerLogger.log(JSON.stringify(stringObject, undefined, 4));
|
|
|
|
expect(stringObject.length).toBe(1);
|
|
expect(stringObject[0].hook).toBe(`before`);
|
|
expect(stringObject2.length).toBe(1);
|
|
expect(stringObject2[0].hook).toBe(`before`);
|
|
|
|
const getCustomStepsFromFiles = CloudRunnerCustomSteps.GetCustomStepsFromFiles(`before`);
|
|
CloudRunnerLogger.log(JSON.stringify(getCustomStepsFromFiles, undefined, 4));
|
|
});
|
|
if (CloudRunnerOptions.cloudRunnerDebug && CloudRunnerOptions.cloudRunnerCluster !== `k8s`) {
|
|
it('Run build once - check for pre and post custom hooks run contents', 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`,
|
|
};
|
|
const buildParameter2 = await CreateParameters(overrides);
|
|
const baseImage2 = new ImageTag(buildParameter2);
|
|
const results2 = await CloudRunner.run(buildParameter2, baseImage2.toString());
|
|
CloudRunnerLogger.log(`run 2 succeeded`);
|
|
|
|
const build2ContainsBuildSucceeded = results2.includes('Build succeeded');
|
|
const build2ContainsPreBuildHookRunMessage = results2.includes('before-build hook test!');
|
|
const build2ContainsPostBuildHookRunMessage = results2.includes('after-build hook test!');
|
|
|
|
const build2ContainsPreBuildStepMessage = results2.includes('before-build step test!');
|
|
const build2ContainsPostBuildStepMessage = results2.includes('after-build step test!');
|
|
|
|
expect(build2ContainsBuildSucceeded).toBeTruthy();
|
|
expect(build2ContainsPreBuildHookRunMessage).toBeTruthy();
|
|
expect(build2ContainsPostBuildHookRunMessage).toBeTruthy();
|
|
expect(build2ContainsPreBuildStepMessage).toBeTruthy();
|
|
expect(build2ContainsPostBuildStepMessage).toBeTruthy();
|
|
}, 1_000_000_000);
|
|
}
|
|
});
|