add: new inputs and method params
parent
7c242f70d9
commit
b02540afdc
|
@ -56,6 +56,14 @@ inputs:
|
|||
required: false
|
||||
default: false
|
||||
description: 'Whether the tests are being run for a Unity package instead of a Unity project. If true, the action can only be run on Linux runners, and any custom docker image passed to this action must have `jq` installed. NOTE: may not work properly for packages with dependencies outside of the Unity Registry.'
|
||||
scopedRegistryUrl:
|
||||
required: false
|
||||
default: ''
|
||||
description: 'Scoped registry to use for resolving package dependencies. Only applicable if packageMode is true.'
|
||||
registryScopes:
|
||||
required: false
|
||||
default: ''
|
||||
description: 'Registry scopes to use for resolving package dependencies. Only applicable if packageMode is true. Required if scopedRegistry is set.'
|
||||
chownFilesTo:
|
||||
required: false
|
||||
default: ''
|
||||
|
|
|
@ -98,7 +98,7 @@ function run() {
|
|||
try {
|
||||
model_1.Action.checkCompatibility();
|
||||
const { workspace, actionFolder } = model_1.Action;
|
||||
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, githubToken, checkName, packageMode, packageName, chownFilesTo, dockerCpuLimit, dockerMemoryLimit, dockerIsolationMode, unityLicensingServer, runAsHostUser, containerRegistryRepository, containerRegistryImageVersion, unitySerial, } = model_1.Input.getFromUser();
|
||||
const { editorVersion, customImage, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, githubToken, checkName, packageMode, packageName, scopedRegistryUrl, registryScopes, chownFilesTo, dockerCpuLimit, dockerMemoryLimit, dockerIsolationMode, unityLicensingServer, runAsHostUser, containerRegistryRepository, containerRegistryImageVersion, unitySerial, } = model_1.Input.getFromUser();
|
||||
const baseImage = new model_1.ImageTag({
|
||||
editorVersion,
|
||||
customImage,
|
||||
|
@ -120,6 +120,8 @@ function run() {
|
|||
sshPublicKeysDirectoryPath,
|
||||
packageMode,
|
||||
packageName,
|
||||
scopedRegistryUrl,
|
||||
registryScopes,
|
||||
gitPrivateToken,
|
||||
githubToken,
|
||||
chownFilesTo,
|
||||
|
@ -398,6 +400,8 @@ class ImageEnvironmentFactory {
|
|||
{ name: 'ARTIFACTS_PATH', value: parameters.artifactsPath },
|
||||
{ name: 'PACKAGE_MODE', value: parameters.packageMode },
|
||||
{ name: 'PACKAGE_NAME', value: parameters.packageName },
|
||||
{ name: 'SCOPED_REGISTRY_URL', value: parameters.scopedRegistryUrl },
|
||||
{ name: 'REGISTRY_SCOPES', value: parameters.registryScopes },
|
||||
{ name: 'GIT_PRIVATE_TOKEN', value: parameters.gitPrivateToken },
|
||||
{ name: 'VERSION', value: parameters.buildVersion },
|
||||
{ name: 'CUSTOM_PARAMETERS', value: parameters.customParameters },
|
||||
|
@ -711,6 +715,9 @@ class Input {
|
|||
const checkName = (0, core_1.getInput)('checkName') || 'Test Results';
|
||||
const rawPackageMode = (0, core_1.getInput)('packageMode') || 'false';
|
||||
let packageName = '';
|
||||
const scopedRegistryUrl = (0, core_1.getInput)('scopedRegistryUrl') || '';
|
||||
const rawScopes = (0, core_1.getInput)('registryScopes') || '';
|
||||
let registryScopes = [];
|
||||
const chownFilesTo = (0, core_1.getInput)('chownFilesTo') || '';
|
||||
const dockerCpuLimit = (0, core_1.getInput)('dockerCpuLimit') || os_1.default.cpus().length.toString();
|
||||
const bytesInMegabyte = 1024 * 1024;
|
||||
|
@ -765,6 +772,12 @@ class Input {
|
|||
}
|
||||
packageName = this.getPackageNameFromPackageJson(projectPath);
|
||||
this.verifyTestsFolderIsPresent(projectPath);
|
||||
if (scopedRegistryUrl !== '') {
|
||||
if (rawScopes === '') {
|
||||
throw new Error('Scoped registry is set, but registryScopes is not set. registryScopes is required when using scopedRegistryUrl.');
|
||||
}
|
||||
registryScopes = rawScopes.split(',').map(scope => scope.trim());
|
||||
}
|
||||
}
|
||||
if (runAsHostUser !== 'true' && runAsHostUser !== 'false') {
|
||||
throw new Error(`Invalid runAsHostUser "${runAsHostUser}"`);
|
||||
|
@ -805,6 +818,8 @@ class Input {
|
|||
checkName,
|
||||
packageMode,
|
||||
packageName,
|
||||
scopedRegistryUrl,
|
||||
registryScopes,
|
||||
chownFilesTo,
|
||||
dockerCpuLimit,
|
||||
dockerMemoryLimit,
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -22,6 +22,8 @@ export async function run() {
|
|||
checkName,
|
||||
packageMode,
|
||||
packageName,
|
||||
scopedRegistryUrl,
|
||||
registryScopes,
|
||||
chownFilesTo,
|
||||
dockerCpuLimit,
|
||||
dockerMemoryLimit,
|
||||
|
@ -55,6 +57,8 @@ export async function run() {
|
|||
sshPublicKeysDirectoryPath,
|
||||
packageMode,
|
||||
packageName,
|
||||
scopedRegistryUrl,
|
||||
registryScopes,
|
||||
gitPrivateToken,
|
||||
githubToken,
|
||||
chownFilesTo,
|
||||
|
|
|
@ -38,6 +38,8 @@ class ImageEnvironmentFactory {
|
|||
{ name: 'ARTIFACTS_PATH', value: parameters.artifactsPath },
|
||||
{ name: 'PACKAGE_MODE', value: parameters.packageMode },
|
||||
{ name: 'PACKAGE_NAME', value: parameters.packageName },
|
||||
{ name: 'SCOPED_REGISTRY_URL', value: parameters.scopedRegistryUrl },
|
||||
{ name: 'REGISTRY_SCOPES', value: parameters.registryScopes },
|
||||
{ name: 'GIT_PRIVATE_TOKEN', value: parameters.gitPrivateToken },
|
||||
{ name: 'VERSION', value: parameters.buildVersion },
|
||||
{ name: 'CUSTOM_PARAMETERS', value: parameters.customParameters },
|
||||
|
|
|
@ -101,6 +101,9 @@ class Input {
|
|||
const checkName = getInput('checkName') || 'Test Results';
|
||||
const rawPackageMode = getInput('packageMode') || 'false';
|
||||
let packageName = '';
|
||||
const scopedRegistryUrl = getInput('scopedRegistryUrl') || '';
|
||||
const rawScopes = getInput('registryScopes') || '';
|
||||
let registryScopes: string[] = [];
|
||||
const chownFilesTo = getInput('chownFilesTo') || '';
|
||||
const dockerCpuLimit = getInput('dockerCpuLimit') || os.cpus().length.toString();
|
||||
const bytesInMegabyte = 1024 * 1024;
|
||||
|
@ -171,6 +174,16 @@ class Input {
|
|||
|
||||
packageName = this.getPackageNameFromPackageJson(projectPath);
|
||||
this.verifyTestsFolderIsPresent(projectPath);
|
||||
|
||||
if (scopedRegistryUrl !== '') {
|
||||
if (rawScopes === '') {
|
||||
throw new Error(
|
||||
'Scoped registry is set, but registryScopes is not set. registryScopes is required when using scopedRegistryUrl.',
|
||||
);
|
||||
}
|
||||
|
||||
registryScopes = rawScopes.split(',').map(scope => scope.trim());
|
||||
}
|
||||
}
|
||||
|
||||
if (runAsHostUser !== 'true' && runAsHostUser !== 'false') {
|
||||
|
@ -219,6 +232,8 @@ class Input {
|
|||
checkName,
|
||||
packageMode,
|
||||
packageName,
|
||||
scopedRegistryUrl,
|
||||
registryScopes,
|
||||
chownFilesTo,
|
||||
dockerCpuLimit,
|
||||
dockerMemoryLimit,
|
||||
|
|
Loading…
Reference in New Issue