Compare commits

...

8 Commits

Author SHA1 Message Date
frostebite
4233b08bae chore: rebuild dist after rebase onto main
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-03 18:04:51 +01:00
Daniel Lupiañez Casares
2badde1790 Use latests unity version for Xcode compatibility with modern versions 2026-05-03 18:04:17 +01:00
Daniel Lupiañez Casares
eba50f7627 Tests for Build Parameters 2026-05-03 18:04:17 +01:00
Daniel Lupiañez Casares
f8b20890d9 Adds tests for Inputs 2026-05-03 18:04:16 +01:00
Daniel Lupiañez Casares
b57598a959 Uses useHostNetwork in docker arguments for the linux command 2026-05-03 18:04:15 +01:00
Daniel Lupiañez Casares
7b2ec07fc1 Adds useHostNetwork to BuildParameters 2026-05-03 18:04:14 +01:00
Daniel Lupiañez Casares
3d3a018c23 Add useHostNetwork to Input class 2026-05-03 18:04:14 +01:00
Daniel Lupiañez Casares
a12e3e829e Add optional argument to action 2026-05-03 18:04:13 +01:00
11 changed files with 54 additions and 11 deletions

View File

@@ -18,9 +18,9 @@ jobs:
projectPath: projectPath:
- test-project - test-project
unityVersion: unityVersion:
- 2021.3.45f1 - 2021.3.45f2
- 2022.3.13f1 - 2022.3.62f3
- 2023.2.2f1 - 2023.2.22f1
targetPlatform: targetPlatform:
- StandaloneOSX # Build a MacOS executable - StandaloneOSX # Build a MacOS executable
- iOS # Build an iOS executable - iOS # Build an iOS executable

View File

@@ -48,9 +48,9 @@ jobs:
projectPath: projectPath:
- test-project - test-project
unityVersion: unityVersion:
- 2021.3.32f1 - 2021.3.45f2
- 2022.3.13f1 - 2022.3.62f3
- 2023.2.2f1 - 2023.2.22f1
targetPlatform: targetPlatform:
- StandaloneOSX # Build a macOS standalone (Intel 64-bit) with mono backend. - StandaloneOSX # Build a macOS standalone (Intel 64-bit) with mono backend.
- StandaloneWindows64 # Build a Windows 64-bit standalone with mono backend. - StandaloneWindows64 # Build a Windows 64-bit standalone with mono backend.

View File

@@ -18,9 +18,9 @@ jobs:
projectPath: projectPath:
- test-project - test-project
unityVersion: unityVersion:
- 2021.3.32f1 - 2021.3.45f2
- 2022.3.13f1 - 2022.3.62f3
- 2023.2.2f1 - 2023.2.22f1
targetPlatform: targetPlatform:
- Android # Build an Android apk. - Android # Build an Android apk.
- StandaloneWindows64 # Build a Windows 64-bit standalone. - StandaloneWindows64 # Build a Windows 64-bit standalone.

View File

@@ -47,6 +47,10 @@ inputs:
required: false required: false
default: '' default: ''
description: 'Custom parameters to configure the build.' description: 'Custom parameters to configure the build.'
useHostNetwork:
required: false
default: false
description: 'Initialises Docker using the host network. (Linux only)'
versioning: versioning:
required: false required: false
default: 'Semantic' default: 'Semantic'

8
dist/index.js generated vendored
View File

@@ -327,6 +327,7 @@ class BuildParameters {
androidExportType: input_1.default.androidExportType, androidExportType: input_1.default.androidExportType,
androidSymbolType: androidSymbolExportType, androidSymbolType: androidSymbolExportType,
customParameters: input_1.default.customParameters, customParameters: input_1.default.customParameters,
useHostNetwork: input_1.default.useHostNetwork,
sshAgent: input_1.default.sshAgent, sshAgent: input_1.default.sshAgent,
sshPublicKeysDirectoryPath: input_1.default.sshPublicKeysDirectoryPath, sshPublicKeysDirectoryPath: input_1.default.sshPublicKeysDirectoryPath,
gitPrivateToken: input_1.default.gitPrivateToken ?? (await github_cli_1.GithubCliReader.GetGitHubAuthToken()), gitPrivateToken: input_1.default.gitPrivateToken ?? (await github_cli_1.GithubCliReader.GetGitHubAuthToken()),
@@ -637,7 +638,7 @@ class Docker {
return await (0, exec_1.exec)(runCommand, undefined, options); return await (0, exec_1.exec)(runCommand, undefined, options);
} }
static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) { static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) {
const { workspace, actionFolder, runnerTempPath, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, dockerWorkspacePath, dockerCpuLimit, dockerMemoryLimit, } = parameters; const { workspace, actionFolder, useHostNetwork, runnerTempPath, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, dockerWorkspacePath, dockerCpuLimit, dockerMemoryLimit, } = parameters;
const githubHome = node_path_1.default.join(runnerTempPath, '_github_home'); const githubHome = node_path_1.default.join(runnerTempPath, '_github_home');
if (!(0, node_fs_1.existsSync)(githubHome)) if (!(0, node_fs_1.existsSync)(githubHome))
(0, node_fs_1.mkdirSync)(githubHome); (0, node_fs_1.mkdirSync)(githubHome);
@@ -670,6 +671,7 @@ class Docker {
? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro' ? '--volume /home/runner/.ssh/known_hosts:/root/.ssh/known_hosts:ro'
: ''} \ : ''} \
${sshPublicKeysDirectoryPath ? `--volume ${sshPublicKeysDirectoryPath}:/root/.ssh:ro` : ''} \ ${sshPublicKeysDirectoryPath ? `--volume ${sshPublicKeysDirectoryPath}:/root/.ssh:ro` : ''} \
${useHostNetwork ? '--net=host' : ''} \
${entrypointBash ? `--entrypoint ${commandPrefix}` : ``} \ ${entrypointBash ? `--entrypoint ${commandPrefix}` : ``} \
${image} \ ${image} \
${entrypointBash ? `-c` : `${commandPrefix} -c`} \ ${entrypointBash ? `-c` : `${commandPrefix} -c`} \
@@ -1382,6 +1384,10 @@ class Input {
static get customParameters() { static get customParameters() {
return Input.getInput('customParameters') ?? ''; return Input.getInput('customParameters') ?? '';
} }
static get useHostNetwork() {
const input = Input.getInput('useHostNetwork') ?? false;
return input === 'true';
}
static get versioningStrategy() { static get versioningStrategy() {
return Input.getInput('versioning') ?? 'Semantic'; return Input.getInput('versioning') ?? 'Semantic';
} }

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@@ -219,5 +219,10 @@ describe('BuildParameters', () => {
jest.spyOn(Input, 'customParameters', 'get').mockReturnValue(mockValue); jest.spyOn(Input, 'customParameters', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ customParameters: mockValue })); await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ customParameters: mockValue }));
}); });
it.each([true, false])('returns the flag for useHostNetwork when %s', async (mockValue) => {
jest.spyOn(Input, 'useHostNetwork', 'get').mockReturnValue(mockValue);
await expect(BuildParameters.create()).resolves.toEqual(expect.objectContaining({ useHostNetwork: mockValue }));
});
}); });
}); });

View File

@@ -47,6 +47,7 @@ class BuildParameters {
public containerRegistryImageVersion!: string; public containerRegistryImageVersion!: string;
public customParameters!: string; public customParameters!: string;
public useHostNetwork!: boolean;
public sshAgent!: string; public sshAgent!: string;
public sshPublicKeysDirectoryPath!: string; public sshPublicKeysDirectoryPath!: string;
public providerStrategy!: string; public providerStrategy!: string;
@@ -141,6 +142,7 @@ class BuildParameters {
androidExportType: Input.androidExportType, androidExportType: Input.androidExportType,
androidSymbolType: androidSymbolExportType, androidSymbolType: androidSymbolExportType,
customParameters: Input.customParameters, customParameters: Input.customParameters,
useHostNetwork: Input.useHostNetwork,
sshAgent: Input.sshAgent, sshAgent: Input.sshAgent,
sshPublicKeysDirectoryPath: Input.sshPublicKeysDirectoryPath, sshPublicKeysDirectoryPath: Input.sshPublicKeysDirectoryPath,
gitPrivateToken: Input.gitPrivateToken ?? (await GithubCliReader.GetGitHubAuthToken()), gitPrivateToken: Input.gitPrivateToken ?? (await GithubCliReader.GetGitHubAuthToken()),

View File

@@ -42,6 +42,7 @@ class Docker {
const { const {
workspace, workspace,
actionFolder, actionFolder,
useHostNetwork,
runnerTempPath, runnerTempPath,
sshAgent, sshAgent,
sshPublicKeysDirectoryPath, sshPublicKeysDirectoryPath,
@@ -85,6 +86,7 @@ class Docker {
: '' : ''
} \ } \
${sshPublicKeysDirectoryPath ? `--volume ${sshPublicKeysDirectoryPath}:/root/.ssh:ro` : ''} \ ${sshPublicKeysDirectoryPath ? `--volume ${sshPublicKeysDirectoryPath}:/root/.ssh:ro` : ''} \
${useHostNetwork ? '--net=host' : ''} \
${entrypointBash ? `--entrypoint ${commandPrefix}` : ``} \ ${entrypointBash ? `--entrypoint ${commandPrefix}` : ``} \
${image} \ ${image} \
${entrypointBash ? `-c` : `${commandPrefix} -c`} \ ${entrypointBash ? `-c` : `${commandPrefix} -c`} \

View File

@@ -334,4 +334,22 @@ describe('Input', () => {
expect(spy).toHaveBeenCalledTimes(1); expect(spy).toHaveBeenCalledTimes(1);
}); });
}); });
describe('useHostNetwork', () => {
it('returns the default value', () => {
expect(Input.useHostNetwork).toStrictEqual(false);
});
it('returns true when string true is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
expect(Input.useHostNetwork).toStrictEqual(true);
expect(spy).toHaveBeenCalledTimes(1);
});
it('returns false when string false is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
expect(Input.useHostNetwork).toStrictEqual(false);
expect(spy).toHaveBeenCalledTimes(1);
});
});
}); });

View File

@@ -139,6 +139,12 @@ class Input {
return Input.getInput('customParameters') ?? ''; return Input.getInput('customParameters') ?? '';
} }
static get useHostNetwork(): boolean {
const input = Input.getInput('useHostNetwork') ?? false;
return input === 'true';
}
static get versioningStrategy(): string { static get versioningStrategy(): string {
return Input.getInput('versioning') ?? 'Semantic'; return Input.getInput('versioning') ?? 'Semantic';
} }