pull/300/merge
John Soros 2025-12-06 08:33:02 +01:00 committed by GitHub
commit 862a03d549
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 48 additions and 2 deletions

3
dist/index.js vendored
View File

@ -279,6 +279,7 @@ const Docker = {
--cidfile "${cidfile}" \
--rm \
${image_environment_factory_1.default.getEnvVarString(parameters)} \
--env BEE_CACHE_DIRECTORY=c:/github/workspace/Library/bee_cache \
--env TEST_PLATFORMS="${testPlatforms}" \
--env GITHUB_WORKSPACE="c:/github/workspace" \
${sshAgent ? '--env SSH_AUTH_SOCK=c:/ssh-agent' : ''} \
@ -1016,7 +1017,7 @@ const ResultsCheck = {
core.info(`Processing file ${filepath}...`);
try {
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
throw new Error('File does not appear to be a NUnit XML file');
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -25,6 +25,9 @@ namespace UnityTestRunnerAction
string[] commandLineArgs = Environment.GetCommandLineArgs();
playerOptions.locationPathName = commandLineArgs[Array.IndexOf(commandLineArgs, "-builtTestRunnerPath") + 1]; ;
// Enable parallel linking for IL2CPP builds
SetParallelLinking();
// Instruct the cleanup to exit the Editor if the run came from the command line.
// The variable is static because the cleanup is being invoked in a new instance of the class.
s_RunningPlayerTests = true;
@ -45,5 +48,46 @@ namespace UnityTestRunnerAction
var commandLineArgs = Environment.GetCommandLineArgs();
return commandLineArgs.Any(value => value == "-runTests");
}
private static void SetParallelLinking()
{
string additionalArgs = PlayerSettings.additionalIl2CppArgs;
// Determine number of parallel jobs (use CPU count, or default to 2)
int numJobs = Environment.ProcessorCount;
if (numJobs <= 0) numJobs = 2;
// Use host platform (where Unity is running) instead of target platform to support cross-compilation
// Platform-specific parallel linking flags based on the host platform
RuntimePlatform hostPlatform = Application.platform;
switch (hostPlatform)
{
case RuntimePlatform.WindowsEditor:
case RuntimePlatform.WindowsPlayer:
string cgthreadsFlag = $"--linker-flags=/CGTHREADS:{numJobs}";
if (!additionalArgs.Contains("/CGTHREADS:"))
{
additionalArgs = string.IsNullOrEmpty(additionalArgs)
? cgthreadsFlag
: $"{additionalArgs} {cgthreadsFlag}";
}
break;
case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
case RuntimePlatform.LinuxEditor:
case RuntimePlatform.LinuxPlayer:
if (!additionalArgs.Contains("--threads"))
{
additionalArgs = string.IsNullOrEmpty(additionalArgs)
? $"-Wl,--threads={numJobs}"
: $"{additionalArgs} -Wl,--threads={numJobs}";
}
break;
}
PlayerSettings.additionalIl2CppArgs = additionalArgs;
Debug.Log($"IL2CPP parallel linking enabled with {numJobs} jobs on host platform {hostPlatform}. Additional args: {additionalArgs}");
}
}
}

View File

@ -137,6 +137,7 @@ const Docker = {
--cidfile "${cidfile}" \
--rm \
${ImageEnvironmentFactory.getEnvVarString(parameters)} \
--env BEE_CACHE_DIRECTORY=c:/github/workspace/Library/bee_cache \
--env TEST_PLATFORMS="${testPlatforms}" \
--env GITHUB_WORKSPACE="c:/github/workspace" \
${sshAgent ? '--env SSH_AUTH_SOCK=c:/ssh-agent' : ''} \