Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ inputs:
default: ''
required: false
description: 'The Unity licensing server address to use for activating Unity.'
unityLicensingToolset:
default: ''
required: false
description:
'Optional toolset identifier for Unity floating-license servers that host multiple toolsets (e.g.
"LicenseServer_1234567890_3"). When set, written to services-config.json so the Licensing Client
requests entitlements from the named toolset instead of relying on the server-side default. Leave
empty to preserve previous behavior.'
dockerWorkspacePath:
default: '/github/workspace'
required: false
Expand All @@ -181,8 +189,7 @@ inputs:
linux64RemoveExecutableExtension:
default: 'false'
required: false
description:
'When building for StandaloneLinux64, remove the default file extension of `.x86_64`. Set to true to restore the extensionless behavior from v4.'
description: 'When building for StandaloneLinux64, remove the default file extension of `.x86_64`. Set to true to restore the extensionless behavior from v4.'

outputs:
volume:
Expand Down
15,470 changes: 1,339 additions & 14,131 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

120 changes: 0 additions & 120 deletions dist/licenses.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions dist/platforms/ubuntu/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ if [[ "$RUN_AS_HOST_USER" == "true" ]]; then
# Don't stop on error when running our scripts as error handling is baked in
set +e

# Switch to the host user so we can create files with the correct ownership
su $USERNAME -c "$SHELL -c 'source /steps/runsteps.sh'"
# Switch to the host user so we can create files with the correct ownership.
# Pass HOME/USER explicitly so the Unity Licensing Client (which writes to
# ~/.config/unity3d) resolves a real, writable home directory rather than
# falling back to /home/UNKNOWN when getpwuid() inside the container has no
# entry for the host UID. -p preserves the rest of the env from root.
su -p $USERNAME -c "HOME=/home/$USERNAME USER=$USERNAME LOGNAME=$USERNAME $SHELL -c 'source /steps/runsteps.sh'"
else
echo "Running as root"

Expand Down
19 changes: 17 additions & 2 deletions src/model/build-parameters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,18 @@ describe('BuildParameters', () => {
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${true}
`(
'appends $expectedExtension for $targetPlatform with linux64RemoveExecutableExtension=$linux64RemoveExecutableExtension',
async ({ targetPlatform, expectedExtension, androidExportType, linux64RemoveExecutableExtension }) => {
async ({
targetPlatform,
expectedExtension,
androidExportType,
linux64RemoveExecutableExtension,
}) => {
vi.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
vi.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
vi.spyOn(Input, 'androidExportType', 'get').mockReturnValue(androidExportType);
vi.spyOn(Input, 'linux64RemoveExecutableExtension', 'get').mockReturnValue(linux64RemoveExecutableExtension);
vi.spyOn(Input, 'linux64RemoveExecutableExtension', 'get').mockReturnValue(
linux64RemoveExecutableExtension,
);
await expect(BuildParameters.create()).resolves.toEqual(
expect.objectContaining({ buildFile: `${targetPlatform}${expectedExtension}` }),
);
Expand Down Expand Up @@ -221,6 +228,14 @@ describe('BuildParameters', () => {
);
});

it('returns the unity licensing toolset', async () => {
const mockValue = 'LicenseServer_1234567890_3';
vi.spyOn(Input, 'unityLicensingToolset', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual(
expect.objectContaining({ unityLicensingToolset: mockValue }),
);
});

it('throws error when no unity license provider provided', async () => {
delete process.env.UNITY_LICENSE; // Need to delete this as it is set for every test currently
await expect(BuildParameters.create()).rejects.toThrowError();
Expand Down
2 changes: 2 additions & 0 deletions src/model/build-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class BuildParameters {
public customImage!: string;
public unitySerial!: string;
public unityLicensingServer!: string;
public unityLicensingToolset!: string;
public skipActivation!: string;
public runnerTempPath!: string;
public targetPlatform!: string;
Expand Down Expand Up @@ -136,6 +137,7 @@ class BuildParameters {
customImage: Input.customImage,
unitySerial,
unityLicensingServer: Input.unityLicensingServer,
unityLicensingToolset: Input.unityLicensingToolset,
skipActivation: Input.skipActivation,
runnerTempPath: Input.runnerTempPath,
targetPlatform: Input.targetPlatform,
Expand Down
4 changes: 4 additions & 0 deletions src/model/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ class Input {
return Input.getInput('unityLicensingServer') ?? '';
}

static get unityLicensingToolset(): string {
return Input.getInput('unityLicensingToolset') ?? '';
}

static get buildMethod(): string {
return Input.getInput('buildMethod') ?? ''; // Processed in docker file
}
Expand Down
7 changes: 7 additions & 0 deletions src/model/platform-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ class PlatformSetup {

let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString();
servicesConfig = servicesConfig.replace('%URL%', buildParameters.unityLicensingServer);

if (buildParameters.unityLicensingToolset) {
const parsed = JSON.parse(servicesConfig);
parsed.toolset = buildParameters.unityLicensingToolset;
servicesConfig = JSON.stringify(parsed, undefined, 2);
}

fs.writeFileSync(servicesConfigPath, servicesConfig);

SetupAndroid.setup(buildParameters);
Expand Down
Loading