I am using Gitlab CI to automate my unity builds. For this I use two machines. (one Mac and one windows machine. Important: build should only run on the first machine that is available. )
unity-build:
script: "/Applications/Unity/Hub/Editor/2019.3.14f1/Unity.app/Contents/MacOS/Unity \
-projectPath pathXY \
-executeMethod BuildScript.PerformBuild
-quit"
stage: build
tags:
- unity-mac-runner, unity windows runner
The problematic line is this: script: "/Applications/Unity/Hub/Editor/2019.3.14f1/Unity.app/Contents/MacOS/Unity, because on my windows runner path to unity is "S:\Unity\2019.3.14f1\Editor\Unity.exe" \
Tried to fix this with these changes:
windows job:
stage: setpaths
variables:
UNITY_PATH: "S:/Unity/2019.3.14f1/Editor/Unity.exe"
script: "set windows variables..."
tags:
- unity windows runner
#osx job:
# stage: setpaths
# variables:
# UNITY_PATH: "S:/Unity/2019.3.14f1/Editor/Unity.exe"
# script: "set mac variables..."
# tags:
# - unity-mac-runner
Questions
- How can I do this? What should I use?
- I tried to set path of unity installation depending on build runner, but I couldn't get this to work.
An example would be nice. Thx a lot ;)
Addition to the config.toml solution: I have this problem on Windows (Mac is running without problems.
In C:\WINDOWS\TEMP\build_script782418789\script.ps1:185 Zeichen:15
+ ${UNITY_PATH} -batchmode -projectPath ${BUILD_PROJECT_PATH} -runTests ...
+ ~~~~~~~~~~
Unerwartetes Token "-batchmode" in Ausdruck oder Anweisung.
In C:\WINDOWS\TEMP\build_script782418789\script.ps1:185 Zeichen:26
+ ${UNITY_PATH} -batchmode -projectPath ${BUILD_PROJECT_PATH} -runTests ...
+ ~~~~~~~~~~~~
Unerwartetes Token "-projectPath" in Ausdruck oder Anweisung.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : UnexpectedToken
ERROR: Job failed: exit status 1
Unexpected token ... in expression or statement.
This is my config.toml on windows:
executor = "shell"
shell = "powershell"
environment = [
"UNITY_PATH=S:/Unity/2019.4.1f1/Editor/Unity.exe",
"BUILD_PROJECT_PATH=S:/Gitlab-runner/builds/QZ5_yEjt/0/FussballManager/Game",
"UNITY_BUILD_PATH=S:/Gitlab-runner/builds/QZ5_yEjt/0/FussballManager/Game/WindowsBuild/"
]