Extract post build steps into CLI command
parent
aca6752ecd
commit
cbde7b54ac
|
|
@ -486,6 +486,7 @@ const remote_client_1 = __nccwpck_require__(48135);
|
||||||
const cloud_runner_options_reader_1 = __importDefault(__nccwpck_require__(3343));
|
const cloud_runner_options_reader_1 = __importDefault(__nccwpck_require__(3343));
|
||||||
const github_1 = __importDefault(__nccwpck_require__(83654));
|
const github_1 = __importDefault(__nccwpck_require__(83654));
|
||||||
const task_parameter_serializer_1 = __nccwpck_require__(35346);
|
const task_parameter_serializer_1 = __nccwpck_require__(35346);
|
||||||
|
const cloud_runner_folders_1 = __nccwpck_require__(13527);
|
||||||
class Cli {
|
class Cli {
|
||||||
static get isCliMode() {
|
static get isCliMode() {
|
||||||
return Cli.options !== undefined && Cli.options.mode !== undefined && Cli.options.mode !== '';
|
return Cli.options !== undefined && Cli.options.mode !== undefined && Cli.options.mode !== '';
|
||||||
|
|
@ -568,6 +569,7 @@ class Cli {
|
||||||
}
|
}
|
||||||
static PostCLIBuild() {
|
static PostCLIBuild() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const buildParameter = yield __1.BuildParameters.create();
|
||||||
/*
|
/*
|
||||||
# LIBRARY CACHE
|
# LIBRARY CACHE
|
||||||
node ${builderPath} -m cache-push --cachePushFrom ${CloudRunnerFolders.ToLinuxFolder(
|
node ${builderPath} -m cache-push --cachePushFrom ${CloudRunnerFolders.ToLinuxFolder(
|
||||||
|
|
@ -585,6 +587,8 @@ class Cli {
|
||||||
${BuildAutomationWorkflow.GetCleanupCommand(CloudRunnerFolders.projectPathAbsolute)}`;
|
${BuildAutomationWorkflow.GetCleanupCommand(CloudRunnerFolders.projectPathAbsolute)}`;
|
||||||
*/
|
*/
|
||||||
core.info(`Running POST build tasks`);
|
core.info(`Running POST build tasks`);
|
||||||
|
caching_1.Caching.PushToCache(cloud_runner_folders_1.CloudRunnerFolders.libraryFolderAbsolute, `${cloud_runner_folders_1.CloudRunnerFolders.cacheFolderFull}/Library`, `lib-${buildParameter.buildGuid}`);
|
||||||
|
caching_1.Caching.PushToCache(cloud_runner_folders_1.CloudRunnerFolders.projectBuildFolderAbsolute, `${cloud_runner_folders_1.CloudRunnerFolders.cacheFolderFull}/build`, `build-${buildParameter.buildGuid}`);
|
||||||
return new Promise((result) => result(``));
|
return new Promise((result) => result(``));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -5095,7 +5099,7 @@ class BuildAutomationWorkflow {
|
||||||
${BuildAutomationWorkflow.setupCommands(builderPath)}
|
${BuildAutomationWorkflow.setupCommands(builderPath)}
|
||||||
${setupHooks.filter((x) => x.hook.includes(`after`)).map((x) => x.commands) || ' '}
|
${setupHooks.filter((x) => x.hook.includes(`after`)).map((x) => x.commands) || ' '}
|
||||||
${buildHooks.filter((x) => x.hook.includes(`before`)).map((x) => x.commands) || ' '}
|
${buildHooks.filter((x) => x.hook.includes(`before`)).map((x) => x.commands) || ' '}
|
||||||
${BuildAutomationWorkflow.BuildCommands(builderPath, cloud_runner_1.default.buildParameters.buildGuid)}
|
${BuildAutomationWorkflow.BuildCommands(builderPath)}
|
||||||
${buildHooks.filter((x) => x.hook.includes(`after`)).map((x) => x.commands) || ' '}`;
|
${buildHooks.filter((x) => x.hook.includes(`after`)).map((x) => x.commands) || ' '}`;
|
||||||
}
|
}
|
||||||
static setupCommands(builderPath) {
|
static setupCommands(builderPath) {
|
||||||
|
|
@ -5108,8 +5112,7 @@ class BuildAutomationWorkflow {
|
||||||
node ${builderPath} -m remote-cli`;
|
node ${builderPath} -m remote-cli`;
|
||||||
}
|
}
|
||||||
// ToDo: Replace with a very simple "node ${builderPath} -m build-cli" to run the scripts below without enlarging the request size
|
// ToDo: Replace with a very simple "node ${builderPath} -m build-cli" to run the scripts below without enlarging the request size
|
||||||
static BuildCommands(builderPath, guid) {
|
static BuildCommands(builderPath) {
|
||||||
const linuxCacheFolder = cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(cloud_runner_folders_1.CloudRunnerFolders.cacheFolderFull);
|
|
||||||
const distFolder = path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathAbsolute, 'dist');
|
const distFolder = path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathAbsolute, 'dist');
|
||||||
const ubuntuPlatformsFolder = path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathAbsolute, 'dist', 'platforms', 'ubuntu');
|
const ubuntuPlatformsFolder = path_1.default.join(cloud_runner_folders_1.CloudRunnerFolders.builderPathAbsolute, 'dist', 'platforms', 'ubuntu');
|
||||||
return `echo "game ci cloud runner init"
|
return `echo "game ci cloud runner init"
|
||||||
|
|
@ -5125,9 +5128,6 @@ class BuildAutomationWorkflow {
|
||||||
echo "game ci cloud runner push library to cache"
|
echo "game ci cloud runner push library to cache"
|
||||||
chmod +x ${builderPath}
|
chmod +x ${builderPath}
|
||||||
node ${builderPath} -m remote-cli-post-build
|
node ${builderPath} -m remote-cli-post-build
|
||||||
node ${builderPath} -m cache-push --cachePushFrom ${cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(cloud_runner_folders_1.CloudRunnerFolders.libraryFolderAbsolute)} --artifactName lib-${guid} --cachePushTo ${cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(`${linuxCacheFolder}/Library`)}
|
|
||||||
echo "game ci cloud runner push build to cache"
|
|
||||||
node ${builderPath} -m cache-push --cachePushFrom ${cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(cloud_runner_folders_1.CloudRunnerFolders.projectBuildFolderAbsolute)} --artifactName build-${guid} --cachePushTo ${`${cloud_runner_folders_1.CloudRunnerFolders.ToLinuxFolder(`${linuxCacheFolder}/build`)}`}
|
|
||||||
${BuildAutomationWorkflow.GetCleanupCommand(cloud_runner_folders_1.CloudRunnerFolders.projectPathAbsolute)}`;
|
${BuildAutomationWorkflow.GetCleanupCommand(cloud_runner_folders_1.CloudRunnerFolders.projectPathAbsolute)}`;
|
||||||
}
|
}
|
||||||
static GetCleanupCommand(cleanupPath) {
|
static GetCleanupCommand(cleanupPath) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -12,6 +12,7 @@ import { RemoteClient } from '../cloud-runner/remote-client';
|
||||||
import CloudRunnerOptionsReader from '../cloud-runner/services/cloud-runner-options-reader';
|
import CloudRunnerOptionsReader from '../cloud-runner/services/cloud-runner-options-reader';
|
||||||
import GitHub from '../github';
|
import GitHub from '../github';
|
||||||
import { TaskParameterSerializer } from '../cloud-runner/services/task-parameter-serializer';
|
import { TaskParameterSerializer } from '../cloud-runner/services/task-parameter-serializer';
|
||||||
|
import { CloudRunnerFolders } from '../cloud-runner/services/cloud-runner-folders';
|
||||||
|
|
||||||
export class Cli {
|
export class Cli {
|
||||||
public static options;
|
public static options;
|
||||||
|
|
@ -110,6 +111,8 @@ export class Cli {
|
||||||
|
|
||||||
@CliFunction(`remote-cli-post-build`, `runs a cloud runner build`)
|
@CliFunction(`remote-cli-post-build`, `runs a cloud runner build`)
|
||||||
public static async PostCLIBuild(): Promise<string> {
|
public static async PostCLIBuild(): Promise<string> {
|
||||||
|
const buildParameter = await BuildParameters.create();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
# LIBRARY CACHE
|
# LIBRARY CACHE
|
||||||
node ${builderPath} -m cache-push --cachePushFrom ${CloudRunnerFolders.ToLinuxFolder(
|
node ${builderPath} -m cache-push --cachePushFrom ${CloudRunnerFolders.ToLinuxFolder(
|
||||||
|
|
@ -126,8 +129,21 @@ export class Cli {
|
||||||
# RETAINED WORKSPACE CLEANUP
|
# RETAINED WORKSPACE CLEANUP
|
||||||
${BuildAutomationWorkflow.GetCleanupCommand(CloudRunnerFolders.projectPathAbsolute)}`;
|
${BuildAutomationWorkflow.GetCleanupCommand(CloudRunnerFolders.projectPathAbsolute)}`;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
core.info(`Running POST build tasks`);
|
core.info(`Running POST build tasks`);
|
||||||
|
|
||||||
|
Caching.PushToCache(
|
||||||
|
CloudRunnerFolders.libraryFolderAbsolute,
|
||||||
|
`${CloudRunnerFolders.cacheFolderFull}/Library`,
|
||||||
|
`lib-${buildParameter.buildGuid}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
Caching.PushToCache(
|
||||||
|
CloudRunnerFolders.projectBuildFolderAbsolute,
|
||||||
|
`${CloudRunnerFolders.cacheFolderFull}/build`,
|
||||||
|
`build-${buildParameter.buildGuid}`,
|
||||||
|
);
|
||||||
|
|
||||||
return new Promise((result) => result(``));
|
return new Promise((result) => result(``));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
||||||
${BuildAutomationWorkflow.setupCommands(builderPath)}
|
${BuildAutomationWorkflow.setupCommands(builderPath)}
|
||||||
${setupHooks.filter((x) => x.hook.includes(`after`)).map((x) => x.commands) || ' '}
|
${setupHooks.filter((x) => x.hook.includes(`after`)).map((x) => x.commands) || ' '}
|
||||||
${buildHooks.filter((x) => x.hook.includes(`before`)).map((x) => x.commands) || ' '}
|
${buildHooks.filter((x) => x.hook.includes(`before`)).map((x) => x.commands) || ' '}
|
||||||
${BuildAutomationWorkflow.BuildCommands(builderPath, CloudRunner.buildParameters.buildGuid)}
|
${BuildAutomationWorkflow.BuildCommands(builderPath)}
|
||||||
${buildHooks.filter((x) => x.hook.includes(`after`)).map((x) => x.commands) || ' '}`;
|
${buildHooks.filter((x) => x.hook.includes(`after`)).map((x) => x.commands) || ' '}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,8 +130,7 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToDo: Replace with a very simple "node ${builderPath} -m build-cli" to run the scripts below without enlarging the request size
|
// ToDo: Replace with a very simple "node ${builderPath} -m build-cli" to run the scripts below without enlarging the request size
|
||||||
private static BuildCommands(builderPath, guid) {
|
private static BuildCommands(builderPath) {
|
||||||
const linuxCacheFolder = CloudRunnerFolders.ToLinuxFolder(CloudRunnerFolders.cacheFolderFull);
|
|
||||||
const distFolder = path.join(CloudRunnerFolders.builderPathAbsolute, 'dist');
|
const distFolder = path.join(CloudRunnerFolders.builderPathAbsolute, 'dist');
|
||||||
const ubuntuPlatformsFolder = path.join(CloudRunnerFolders.builderPathAbsolute, 'dist', 'platforms', 'ubuntu');
|
const ubuntuPlatformsFolder = path.join(CloudRunnerFolders.builderPathAbsolute, 'dist', 'platforms', 'ubuntu');
|
||||||
|
|
||||||
|
|
@ -148,13 +147,6 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
||||||
echo "game ci cloud runner push library to cache"
|
echo "game ci cloud runner push library to cache"
|
||||||
chmod +x ${builderPath}
|
chmod +x ${builderPath}
|
||||||
node ${builderPath} -m remote-cli-post-build
|
node ${builderPath} -m remote-cli-post-build
|
||||||
node ${builderPath} -m cache-push --cachePushFrom ${CloudRunnerFolders.ToLinuxFolder(
|
|
||||||
CloudRunnerFolders.libraryFolderAbsolute,
|
|
||||||
)} --artifactName lib-${guid} --cachePushTo ${CloudRunnerFolders.ToLinuxFolder(`${linuxCacheFolder}/Library`)}
|
|
||||||
echo "game ci cloud runner push build to cache"
|
|
||||||
node ${builderPath} -m cache-push --cachePushFrom ${CloudRunnerFolders.ToLinuxFolder(
|
|
||||||
CloudRunnerFolders.projectBuildFolderAbsolute,
|
|
||||||
)} --artifactName build-${guid} --cachePushTo ${`${CloudRunnerFolders.ToLinuxFolder(`${linuxCacheFolder}/build`)}`}
|
|
||||||
${BuildAutomationWorkflow.GetCleanupCommand(CloudRunnerFolders.projectPathAbsolute)}`;
|
${BuildAutomationWorkflow.GetCleanupCommand(CloudRunnerFolders.projectPathAbsolute)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue