Skip to content

Commit

Permalink
feat: scoped registries (#453)
Browse files Browse the repository at this point in the history
* feat: scoped registries

* feat: private scoped registries

* Update docs/03-github/03-test-runner.mdx

Co-authored-by: Gabriel Le Breton <[email protected]>

* yarn lint

---------

Co-authored-by: Gabriel Le Breton <[email protected]>
  • Loading branch information
nvandessel and GabLeRoux authored Mar 22, 2024
1 parent c3eff91 commit 57c4c9c
Showing 1 changed file with 52 additions and 4 deletions.
56 changes: 52 additions & 4 deletions docs/03-github/03-test-runner.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,38 @@ the [`packageMode`](#packagemode) configuration option to `true`.
packageMode: true
```

#### Using a scoped registry

When testing a Unity package that has dependencies inside a scoped registry, you can set the
[`scopedRegistryUrl`](#scopedRegistryUrl) and [`registryScopes`](#registryScopes) to ensure those
depedencies can be resolved.

```yaml
- uses: game-ci/unity-test-runner@v4
with:
scopedRegistryUrl: https://example.com/registry
registryScopes: 'com.example, com.example.tools.physics'
```

#### Authentication with a private scoped registry

If your package has dependencies that are hosted in a private UPM registry, then you will need to
supply a valid authentication token for your registry as an environment variable. Setup the
[`scopedRegistryUrl`](#scopedRegistryUrl) and [`registryScopes`](#registryScopes) as usual, but also
include a `UPM_REGISTRY_TOKEN` when defining your Unity License.

```yaml
- uses: game-ci/unity-test-runner@v4
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
UPM_REGISTRY_TOKEN: ${{ secrets.UPM_REGISTRY_TOKEN }}
with:
scopedRegistryUrl: https://example.com/registry
registryScopes: 'com.example'
```

#### Passing a unityVersion

Make sure that you explicitly pass the [`unityVersion`](#unityversion) argument, as it's necessary
Expand Down Expand Up @@ -139,9 +171,6 @@ potential workarounds.
- The test runner can only test packages on Linux runners - Windows runners are currently not
supported (this issue is being tracked
[here](https://github.com/game-ci/unity-test-runner/issues/224))
- Packages with dependencies outside of the Unity Registry have not been tested an may or may not
work with the test runner (this issue is being tracked
[here](https://github.com/game-ci/unity-test-runner/issues/225)).
- There is currently no caching set up for the testing of Unity packages (this issue is being
tracked [here](https://github.com/game-ci/unity-test-runner/issues/226)).
- If using the [`customImage`](#customImage) parameter to use a custom Docker image to test the
Expand Down Expand Up @@ -419,12 +448,31 @@ Whether the tests are being run for a Unity package instead of a Unity project.
If true, the action can only be run on Linux runners, and any custom docker image passed to this
action must have [`jq`](https://jqlang.github.io/jq/) installed.

NOTE: may not work properly for packages with dependencies outside of the Unity Registry.
NOTE: packages with dependencies outside of the Unity Registry need to utilize the
[`scopedRegistryUrl`](#scopedRegistryUrl) to resolve the dependencies correctly.

See [Testing Unity packages](#testing-unity-packages) for more information.

_**required:** `false`_ _**default:** `false`_

#### scopedRegistryUrl

The Url of the UPM registry to use for resolving package dependencies. Only applicable if
packageMode is true. When setting this value, you must also provide
[`registryScopes`](#registryScopes)

_**required:** `false`_ _**default:** `false`_

#### registryScopes

Defines the scopes of a registry and its associated packages, see
[the Unity Documentation](https://docs.unity3d.com/Manual/upm-scoped.html]) for further information
on scopes. Provide as a comma separated list, e.g. 'com.example, com.example.tools.physics'.

NOTE: Required if scopedRegistry is set, otherwise ignored.

_**required:** `false`_ _**default:** `false`_

#### dockerCpuLimit

Number of CPU cores to assign to the Docker container. Defaults to all available cores when no value
Expand Down

0 comments on commit 57c4c9c

Please sign in to comment.