Ejnar Arechavala 2025-03-03 18:15:09 +00:00 committed by GitHub
commit 6d349a9cd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 35 additions and 8 deletions

View File

@ -90,6 +90,13 @@ inputs:
required: false required: false
default: '' default: ''
description: 'Url to a unity license server for acquiring floating licenses.' description: 'Url to a unity license server for acquiring floating licenses.'
unityLicensingProductIds:
required: false
default: ''
description:
'Comma separated list of license product identifiers to request licenses for from the license server. Not setting
this will request the default license product configured on the licensing server. Only applicable if
unityLicensingServer is set.'
containerRegistryRepository: containerRegistryRepository:
required: false required: false
default: 'unityci/editor' default: 'unityci/editor'

13
dist/index.js generated vendored
View File

@ -47,7 +47,7 @@ function run() {
try { try {
model_1.Action.checkCompatibility(); model_1.Action.checkCompatibility();
const { workspace, actionFolder } = model_1.Action; const { workspace, actionFolder } = model_1.Action;
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 { editorVersion, customImage, projectPath, customParameters, testMode, coverageOptions, artifactsPath, useHostNetwork, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, githubToken, checkName, packageMode, packageName, scopedRegistryUrl, registryScopes, chownFilesTo, dockerCpuLimit, dockerMemoryLimit, dockerIsolationMode, unityLicensingServer, unityLicensingProductIds, runAsHostUser, containerRegistryRepository, containerRegistryImageVersion, unitySerial, } = model_1.Input.getFromUser();
const baseImage = new model_1.ImageTag({ const baseImage = new model_1.ImageTag({
editorVersion, editorVersion,
customImage, customImage,
@ -78,6 +78,7 @@ function run() {
dockerMemoryLimit, dockerMemoryLimit,
dockerIsolationMode, dockerIsolationMode,
unityLicensingServer, unityLicensingServer,
unityLicensingProductIds,
runAsHostUser, runAsHostUser,
unitySerial }, runnerContext)); unitySerial }, runnerContext));
} }
@ -209,7 +210,7 @@ const Docker = {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let runCommand = ''; let runCommand = '';
if (parameters.unityLicensingServer !== '') { if (parameters.unityLicensingServer !== '') {
licensing_server_setup_1.default.Setup(parameters.unityLicensingServer, parameters.actionFolder); licensing_server_setup_1.default.Setup(parameters.unityLicensingServer, parameters.actionFolder, parameters.unityLicensingProductIds);
} }
switch (process.platform) { switch (process.platform) {
case 'linux': case 'linux':
@ -338,6 +339,7 @@ class ImageEnvironmentFactory {
name: 'UNITY_LICENSING_SERVER', name: 'UNITY_LICENSING_SERVER',
value: parameters.unityLicensingServer, value: parameters.unityLicensingServer,
}, },
{ name: 'UNITY_LICENSING_PRODUCT_IDS', value: parameters.unityLicensingProductIds },
{ name: 'UNITY_VERSION', value: parameters.editorVersion }, { name: 'UNITY_VERSION', value: parameters.editorVersion },
{ {
name: 'USYM_UPLOAD_AUTH_TOKEN', name: 'USYM_UPLOAD_AUTH_TOKEN',
@ -651,6 +653,7 @@ class Input {
const customImage = (0, core_1.getInput)('customImage') || ''; const customImage = (0, core_1.getInput)('customImage') || '';
const rawProjectPath = (0, core_1.getInput)('projectPath') || '.'; const rawProjectPath = (0, core_1.getInput)('projectPath') || '.';
const unityLicensingServer = (0, core_1.getInput)('unityLicensingServer') || ''; const unityLicensingServer = (0, core_1.getInput)('unityLicensingServer') || '';
const unityLicensingProductIds = (0, core_1.getInput)('unityLicensingProductIds') || '';
const unityLicense = (0, core_1.getInput)('unityLicense') || ((_a = process.env['UNITY_LICENSE']) !== null && _a !== void 0 ? _a : ''); const unityLicense = (0, core_1.getInput)('unityLicense') || ((_a = process.env['UNITY_LICENSE']) !== null && _a !== void 0 ? _a : '');
let unitySerial = (_b = process.env['UNITY_SERIAL']) !== null && _b !== void 0 ? _b : ''; let unitySerial = (_b = process.env['UNITY_SERIAL']) !== null && _b !== void 0 ? _b : '';
const customParameters = (0, core_1.getInput)('customParameters') || ''; const customParameters = (0, core_1.getInput)('customParameters') || '';
@ -775,6 +778,7 @@ class Input {
dockerMemoryLimit, dockerMemoryLimit,
dockerIsolationMode, dockerIsolationMode,
unityLicensingServer, unityLicensingServer,
unityLicensingProductIds,
runAsHostUser, runAsHostUser,
containerRegistryRepository, containerRegistryRepository,
containerRegistryImageVersion, containerRegistryImageVersion,
@ -822,7 +826,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const fs_1 = __importDefault(__nccwpck_require__(7147)); const fs_1 = __importDefault(__nccwpck_require__(7147));
class LicensingServerSetup { class LicensingServerSetup {
static Setup(unityLicensingServer, actionFolder) { static Setup(unityLicensingServer, actionFolder, unityLicensingProductIds) {
const servicesConfigPath = `${actionFolder}/unity-config/services-config.json`; const servicesConfigPath = `${actionFolder}/unity-config/services-config.json`;
const servicesConfigPathTemplate = `${servicesConfigPath}.template`; const servicesConfigPathTemplate = `${servicesConfigPath}.template`;
if (!fs_1.default.existsSync(servicesConfigPathTemplate)) { if (!fs_1.default.existsSync(servicesConfigPathTemplate)) {
@ -831,6 +835,7 @@ class LicensingServerSetup {
} }
let servicesConfig = fs_1.default.readFileSync(servicesConfigPathTemplate).toString(); let servicesConfig = fs_1.default.readFileSync(servicesConfigPathTemplate).toString();
servicesConfig = servicesConfig.replace('%URL%', unityLicensingServer); servicesConfig = servicesConfig.replace('%URL%', unityLicensingServer);
servicesConfig = servicesConfig.replace('%LICENSE_PRODUCT_IDS%', unityLicensingProductIds);
fs_1.default.writeFileSync(servicesConfigPath, servicesConfig); fs_1.default.writeFileSync(servicesConfigPath, servicesConfig);
} }
} }
@ -1016,7 +1021,7 @@ const ResultsCheck = {
core.info(`Processing file ${filepath}...`); core.info(`Processing file ${filepath}...`);
try { try {
const content = fs.readFileSync(path_1.default.join(artifactsPath, filepath), 'utf8'); const content = fs.readFileSync(path_1.default.join(artifactsPath, filepath), 'utf8');
if (!content.includes('<test-results') && !content.includes('<test-run')) { if (!content.includes('<test-run')) {
// noinspection ExceptionCaughtLocallyJS // noinspection ExceptionCaughtLocallyJS
throw new Error('File does not appear to be a NUnit XML file'); throw new Error('File does not appear to be a NUnit XML file');
} }

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -3,5 +3,6 @@
"enableEntitlementLicensing": true, "enableEntitlementLicensing": true,
"enableFloatingApi": true, "enableFloatingApi": true,
"clientConnectTimeoutSec": 5, "clientConnectTimeoutSec": 5,
"clientHandshakeTimeoutSec": 10 "clientHandshakeTimeoutSec": 10,
"toolset": "%LICENSE_PRODUCT_IDS%"
} }

View File

@ -29,6 +29,7 @@ export async function run() {
dockerMemoryLimit, dockerMemoryLimit,
dockerIsolationMode, dockerIsolationMode,
unityLicensingServer, unityLicensingServer,
unityLicensingProductIds,
runAsHostUser, runAsHostUser,
containerRegistryRepository, containerRegistryRepository,
containerRegistryImageVersion, containerRegistryImageVersion,
@ -66,6 +67,7 @@ export async function run() {
dockerMemoryLimit, dockerMemoryLimit,
dockerIsolationMode, dockerIsolationMode,
unityLicensingServer, unityLicensingServer,
unityLicensingProductIds,
runAsHostUser, runAsHostUser,
unitySerial, unitySerial,
...runnerContext, ...runnerContext,

View File

@ -34,7 +34,11 @@ const Docker = {
let runCommand = ''; let runCommand = '';
if (parameters.unityLicensingServer !== '') { if (parameters.unityLicensingServer !== '') {
LicensingServerSetup.Setup(parameters.unityLicensingServer, parameters.actionFolder); LicensingServerSetup.Setup(
parameters.unityLicensingServer,
parameters.actionFolder,
parameters.unityLicensingProductIds,
);
} }
switch (process.platform) { switch (process.platform) {

View File

@ -27,6 +27,7 @@ class ImageEnvironmentFactory {
name: 'UNITY_LICENSING_SERVER', name: 'UNITY_LICENSING_SERVER',
value: parameters.unityLicensingServer, value: parameters.unityLicensingServer,
}, },
{ name: 'UNITY_LICENSING_PRODUCT_IDS', value: parameters.unityLicensingProductIds },
{ name: 'UNITY_VERSION', value: parameters.editorVersion }, { name: 'UNITY_VERSION', value: parameters.editorVersion },
{ {
name: 'USYM_UPLOAD_AUTH_TOKEN', name: 'USYM_UPLOAD_AUTH_TOKEN',

View File

@ -87,6 +87,7 @@ class Input {
const customImage = getInput('customImage') || ''; const customImage = getInput('customImage') || '';
const rawProjectPath = getInput('projectPath') || '.'; const rawProjectPath = getInput('projectPath') || '.';
const unityLicensingServer = getInput('unityLicensingServer') || ''; const unityLicensingServer = getInput('unityLicensingServer') || '';
const unityLicensingProductIds = getInput('unityLicensingProductIds') || '';
const unityLicense = getInput('unityLicense') || (process.env['UNITY_LICENSE'] ?? ''); const unityLicense = getInput('unityLicense') || (process.env['UNITY_LICENSE'] ?? '');
let unitySerial = process.env['UNITY_SERIAL'] ?? ''; let unitySerial = process.env['UNITY_SERIAL'] ?? '';
const customParameters = getInput('customParameters') || ''; const customParameters = getInput('customParameters') || '';
@ -239,6 +240,7 @@ class Input {
dockerMemoryLimit, dockerMemoryLimit,
dockerIsolationMode, dockerIsolationMode,
unityLicensingServer, unityLicensingServer,
unityLicensingProductIds,
runAsHostUser, runAsHostUser,
containerRegistryRepository, containerRegistryRepository,
containerRegistryImageVersion, containerRegistryImageVersion,

View File

@ -2,7 +2,11 @@
import fs from 'fs'; import fs from 'fs';
class LicensingServerSetup { class LicensingServerSetup {
public static Setup(unityLicensingServer, actionFolder: string) { public static Setup(
unityLicensingServer,
actionFolder: string,
unityLicensingProductIds: string,
) {
const servicesConfigPath = `${actionFolder}/unity-config/services-config.json`; const servicesConfigPath = `${actionFolder}/unity-config/services-config.json`;
const servicesConfigPathTemplate = `${servicesConfigPath}.template`; const servicesConfigPathTemplate = `${servicesConfigPath}.template`;
if (!fs.existsSync(servicesConfigPathTemplate)) { if (!fs.existsSync(servicesConfigPathTemplate)) {
@ -13,6 +17,7 @@ class LicensingServerSetup {
let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString(); let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString();
servicesConfig = servicesConfig.replace('%URL%', unityLicensingServer); servicesConfig = servicesConfig.replace('%URL%', unityLicensingServer);
servicesConfig = servicesConfig.replace('%LICENSE_PRODUCT_IDS%', unityLicensingProductIds);
fs.writeFileSync(servicesConfigPath, servicesConfig); fs.writeFileSync(servicesConfigPath, servicesConfig);
} }
} }