Skip to content

Run Unity nuget test on GitHub-hosted runners#6396

Open
Grantim wants to merge 15 commits into
masterfrom
ci/unity-hosted-runners
Open

Run Unity nuget test on GitHub-hosted runners#6396
Grantim wants to merge 15 commits into
masterfrom
ci/unity-hosted-runners

Conversation

@Grantim

@Grantim Grantim commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Replaces the self-hosted EC2 Windows Unity runner with a GitHub-hosted matrix and moves the Unity test project into the repo (test_unity/NugetTestProj).

  • Matrix: windows-latest (blocking gate); ubuntu-latest / macos-latest / macos-15-intel non-blocking (continue-on-error) until proven -- together they cover the win-x64, linux-x64, osx-arm64 and osx-x64 natives shipped in the nuget package (linux-arm64 has no Unity editor to test with).
  • Test project is minimal (37 files, ~130 KB): no scene, no template leftovers. The playmode test builds a 30000-vertex sphere and decimates it through the package, so the native library must load and compute. Verified locally with Unity 6000.0.79f1 (the pinned editor version) against MeshLib from nuget.org.
  • The editor is installed per run by SHA-pinned buildalon/unity-setup (version from ProjectSettings/ProjectVersion.txt) -- the only third-party action, and it runs before any secret is in reach.
  • License: Personal, activated by driving the official Unity.Licensing.Client bundled with the editor (--activate-ulf --include-personal on start, --return-ulf on job end) with UNITY_USERNAME / UNITY_PASSWORD secrets; the manual .ulf web flow no longer offers personal activation. Credentials pass only through this first-party step. Checkout runs with persist-credentials: false.
  • A prime editor session runs before 'nugetforunity restore': on a fresh runner the NuGetForUnity asset postprocessor must be compiled into Library before the natives are imported, otherwise the plugins keep placeholder all-disabled import settings and P/Invoke fails with DllNotFoundException (reproduced locally; the EC2 runner was immune only because its Library persisted).
  • Tests run via the plain Unity CLI; the step fails on Unity's exit code, the editor log prints unconditionally, results.xml + logs upload as artifacts on failure.
  • AWS start/stop jobs and OIDC roles are removed. EC2 decommission is a follow-up after this proves out on a real release.

Test plan: this PR carries build-release-windows + upload-binaries (+ skip-image-rebuild), so unity-nuget-test runs the new workflow against the pr-test draft release produced by this run. The windows leg must pass; linux/macos legs are informative.

Generated with Claude Code

Replace the self-hosted EC2 Windows runner with a hosted 4-OS matrix
(buildalon actions): the Unity Personal license is activated per run from
repo secrets and auto-returned, removing the monthly manual Hub re-auth.
The test project moves into test_unity/NugetTestProj; windows-latest stays
the blocking gate while linux/macos legs cover the previously untested
package natives as non-blocking until proven.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Grantim Grantim added full-ci run all steps skip-image-rebuild force to skip docker image rebuild labels Jul 10, 2026
@Grantim Grantim marked this pull request as draft July 10, 2026 10:29
Grantim and others added 2 commits July 10, 2026 14:31
pr-test releases created by full-ci PR runs are drafts, which a
contents:read token cannot see -- gh release download failed with
"release not found" on all matrix legs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The job now fans out to a windows/linux/macos matrix, not only Windows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Grantim Grantim added build-release-windows upload-binaries Upload built installers and packages to the Releases page disable-build-emscripten and removed full-ci run all steps labels Jul 10, 2026
@Grantim Grantim closed this Jul 10, 2026
@Grantim Grantim reopened this Jul 10, 2026
Replace credential-based activation (buildalon/activate-unity-license)
and the unity-action wrapper with the official Unity CLI: the only CI
secret is now the regenerable .ulf license file, and no third-party
action sees any secret or the job token (checkout credential
persistence disabled). buildalon/unity-setup remains for the cross-OS
editor install only. Manual activations are not seat-counted, so the
matrix now runs all legs in parallel.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Grantim and others added 4 commits July 10, 2026 16:20
Latest 6.0 LTS at the time of migration; the editor version installed in
CI comes from this file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Unity removed personal-license activation from the manual (.ulf) web
flow, so activate with Unity.Licensing.Client (bundled with the editor)
using account credentials instead: --activate-ulf --include-personal on
job start, --return-ulf when the job ends. Credentials stay within this
first-party step.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
On a fresh runner the first editor session both compiles the
NuGetForUnity UPM package and imports the restored native plugins; that
import runs before the NuGetForUnity asset postprocessor exists, so the
plugins keep the restorer's placeholder settings (all platforms
disabled) and every P/Invoke fails with DllNotFoundException
(reproduced locally). Run a throwaway editor session first and restore
afterwards, so natives are imported with the postprocessor active. The
self-hosted machine never hit this because its Library persisted
between runs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace the template-derived project (URP and 2D leftovers, scene-driven
test) with a minimal one: 37 files / ~130KB instead of 60 / 4MB. The
playmode test now builds a 30000-vertex sphere and decimates it through
the nuget package, so the native library must load and compute;
previously the native call only constructed a settings object from a
scene script. Verified locally with Unity 6000.0.79f1 against MeshLib
3.1.3.297 from nuget.org.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Grantim Grantim closed this Jul 10, 2026
@Grantim Grantim reopened this Jul 10, 2026
Grantim and others added 4 commits July 10, 2026 19:45
Reusable workflows do not receive repository secrets unless the caller
passes them; without secrets: inherit the license activation saw empty
UNITY_USERNAME / UNITY_PASSWORD. The previous EC2 version never needed
inherited secrets (AWS OIDC + github.token only), which is why this was
not visible before.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two independent macOS-only issues from the first hosted run:
- macOS runners ship dotnet without a registered install location, so the
  NuGetForUnity.Cli tool host failed with '.NET location: Not found';
  actions/setup-dotnet registers the runtime.
- NuGetForUnity's default native runtime configuration leaves
  editorOperatingSystem empty for osx-arm64, so its natives are never
  enabled for the Apple Silicon editor; fill in the editor OS/CPU for
  both osx entries so each dylib set is enabled exactly for its editor
  architecture.

windows and ubuntu legs passed in run 29108517692.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The only conflict was unity-nuget-test.yml, where master bumped the
aws-actions pin that this branch removes entirely; resolved with the
branch version.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Job logs share the artifact retention period, so a parsed results.xml
summary in the console (plus an error annotation per failed test)
replaces the artifact upload; the full editor log was already printed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Grantim Grantim marked this pull request as ready for review July 13, 2026 08:48
Grantim and others added 3 commits July 13, 2026 13:35
The editor download is the only step with a live external dependency;
a hung CDN download should fail the step quickly and visibly rather
than consume the 60-minute job budget.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Track only what the editor cannot regenerate: ProjectSettings shrinks to
the version pin and the NuGetForUnity native runtime map (the prime
session recreates the rest with defaults, now gitignored), the UPM
manifest shrinks to its two real dependencies with the lock keeping the
NuGetForUnity commit pin. The test logs begin/end markers and the mesh
numbers it produces, which the results printer surfaces in CI output.
Workflow comments condensed. Validated with a local cold-boot cycle
(prime, restore, playmode test: passed).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Nothing in the project is referenced by GUID, so the metas Unity
regenerates on import are equivalent to the committed ones; validated
with a meta-free local cold-boot cycle.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-release-windows skip-image-rebuild force to skip docker image rebuild upload-binaries Upload built installers and packages to the Releases page

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants