game-ci / game-ci/unity-test-runner

Feature: Allow `unityVersion` of `auto` for Package Testing

Open
#227 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
265
Forks
149
Avg merge
3h 3m
Merged PRs (30d)
2

Description

**Context**

For Unity **project** testing, an `auto` strategy is available, which will automatically pick up the Unity Editor version for the project being tested from that project's settings. However, for the first iteration of package testing, I didn't implement this feature.

It would be nice if the auto strategy were available for Package Testing as well.

**Suggested solution**

I think this can be accomplished by modifying the `UnityVersionParser.read(projectPath)` function. The modification could be to detect whether a package is being tested, and if so, parse the package's `package.json` for the Unity Editor version.

I believe the relevant fields in the `package.json` are `unity` and `unityRelease` - there are a couple of considerations to make with those fields:

- Since those fields are not technically required (see the docs link in additional details), the `auto` strategy should be equipped to handle their absence and fail gracefully
- The way they split up Unity version and Unity release into two fields may necessitate either modifying the `UnityVersionParser.parse(projectVersionTxt)` function, or creating a new function for parsing package versions altogether

**Considered alternatives**

n/a

**Additional details**

[List of Unity Package Manifest (`package.json`) fields as of version 2023.2](https://docs.unity3d.com/2023.2/Documentation/Manual/upm-manifestPkg.html)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.