jetbrains / teamcity-unity-plugin Goto Github PK
View Code? Open in Web Editor NEWTeamCity plugin supports building Unity projects
License: Apache License 2.0
TeamCity plugin supports building Unity projects
License: Apache License 2.0
Hey there,
I was under the impression that when the Buildrunner runs I can even only provide the minor Unity version, e.g.:
2018.2
2019.4
2020.3
So I don't have to specify the exact Unity version. I thought the runner will just pickup a random installed version of Unity, for example, I set 2018.2 as the Unity version it'll look at the installed 2018.2 versions like
2018.2.1f1
2018.2.4f1
and so on and pick randomly one and build the project with that.
But apparently that's not the case?
I just tried that with my Unity 2020.3.0f1 installation.
In my buildstep I set "2020.3" as the Unity version and build the project, but immediately an error was thrown:
[17:24:10] jetbrains.buildServer.agent.ToolCannotBeFoundException: Unable to locate tool unity 2020.3 in system. Please make sure to specify UNITY_PATH environment variable
I looked at my path variables and it sure exists: "unity.path.2020.3.0"
I also tried different string variations:
All of them threw the same error. Of course when I set the version specifically to 2020.3.0 it worked like a charm.
I hoped I could just threw in the minor version there without the need to specify the patch version, since that's extra work for me to go through every buildconfig every time we update the Unity version to a new patch version.
Is that a bug? Did I forget something?
I defined a configuration parameter in one of my build configurations and would like to access its value from within the Unity process while building. However, the custom parameter is not defined when querying from within Unity's C# process during the build step. I can see other standard variables defined by TeamCity like BUILD_NUMBER, but not my custom ones.
Is this not supported? Any way for me to pass such data from TeamCity to Unity easily?
Thank you!
[2020-07-26 13:43:31,498] INFO - [S]erver.unity.LinuxUnityDetector - Invalid Unity version 2020.1.0f1 in directory /opt/Unity/Hub/Editor/2020.1.0f1: com.vdurmont.semver4j.SemverException: Invalid version (no patch version): 2020.1.0f1 (enable debug to see stacktrace)
Trying to define multiple test category excludes causes the entire configuration to fail, for example if defining
!MyTestCategoryOne
!MyTestCategoryTwo
From the build log it looks as though when using multiple test categories, the -editorTestsCategories
is missing and the config will attempt to run all tests instead.
I am trying to configure Unity with TeamCity for the first time and I am trying to understand how to properly allow TeamCity to detect let's say a Unity install folder that is under D:\Unity\Editor, or any other path which is not C:
I have added the environment variable UNITY_HINT_PATH under system, and this worked for an agent which has Unity installed in C:
I am not sure if this is possible
Currently build log is displayed as is, but we could highlight warnings in it.
Currently this plugin uses log files to get build output and test reports file to import test results.
We could try using Unity plugins extensibility to get the same kind of data in a more reliable way:
https://docs.unity3d.com/Manual/RunningEditorCodeOnLaunch.html
Also it allows to provide Unity test reporting in a real time.
Hi,
I have noticed that in the build logs for Unity builds, the "Command line arguments" and "Initialize mono" sections of the log automatically get put into service message blocks (see images below). I know that we can create our own blocks by using blockOpened
and blockClosed
service messages, however I don't understand how these Unity logs are in their own blocks - is there some kind of log post processing which can put messages into groups?
Cheers,
Andy
Some users have local Unity installations in custom locations, so we could add ability to customize it.
Also it'll help with Unity run in docker containers (see #6).
-quit is added automatically as a parameter but that is an issue when executed method wait for editor update to finish execution.
We need an option to remove "-quit" and let the method call EditorApplication.Exit(0) manually.
The following references could be used to provide required parameters in UI:
Unity installation from command line:
https://github.com/DragonBox/u3d
Examples:
The current Linux discovery tries to look at $UNITY_ROOT/Editor/Data/PackageManager/Unity/PackageManager
to find the version, but this path doesn't exist, and discovery fails. AFAICT, there is no reliable way to get the current Unity version, other than parsing the name of the containing folder.
We are using the Teamcity Unity Runner with the custom log file option.
The log file is written fine, but the output in teamcity just stops after the package imports and stays there until the build is finished.
As you can see, the log file gos on (I'm building right now, the log file has a length of 20k lines).
But the log view in teamcity is unchanged.
Any recommendations?
We could provide support of building Unity projects in docker containers.
When configuring the plugin I left the project path blank as when I clicked the tree to the right it showed my folder structure and was clearly in the root directory of my project. However, when running with nothing in that field, the project path parameter wasn't added, which apparently is problematic for Unity in identifying the executeMethod class provided. I was able to fix this by setting my path to "./" which then added the path parameter.
BEFORE ADDING A PATH
[19:01:34][Step 1/1] Starting: /opt/Unity/Editor/Unity -batchmode -buildTarget WebGL -nographics -executeMethod AutomatedBuild.Build -logFile -quit
[19:01:34][Step 1/1] in directory: /opt/buildagent/work/2568497a44852bef
... truncated ...
[19:01:42][Step 1/1] Aborting batchmode due to failure:
[19:01:42][Step 1/1] executeMethod class 'AutomatedBuild' could not be found.
[19:01:42][Step 1/1] Argument was -executeMethod AutomatedBuild.Build
AFTER ADDING A PATH
[19:03:19][Step 1/1] Starting: /opt/Unity/Editor/Unity -batchmode -projectPath /opt/buildagent/work/2568497a44852bef/. -buildTarget WebGL -nographics -executeMethod AutomatedBuild.Build -logFile -quit
... build succeeded
Unity is releasing a new version about every week, and during the development phase of a game the version used can be changed frequently. Currently this means we have to install new versions manually on each of our agents, plus reboot the agent to make it aware of the new Unity version.
One suggestion is to use the Unity Hub CLI to install versions (or modules) on the fly from this runner, if the wanted version (or module) is not present upon launch. This should probably be optional, to avoid installing versions unintentionally.
It could provide following features:
When using a parameter or environment variable for the field Unity Version
, the agent evaluates it as a literal string instead of a Teamcity variable.
Setting all the unity steps in a single parameter would reduce the overhead of manually configuring them individually.
Set a configuration parameter
or a environment variable
with the unity version:
Use the parameter in the Unity Version
field:
Look at the Compatible agents (I set one step to use %env.UNITY_VERSION%
and the other to use %UNITY_VERSION%
:
Requirement should say:
Exists=>unity\.path\.2019\.4\.7* exists
Unity Editor could generate test reports in NUnit formatting which is supported by TeamCity XML report processor. For that we should provide the following command line arguments:
unity -runEditorTests -editorTestsResultFile path/to/results.xml
Also we could support filtering tests by suite or name:
-editorTestsCategories | Filter editor tests by categories. Separate test categories with a comma.
-editorTestsFilter | Filter editor tests by names. Separate test names with a comma.
https://docs.unity3d.com/Manual/PlaymodeTestFramework.html
https://docs.unity3d.com/530/Documentation/Manual/testing-editortestsrunner.html
I am using a self-hosted TeamCity agent, running the Unity plugin.
I have WebGL as the build target, but I cannot for the life of me figure out how to configure the build output to go into a \builds path off the project root.
I can't browse in the TeamCity dialog 'Select files to be published as artifacts', for the artifacts to include, as I don't see the build artifacts listed anywhere in the dialog, just regular folders from my project.
I've done a complete file search on all the TeamCity directories on my PC, looking for the build output, but don't see anything.
I feel like I'm missing some configuration step somewhere, stating where the output of the WebGL build should go to, but I've tried setting the 'artifact paths' setting to */ => build
But I get an error that there were too many artifacts.
I then tried setting the 'artifact paths' setting to just getting my .html file to be exported
build/*.html
But I still don't have any artifacts once my build has been completed.
Thanks
I wonder if with the following code..
You could run into issues with multiple unity steps in one build configuration.
I.e.
Step 1. Import
Step 2. Build
Step 3. Test
Maybe it's possible to have the step number here, such as...
"-${build.buildId}.${build.stepId}"
I'm not sure if this would be possible but it seems like it might be a small change for additional features.
I tend to run multiple unity steps in one configuration and then artifact each of their logs seperately.
Edit : Sorry, I was supposed to make this a question / suggestion
We could install required Unity version on demand if Unity Hub is available on machine:
https://forum.unity.com/threads/suggestion-the-command-line-and-unity-hub.522186/
Hi,
How I can tell the build runner that I want to build a windows player with development enabled (error loging..) and deep profiling support ?
I've tried activating those options from the command executed inside the unity editor by the build runner but without any luck.
Thank you for your help
Possible solution to do that https://newhorizongame.wordpress.com/2016/04/19/automated-tests-in-unity-c/
I've done following steps:
1.start TeamCity build agent under the same user account which is used for Unity Hub installation
2.add Unity installation located in custom path you could use UNITY_HOME environment variable
But still not ok.
I don't know what i should try next,or maybe just give it up and use Jenkins.
Really need help. Give me a clue please.
I need some help properly configuring my build agent machines. I feel like I've done everything in the README but I'm still getting this error message:
Unable to locate tool unity 2018.2.10 in system. Please make sure to specify UNITY_PATH environment variable.
My understanding from the README is the plugin should detect all of my Unity versions as they're under /Applications/Unity* but I'm not sure what's going wrong.
Any help would be greatly appreciated!
Unity could be installed into custom path, so our detector should honor custom paths.
Hi, I am using the latest snapshot (2020 January), and builds on Mac are not showing logs.
No log file is being passed as an argument when calling Unity
Starting: /Applications/Unity/Hub/Editor/2019.4.9f1/Unity.app/Contents/MacOS/Unity -batchmode -projectPath ./ -buildTarget Android -executeMethod Method.DeployBuild -quit -logFile
Here is the same build running on a windows machine:
Starting: "C:\Program Files\Unity\Hub\Editor\2019.4.9f1\Editor\Unity.exe" -batchmode -projectPath ./ -buildTarget Android -quit -batchmode -executeMethod Method.DeployBuild -quit -logFile C:\BuildAgent\temp\buildTmp\unityBuildLog-8436327390070719416.txt
I tried to build the plugin with the latest changes but the build directory after building with IntelliJ Idea is missing files and doesn't have the plugin file structure, there are probably more steps to take after the build is done.
If anyone could provide a built plugin with the latest changes to check if the problem persists, that would be amazing.
Cheers.
Edit:
Builds are following through without issue, it is just making it very hard to diagnose errors.
Being able to force the path in the build configuration, or via an environment variable which can be adjusted on a per-config basis would be useful.
We store all our Unity installs in C:\Unity* - it'd be nice if we could get the option to change the search directory from Program Files, et al - to there.
Originally posted by @AdamFrisby in #6 (comment)
To run playmode tests you need to replace "-runEditorTests" with "-runTests" according to unity reference https://docs.unity3d.com/Manual/PlaymodeTestFramework.html . Please also note that "-editorTestsResultFile" is ignored for playmode tests
If you install Unity as a TeamCity tool using the instructions provided by JetBrains and linked in the Readme, the build that references that new version will be blocked indefinitely as the tool is not triggered to install by the build and the unity.path.<version>
Configuration Parameter causes the build to not find compatible agents as the Tool not only needs to be installed, but also needs to trigger the Unity Runner Plugin to re-search for Unity installations to populate this field.
So I see 2 related but distinct issues here:
My repro case:
Expected: Build runs, triggering tool install on agent that does not yet have that tool
Actual: Build is blocked indefinitely as unity.path.2018.4.6
is not defined and the build will not run to install the tool.
From what I have seen in the history the project has 9 commits this year (and two of them were just copyright and vendor stuff), the latest commit has been on March, and before that, the closest commit was in April 2019 (8 months of inactivity in between), 4 open PRs that aren't active, and 21 (now 22) issues still waiting for a resolution.
Also, the latest release in the Plugin site (with the download link) points to SNAPSHOT-20200127164629
released in Jan 28, 2020, which means that all the latest fixes aren't available (unless, of course, that you build the whole plugin by yourself), it was only released again because of the copyright stuff. Following this pattern, we can expect that the next update will only be available in 2021 when @orybak upgrades the copyright year.
I've been struggling with problems and been trying to find solutions, report problems or even fix them, but after seeing the current status, it demotivates me and my team from staying with Teamcity. It feels like this plugin was made because it had to be made and after that it was just let alone.
Can we expect the contributors to participate more in the repository and help the developers?
The cleanedLogFile flag is not officially documented, but it allows unity to dump out a log without callstacks, which makes reading the log in TeamCity's build window much easier.
Our log files are about 6 - 30 mb depending on the build so they don't display well in TeamCity's build log window if we have a full log.
I always get an error for the project path (Couldn't set project path to: ./
)
I tried this with a minimal setup; a new unity project, with the project root folder also being the git root folder and thus leaving "Working Directory" and "Project path" empty. Searching for a solution, I found this post on Unity answers:
https://answers.unity.com/questions/622429/i-have-a-problem-the-log-is-couldnt-set-project-pa.html
One of the answers mentions "You need to format the option -projectPath=/Users/you/pathtoproject with an equals sign between -projectPath and the path rather than a space as indicated in the documentation."
Why has nobody else complained about this yet? Because it seems as if - instead of fixing the documentation - the fixed this in the software in Unity 2018. It failed for me in 5.x and 2017.1.0f3, but it worked fine in 2018.2.6f1.
The <Default>
option in Test Platform runs only the EditMode tests.
It would be nice to have an option that runs both, Edit and Play mode tests, instead of needing one Build Step for each kind of tests.
Could this be achievable?
Our Teamcity build agent doen't use the correct version of Unity. We need to build our project with Unity2018.2.13f1, but our build agent always use Unity2018.2.16f1 because this version is used for another game, which is built on the same agent...
Could you please add ability to specify minor version or full path of Unity Editor ?
Thanks
There is currently a bug (at least I think it's a bug) in unity that has been prevailant for a number of years.
In certain circumstances (Editor Code modification, some runtime code modification), it's possible for the initial opening of Unity command line mode to fail during compilation, or to call old code. This can happen because the method you tell unity to execute is not executed at the correct time (after a full assembly reload).
We 'fixed' this previously by having support in the unity runner to ignore the exit code on run. We had to make a slight change to our steps to acomodate for this such as....
Whilst this isn't a bug in your teamcity-unity-plugin this issue is here mostly as a way to open discussion with you so that we can figure out the best way to solve this in the correct way.
Hello there,
Is there an option to build without -batchmode in command line arguments ? i cant seem to find an option, and it would solve an issue that we are facing
Thanks a lot
Unity 2020.1.0b4 (Also tried 2019.3.08f)
Latest Teamcity
Running Windows Version 10.0.18363
The build without tests succeeds, however when I run with tests I get an error. I've tried to figure out what it is but I am at a loss. Oh and the tests are all passing.
The repository I am testing is here:
https://github.com/Sibz/Com.Sibz.NetCode
I basically have a default TeamCity install and only set this unity build settings:
Build Target: standalone
Player: Win64
Output Path: Builds
Full Log: Added in comment below
Tail of log (I snipped the times except for 1 line so it can be matched to full log):
AcceleratorClientConnectionCallback - disconnected - :0
Cleanup mono
Checking for leaked weakptr:
Found no leaked weakptrs.
[22:48:17] [Package Manager] Server::Kill -- Server was shutdown
Process exited with code 255
Process exited with code 255 (Step: Unity)
Importing data from 'C:\TeamCity\buildAgent\temp\buildTmp\unityTestResults-1851156133729896712.xml' (31.05 KB) with 'nunit' processor
NUnit report watcher
Waiting for 1 service processes to complete
NUnit report watcher
1 report found for paths:
C:\TeamCity\buildAgent\temp\buildTmp\unityTestResults-1851156133729896712.xml
Successfully parsed
1 report
C:\TeamCity\buildAgent\temp\buildTmp\unityTestResults-1851156133729896712.xml
Step Unity failed
Publishing internal artifacts
Build finished
It works well with the SNAPSHOT-20190108114412 version.
However, the build will be canceled in future versions of mac os.
Checking the log shows the following differences.
SNAPSHOT-20190108114412 Version
Starting: /Applications/Unity/Hub/Editor/2017.4.8f1/Unity.app/Contents/MacOS/Unity -batchmode ................. -cleanedLogFile / Users / .. ...... 1063202947757192734-166424.txt
Future version
Starting: /Applications/Unity/Hub/Editor/2017.4.8f1/Unity.app/Contents/MacOS/Unity -batchmode ................. -cleanedLogFile
The unity version is 2017.4.8, and if the command does not have the parameter value of -cleanedLogFile, the build will be canceled.
Using Team City Cloud and a local agent, when a build fails the password is in plain text.
The usernamepassword is set via command line arguments:
-username [email protected] -password MyPassword -serial MySerial
Interestingly, the first half of the email is *'d out.
In Unity Editor 2019.1+ it's possible to get build log in stdout with -nographics
option:
https://issuetracker.unity3d.com/issues/command-line-logfile-with-no-parameters-outputs-to-screen-on-os-x-but-not-on-windows
Something that we'd really find useful is a plugin similar to this, maybe teamcity-unity-player-plugin that would allow for the execution of a unity built player. It would need a very small feature set to be useful.
At the moment, we simply use the command line and artifact the log, but it could be nice to have teamcity functionality for this.
Hi!
I think we're experiencing #21 (Couldn't set project path...) on SNAPSHOT-20190307144314
while using Unity 2018.1.9 - more specifically, 2018.1.9f2-MLTP10 (Win / Mac). We're building to the Magic Leap/Lumin, so migrating isn't really an option.
FWIW this same configuration/plugin is working great for 2018.3.x... but... what do we need to do (if anything) to have this fix altered to include our version of Unity? At a glance, the commit that fixes that issue doesn't include our version.
I've attached the output log, but I'm guessing the relevant bit is shown/snipped below:
[19:24:52] : Build preparation done
[19:24:52]E: Step 1/1: macOS (Unity)
[19:24:52] : [Step 1/1] Starting: /Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -projectPath "./" -buildTarget OSXUniversal -buildOSXUniversalPlayer /Tools/TeamCity/buildAgent/work/b4a0b4102554b93f/Weave -quit -logFile
[19:24:52] : [Step 1/1] in directory: /Tools/TeamCity/buildAgent/work/b4a0b4102554b93f
[19:24:53] : [Step 1/1] Initiating legacy licensing moduleDisplayProgressbar: Unity license
[19:24:53] : [Step 1/1]
[19:24:53] : [Step 1/1] LICENSE SYSTEM [2019318 19:24:53] Next license update check is after 2019-03-19T23:06:19
[19:24:53] : [Step 1/1]
[19:24:53] : [Step 1/1] [Package Manager] Server::Start -- Port 55866 was selected
[19:24:53] : [Step 1/1] Launching external process: /Applications/Unity/Unity.app/Contents/Resources/PackageManager/Server/UnityPackageManager
[19:24:53] : [Step 1/1]
[19:24:53] : [Step 1/1] Command line arguments
[19:24:53] : [Command line arguments] /Applications/Unity/Unity.app/Contents/MacOS/Unity
[19:24:53] : [Command line arguments] -batchmode
[19:24:53] : [Command line arguments] -projectPath
[19:24:53] : [Command line arguments] "./"
[19:24:53] : [Command line arguments] -buildTarget
[19:24:53] : [Command line arguments] OSXUniversal
[19:24:53] : [Command line arguments] -buildOSXUniversalPlayer
[19:24:53] : [Command line arguments] /Tools/TeamCity/buildAgent/work/b4a0b4102554b93f/Weave
[19:24:53] : [Command line arguments] -quit
[19:24:53] : [Command line arguments] -logFile
[19:24:53]E: [Step 1/1] Couldn't set project path to:
[19:24:53]i: [Step 1/1] ##teamcity[buildProblem description='Couldn|'t set project path to: ']
[19:24:53] : [Step 1/1]
[19:24:53] : [Step 1/1] (Filename: /Users/builduser/buildslave/unity/build/Runtime/Utilities/Argv.cpp Line: 348)
[19:24:53] : [Step 1/1]
[19:24:53] : [Step 1/1]
[19:24:53] : [Step 1/1] Aborting batchmode due to failure:
[19:24:53]i: [Step 1/1] ##teamcity[buildProblem description='Couldn|'t set project path to: ']
[19:24:53] : [Step 1/1]
[19:24:53] : [Step 1/1] [Package Manager] Server::Kill -- Server was shutdown
[19:24:53]W: [Step 1/1] Process exited with code 1
[19:24:53]E: [Step 1/1] Process exited with code 1 (Step: macOS (Unity))
[19:24:53]E: [Step 1/1] Step macOS (Unity) failed
Thanks!
Hey there,
I spent the whole day trying to setup Teamcity with Unity with the Unity Plugin for teamcity in order to create a build pipeline - and for the love of god I couldn't set it up. Whatever parameters I'm trying to set, my build agent (my very own machine) is always incompatible. I don't even get to the build part, since the agent is incompatible with this reason:
Unmet requirements:
Exists=>unity.path.2018.3.6f1.* exists
Now apparently the main problem is that the path of the specific Unity installation cant be found.
I use Unity Hub and Unity Hub and all the Unity versions are installed on a different harddrive (on drive D:), and Unity Hub installs all my Unity Versions to this folder:
D:\Programme\Unity
So for example Unity 2018.3.6f1 is installed in:
D:\Programme\Unity\2018.3.6f1
Now when I created the Build Step and chose Unity as the Runner Type, I opened the advanced settings, set all the necessary things and set the Unity version like this: 2018.3.6f1
Saving that Build Step and hitting "Run" leads to the unmet requirement.
First thing: Is there any chance to debug? Or at least to get any logs? Because you know "Exists=>unity.path.2018.3.6f1.* exists" doesn't say anything about the problem, it seems it doesn't find the path, but why not, what exactly is wrong, how does the processed path actually look like?
Now looking at the Configuration of the readme.md we also tried to create an Environment Variable in the Parameters of the Build Configuration called UNITY_HINT_PATH to hint at the Unity Hub but that didn't work and we also tried the same with UNITY_HOME like this:
Name: env.UNITY_HOME Value: D:/Programme/Unity/2018.3.6f1
I tried it to with other Unity versions and their respective paths, but it nerver worked.
What's the exact issue? What did I do wrong?
Hello!
I'd want to use a teamcity Configuration Parameter to configure the Unity Version, so my team can easily swap the version used when running a build (notably using the "custom run" button).
Unfortunately, this doesn't seem to work, as my agent is shown as incompatible:
It doesn't seem that the configuration parameter is interpreted before the unity version is tested for the agents
Hi there!
I'm running into an issue where the license couldn't activated in the Build Feature and therefor the build fails.
In the buildlog I see a double declaration to /Editor/Unity.exe (windows agent):
Starting: "C:\Unity\Unity 2019.2.12\Editor\Unity.exe\Editor\Unity.exe" -quit -batchmode -nographics -serial ******* -username ****** -password ******* -logFile C:\buildAgent\temp\buildTmp\unityBuildLog-8479047412352649534-114640.txt
14:26:17
Process exited with code -1. Unity log:
On the actualy build command itself we're seeing different (correct) behaviour:
Starting: "C:\Unity\Unity 2019.2.12\Editor\Unity.exe" -batchmode -projectPath ./ -quit -logFile C:\buildAgent\temp\buildTmp\unityBuildLog-998815648385366156.txt
Could it be something in the plugin or did I misconfigure something.
We're running the latest snapshot from 2020 (SNAPSHOT-20200127164629)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.