fix: pass unityVersion through as --engineVersion instead of ignoring it (#847)

game-ci/cli#154 fixes the CLI's engine-detection middleware to respect
an explicit --engineVersion instead of always overwriting it with the
value auto-detected from the checked-out project's ProjectVersion.txt.

This was the root cause of PR #844's "WebGL on 6000.0.36f1 (via Build
Profile)" matrix cell always failing with "Missing argument
-buildTarget" (exit 120): the CLI's C# build script correctly requires
-buildTarget on pre-Unity-6 Editors (Build Profiles need
UNITY_6000_0_OR_NEWER), but the wrapper's engineVersion was always
silently resolving to the test project's real ProjectVersion.txt
(2021.3.45f1), not the 6000.0.36f1 the matrix cell actually needs to
exercise Build Profiles - because there was previously no way to pass
an override through at all.

Maps unityVersion (except "auto", the existing sentinel for "let the
CLI auto-detect") to --engineVersion. Removes the now-stale
core.warning() that told users the input was ignored.

Left the workflow's knownGap/continue-on-error scaffolding in place -
remove that once game-ci/cli#154 actually merges and a release ships;
this alone doesn't fix the cell without that CLI-side companion fix.
This commit is contained in:
Frostebite
2026-08-25 19:07:47 +01:00
committed by GitHub
parent fc8c870695
commit 45296f3cc6
3 changed files with 33 additions and 17 deletions
+18
View File
@@ -23,6 +23,24 @@ describe('buildCliArgs', () => {
).toStrictEqual(['build', 'game', '--targetPlatform=StandaloneLinux64']); ).toStrictEqual(['build', 'game', '--targetPlatform=StandaloneLinux64']);
}); });
it('omits --engineVersion when unityVersion is unset or "auto"', () => {
const noneSet = buildCliArgs(inputsOf({ targetPlatform: 'StandaloneLinux64' }));
const explicitAuto = buildCliArgs(
inputsOf({ targetPlatform: 'StandaloneLinux64', unityVersion: 'auto' }),
);
expect(noneSet.some((arg) => arg.startsWith('--engineVersion'))).toBe(false);
expect(explicitAuto.some((arg) => arg.startsWith('--engineVersion'))).toBe(false);
});
it('maps an explicit unityVersion to --engineVersion, overriding auto-detection', () => {
const args = buildCliArgs(
inputsOf({ targetPlatform: 'WebGL', unityVersion: '6000.0.36f1' }),
);
expect(args).toContain('--engineVersion=6000.0.36f1');
});
it('throws for a non-local providerStrategy, matching the base action without @game-ci/orchestrator', () => { it('throws for a non-local providerStrategy, matching the base action without @game-ci/orchestrator', () => {
expect(() => expect(() =>
buildCliArgs(inputsOf({ targetPlatform: 'StandaloneLinux64', providerStrategy: 'aws' })), buildCliArgs(inputsOf({ targetPlatform: 'StandaloneLinux64', providerStrategy: 'aws' })),
+15 -8
View File
@@ -2,18 +2,20 @@
* Translates unity-builder's action inputs into `game-ci build` (or, for * Translates unity-builder's action inputs into `game-ci build` (or, for
* providerStrategy=local-system, `game-ci orchestrate`) CLI flags. * providerStrategy=local-system, `game-ci orchestrate`) CLI flags.
* *
* Two deliberate omissions for the `build` path, both because there is * One deliberate omission for the `build` path, because there is nothing
* nothing to translate to: * to translate to:
* - `unityVersion` (except "auto"): the CLI always detects the Unity
* version from the checked-out project's ProjectSettings/ProjectVersion.txt
* and has no flag to override that today (game-ci/cli's engine-detection
* middleware unconditionally overwrites any passed value). Pinning a
* version other than "auto" is a known, real gap versus the original
* action - see the PR this shipped in.
* - `providerStrategy` values other than "local"/"local-system": the base * - `providerStrategy` values other than "local"/"local-system": the base
* action (without the separately-installed @game-ci/orchestrator plugin) * action (without the separately-installed @game-ci/orchestrator plugin)
* already throws for these today, so throwing here isn't a regression. * already throws for these today, so throwing here isn't a regression.
* *
* `unityVersion` (except "auto", which means "let the CLI auto-detect from
* ProjectSettings/ProjectVersion.txt", so it's never passed through as a
* literal flag value): mapped to `--engineVersion`, which game-ci/cli's
* engine-detection middleware now respects instead of unconditionally
* overwriting (game-ci/cli#154). Not carried into ORCHESTRATE_STRING_FLAGS -
* unverified whether `orchestrate`'s local-system path reads engineVersion
* the same way; scope this out until confirmed.
*
* Boolean inputs use GitHub Actions' own truthy/falsy string convention * Boolean inputs use GitHub Actions' own truthy/falsy string convention
* ('true'/'false', case-insensitive) - see actions/toolkit's getBooleanInput. * ('true'/'false', case-insensitive) - see actions/toolkit's getBooleanInput.
*/ */
@@ -236,6 +238,11 @@ export function buildCliArgs({ getInput }: BuildArgsOptions): string[] {
} }
args.push(`--targetPlatform=${targetPlatform}`); args.push(`--targetPlatform=${targetPlatform}`);
const unityVersion = getInput('unityVersion');
if (unityVersion && unityVersion !== 'auto') {
args.push(`--engineVersion=${unityVersion}`);
}
pushStringFlags(args, getInput, STRING_FLAGS); pushStringFlags(args, getInput, STRING_FLAGS);
pushBooleanFlags(args, getInput, BOOLEAN_FLAGS); pushBooleanFlags(args, getInput, BOOLEAN_FLAGS);
-9
View File
@@ -18,15 +18,6 @@ import { resolveProjectPath } from './resolve-project-path';
export async function run() { export async function run() {
try { try {
const unityVersion = core.getInput('unityVersion') || 'auto';
if (unityVersion !== 'auto') {
core.warning(
`unityVersion="${unityVersion}" is ignored: the underlying game-ci CLI always detects the Unity ` +
"version from the checked-out project's ProjectSettings/ProjectVersion.txt and has no flag to " +
'override it yet.',
);
}
const cliVersion = core.getInput('cliVersion') || 'latest'; const cliVersion = core.getInput('cliVersion') || 'latest';
const cliPath = await downloadCli(cliVersion); const cliPath = await downloadCli(cliVersion);