mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-06-02 14:56:16 -07:00
Compare commits
1 Commits
chore/remo
...
chore/depe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb2485c287 |
@@ -195,5 +195,5 @@ branding:
|
||||
icon: 'box'
|
||||
color: 'gray-dark'
|
||||
runs:
|
||||
using: 'node24'
|
||||
using: 'node20'
|
||||
main: 'dist/index.js'
|
||||
|
||||
13
package.json
13
package.json
@@ -32,16 +32,19 @@
|
||||
"node": ">=18.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/cache": "^4.0.0",
|
||||
"@actions/cache": "^4.1.0",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@actions/github": "^6.0.1",
|
||||
"commander": "^9.5.0",
|
||||
"commander-ts": "^0.2.0",
|
||||
"md5": "^2.3.0",
|
||||
"nanoid": "^3.3.1",
|
||||
"semver": "^7.5.2",
|
||||
"nanoid": "^3.3.12",
|
||||
"reflect-metadata": "^0.2.2",
|
||||
"semver": "^7.7.4",
|
||||
"ts-md5": "^1.3.1",
|
||||
"unity-changeset": "^3.1.0",
|
||||
"yaml": "^2.2.2"
|
||||
"yaml": "^2.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^17.0.23",
|
||||
|
||||
@@ -66,6 +66,12 @@ vi.mock('./model', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('./model/cli/cli', () => ({
|
||||
Cli: {
|
||||
InitCliMode: vi.fn().mockReturnValue(false),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('./model/mac-builder', () => ({
|
||||
__esModule: true,
|
||||
default: {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as core from '@actions/core';
|
||||
import { Action, BuildParameters, Cache, Docker, ImageTag, Output } from './model';
|
||||
import { Cli } from './model/cli/cli';
|
||||
import MacBuilder from './model/mac-builder';
|
||||
import PlatformSetup from './model/platform-setup';
|
||||
import { Plugin, loadPlugin } from './model/plugin';
|
||||
@@ -8,6 +9,11 @@ import { Plugin, loadPlugin } from './model/plugin';
|
||||
// vitest's module re-loading (which changed in vitest 4).
|
||||
export async function runMain() {
|
||||
try {
|
||||
if (Cli.InitCliMode()) {
|
||||
await Cli.RunCli();
|
||||
|
||||
return;
|
||||
}
|
||||
Action.checkCompatibility();
|
||||
Cache.verify();
|
||||
|
||||
|
||||
45
src/model/cli/cli-functions-repository.ts
Normal file
45
src/model/cli/cli-functions-repository.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
export class CliFunctionsRepository {
|
||||
private static targets: any[] = [];
|
||||
public static PushCliFunction(
|
||||
target: any,
|
||||
propertyKey: string,
|
||||
descriptor: PropertyDescriptor,
|
||||
key: string,
|
||||
description: string,
|
||||
) {
|
||||
CliFunctionsRepository.targets.push({
|
||||
target,
|
||||
propertyKey,
|
||||
descriptor,
|
||||
key,
|
||||
description,
|
||||
});
|
||||
}
|
||||
|
||||
public static GetCliFunctions(key: any) {
|
||||
const results = CliFunctionsRepository.targets.find((x) => x.key === key);
|
||||
if (results === undefined || results.length === 0) {
|
||||
throw new Error(`no CLI mode found for ${key}`);
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
public static GetAllCliModes() {
|
||||
return CliFunctionsRepository.targets.map((x) => {
|
||||
return {
|
||||
key: x.key,
|
||||
description: x.description,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
public static PushCliFunctionSource(cliFunction: any) {}
|
||||
}
|
||||
|
||||
export function CliFunction(key: string, description: string) {
|
||||
return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
|
||||
CliFunctionsRepository.PushCliFunction(target, propertyKey, descriptor, key, description);
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,13 @@
|
||||
import { Command } from 'commander-ts';
|
||||
import { Input } from '..';
|
||||
import * as core from '@actions/core';
|
||||
import { ActionYamlReader } from '../input-readers/action-yaml';
|
||||
import { CliFunction, CliFunctionsRepository } from './cli-functions-repository';
|
||||
import { OptionValues } from 'commander';
|
||||
import { InputKey } from '../input';
|
||||
|
||||
export class Cli {
|
||||
public static options: Record<string, any> | undefined;
|
||||
public static options: OptionValues | undefined;
|
||||
static get isCliMode() {
|
||||
return Cli.options !== undefined && Cli.options.mode !== undefined && Cli.options.mode !== '';
|
||||
}
|
||||
@@ -13,4 +21,80 @@ export class Cli {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public static InitCliMode() {
|
||||
const program = new Command();
|
||||
program.version('0.0.1');
|
||||
|
||||
const actionYamlReader: ActionYamlReader = new ActionYamlReader();
|
||||
const properties = Object.getOwnPropertyNames(Input).filter(
|
||||
(p) => p !== 'length' && p !== 'prototype' && p !== 'name',
|
||||
);
|
||||
for (const element of properties) {
|
||||
program.option(`--${element} <${element}>`, actionYamlReader.GetActionYamlValue(element));
|
||||
}
|
||||
program.option(
|
||||
'-m, --mode <mode>',
|
||||
CliFunctionsRepository.GetAllCliModes()
|
||||
.map((x) => `${x.key} (${x.description})`)
|
||||
.join(` | `),
|
||||
);
|
||||
program.option(
|
||||
'--populateOverride <populateOverride>',
|
||||
'should use override query to pull input false by default',
|
||||
);
|
||||
program.option('--cachePushFrom <cachePushFrom>', 'cache push from source folder');
|
||||
program.option('--cachePushTo <cachePushTo>', 'cache push to caching folder');
|
||||
program.option('--artifactName <artifactName>', 'caching artifact name');
|
||||
program.option('--select <select>', 'select a particular resource');
|
||||
program.option('--logFile <logFile>', 'output to log file (log stream only)');
|
||||
program.option('--profilePath <profilePath>', 'path to submodule profile YAML');
|
||||
program.option('--variantPath <variantPath>', 'path to submodule variant YAML');
|
||||
program.option('--agentPath <agentPath>', 'path to custom LFS transfer agent');
|
||||
program.option('--agentArgs <agentArgs>', 'arguments for custom LFS transfer agent');
|
||||
program.option(
|
||||
'--storagePaths <storagePaths>',
|
||||
'semicolon-separated storage paths for LFS agent',
|
||||
);
|
||||
program.parse(process.argv);
|
||||
Cli.options = program.opts();
|
||||
|
||||
return Cli.isCliMode;
|
||||
}
|
||||
|
||||
static async RunCli(): Promise<void> {
|
||||
const results = CliFunctionsRepository.GetCliFunctions(Cli.options?.mode);
|
||||
if (!results) {
|
||||
throw new Error(
|
||||
`Unknown CLI mode: ${Cli.options?.mode}. Orchestrator CLI features require @game-ci/orchestrator.`,
|
||||
);
|
||||
}
|
||||
core.info(`Entrypoint: ${results.key}`);
|
||||
Cli.options!.versioning = 'None';
|
||||
|
||||
return await results.target[results.propertyKey](Cli.options);
|
||||
}
|
||||
|
||||
@CliFunction(`print-input`, `prints all input`)
|
||||
private static logInput() {
|
||||
core.info(`\n`);
|
||||
core.info(`INPUT:`);
|
||||
const properties = Object.getOwnPropertyNames(Input).filter(
|
||||
(p) => p !== 'length' && p !== 'prototype' && p !== 'name',
|
||||
);
|
||||
for (const element of properties) {
|
||||
if (
|
||||
element in Input &&
|
||||
Input[element as InputKey] !== undefined &&
|
||||
Input[element as InputKey] !== '' &&
|
||||
typeof Input[element as InputKey] !== `function` &&
|
||||
element !== 'length' &&
|
||||
element !== 'cliOptions' &&
|
||||
element !== 'prototype'
|
||||
) {
|
||||
core.info(`${element} ${Input[element as InputKey]}`);
|
||||
}
|
||||
}
|
||||
core.info(`\n`);
|
||||
}
|
||||
}
|
||||
|
||||
46
yarn.lock
46
yarn.lock
@@ -5,7 +5,7 @@ __metadata:
|
||||
version: 9
|
||||
cacheKey: 10
|
||||
|
||||
"@actions/cache@npm:^4.0.0":
|
||||
"@actions/cache@npm:^4.1.0":
|
||||
version: 4.1.0
|
||||
resolution: "@actions/cache@npm:4.1.0"
|
||||
dependencies:
|
||||
@@ -42,7 +42,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@actions/github@npm:^6.0.0":
|
||||
"@actions/github@npm:^6.0.1":
|
||||
version: 6.0.1
|
||||
resolution: "@actions/github@npm:6.0.1"
|
||||
dependencies:
|
||||
@@ -2302,6 +2302,17 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"commander-ts@npm:^0.2.0":
|
||||
version: 0.2.0
|
||||
resolution: "commander-ts@npm:0.2.0"
|
||||
dependencies:
|
||||
commander: "npm:^7.2.0"
|
||||
peerDependencies:
|
||||
reflect-metadata: ^0.1.13
|
||||
checksum: 10/b57582d0eb98e7bce0a05bfe7c44b8ed01a0f77a05358ec9d35ef6406ac6b3031590fa49e1bff58649ae511bb18a576b01151cb94de9c12c7f0be7f865ca494f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"commander@npm:^10.0.1":
|
||||
version: 10.0.1
|
||||
resolution: "commander@npm:10.0.1"
|
||||
@@ -2330,6 +2341,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"commander@npm:^9.5.0":
|
||||
version: 9.5.0
|
||||
resolution: "commander@npm:9.5.0"
|
||||
checksum: 10/41c49b3d0f94a1fbeb0463c85b13f15aa15a9e0b4d5e10a49c0a1d58d4489b549d62262b052ae0aa6cfda53299bee487bfe337825df15e342114dde543f82906
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"common-path-prefix@npm:^3.0.0":
|
||||
version: 3.0.0
|
||||
resolution: "common-path-prefix@npm:3.0.0"
|
||||
@@ -3782,7 +3800,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"nanoid@npm:^3.3.1, nanoid@npm:^3.3.11":
|
||||
"nanoid@npm:^3.3.11, nanoid@npm:^3.3.12":
|
||||
version: 3.3.12
|
||||
resolution: "nanoid@npm:3.3.12"
|
||||
bin:
|
||||
@@ -4196,6 +4214,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"reflect-metadata@npm:^0.2.2":
|
||||
version: 0.2.2
|
||||
resolution: "reflect-metadata@npm:0.2.2"
|
||||
checksum: 10/1c93f9ac790fea1c852fde80c91b2760420069f4862f28e6fae0c00c6937a56508716b0ed2419ab02869dd488d123c4ab92d062ae84e8739ea7417fae10c4745
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"regexp-tree@npm:^0.1.27":
|
||||
version: 0.1.27
|
||||
resolution: "regexp-tree@npm:0.1.27"
|
||||
@@ -4782,15 +4807,17 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "unity-builder@workspace:."
|
||||
dependencies:
|
||||
"@actions/cache": "npm:^4.0.0"
|
||||
"@actions/cache": "npm:^4.1.0"
|
||||
"@actions/core": "npm:^1.11.1"
|
||||
"@actions/exec": "npm:^1.1.1"
|
||||
"@actions/github": "npm:^6.0.0"
|
||||
"@actions/github": "npm:^6.0.1"
|
||||
"@types/node": "npm:^17.0.23"
|
||||
"@types/semver": "npm:^7.3.9"
|
||||
"@typescript/native-preview": "npm:^7.0.0-dev.20260505.1"
|
||||
"@vercel/ncc": "npm:^0.36.1"
|
||||
"@vitest/coverage-istanbul": "npm:^4.1.5"
|
||||
commander: "npm:^9.5.0"
|
||||
commander-ts: "npm:^0.2.0"
|
||||
cross-env: "npm:^7.0.3"
|
||||
eslint: "npm:^10.3.0"
|
||||
eslint-plugin-unicorn: "npm:^64.0.0"
|
||||
@@ -4798,18 +4825,19 @@ __metadata:
|
||||
js-yaml: "npm:^4.1.0"
|
||||
lint-staged: "npm:^16.4.0"
|
||||
md5: "npm:^2.3.0"
|
||||
nanoid: "npm:^3.3.1"
|
||||
nanoid: "npm:^3.3.12"
|
||||
node-fetch: "npm:2"
|
||||
oxfmt: "npm:^0.48.0"
|
||||
oxlint: "npm:^1.63.0"
|
||||
semver: "npm:^7.5.2"
|
||||
reflect-metadata: "npm:^0.2.2"
|
||||
semver: "npm:^7.7.4"
|
||||
ts-md5: "npm:^1.3.1"
|
||||
ts-node: "npm:10.8.1"
|
||||
typescript: "npm:4.7.4"
|
||||
unity-changeset: "npm:^3.1.0"
|
||||
vite: "npm:^7"
|
||||
vitest: "npm:^4"
|
||||
yaml: "npm:^2.2.2"
|
||||
yaml: "npm:^2.8.4"
|
||||
yarn-audit-fix: "npm:^9.3.8"
|
||||
dependenciesMeta:
|
||||
lefthook:
|
||||
@@ -5181,7 +5209,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"yaml@npm:^2.2.2, yaml@npm:^2.8.2":
|
||||
"yaml@npm:^2.8.2, yaml@npm:^2.8.4":
|
||||
version: 2.8.4
|
||||
resolution: "yaml@npm:2.8.4"
|
||||
bin:
|
||||
|
||||
Reference in New Issue
Block a user