Summary
The new rake test task runs editor tests via Unity -executeMethod TeakTestRunner.RunAll. These tests are pure C# (no native SDKs needed) and complete in under 30 seconds once Unity opens. Currently they can only be run locally.
What's needed
The build job already runs on macOS (m4pro.medium with Xcode 14.3.1) but has no Unity installation. To run tests in CI we need:
- Unity installed on the macOS executor — via Unity Hub CLI or a pre-baked image
- Unity license credentials —
UNITY_SERIAL, UNITY_EMAIL, UNITY_PASSWORD in a CircleCI context
Reference implementation
teak-unity-cleanroom already does this. Key patterns in its Rakefile:
- Unity path discovery (line 40):
UNITY_HOME env var with fallback to Dir.glob('/Applications/Unity/Hub/Editor/*').last
- Unity helper method (lines 180–202): wraps invocations with
-batchmode -nographics -quit -logFile and conditionally injects -serial/-username/-password when CI=true
- License acquisition (line 286):
unity_license:acquire task runs -executeMethod BuildPlayer.CheckLicense to activate the license before any other Unity work
- License release (line 309):
unity_license:release task returns the license after the build
The CI config (.circleci/config.yml lines 44–46) chains it as:
bundle exec rake unity_license:acquire ... $RAKE_BUILD_TASKS
with UNITY_HOME=/Applications/Unity-$UNITY_VERSION/.
Suggested approach
Add a test step to the build job (or a separate test job) that:
- Installs Unity on the executor (or uses a pre-baked image with Unity)
- Acquires a license (following cleanroom's pattern)
- Runs
bundle exec rake test
- Releases the license
The test step should run before the package build since it validates C# compilation and logic with no native SDK dependency.
Repo: teak-unity
Summary
The new
rake testtask runs editor tests viaUnity -executeMethod TeakTestRunner.RunAll. These tests are pure C# (no native SDKs needed) and complete in under 30 seconds once Unity opens. Currently they can only be run locally.What's needed
The
buildjob already runs on macOS (m4pro.mediumwith Xcode 14.3.1) but has no Unity installation. To run tests in CI we need:UNITY_SERIAL,UNITY_EMAIL,UNITY_PASSWORDin a CircleCI contextReference implementation
teak-unity-cleanroomalready does this. Key patterns in itsRakefile:UNITY_HOMEenv var with fallback toDir.glob('/Applications/Unity/Hub/Editor/*').last-batchmode -nographics -quit -logFileand conditionally injects-serial/-username/-passwordwhenCI=trueunity_license:acquiretask runs-executeMethod BuildPlayer.CheckLicenseto activate the license before any other Unity workunity_license:releasetask returns the license after the buildThe CI config (
.circleci/config.ymllines 44–46) chains it as:with
UNITY_HOME=/Applications/Unity-$UNITY_VERSION/.Suggested approach
Add a
teststep to thebuildjob (or a separatetestjob) that:bundle exec rake testThe test step should run before the package build since it validates C# compilation and logic with no native SDK dependency.
Repo:
teak-unity