documentation
documentation copied to clipboard
Explain CI and Unity related topics like how to set up tests
Is your feature request related to a problem? Please describe.
It is a steep learning curve to get started with Unity and CI concepts by themselves, let alone the little details about the combination of both.
On top of that there seems to be no good (free) source of documentation except on youtube that can help find proper real world examples on how to integrate "continuous integration pipelines" with their unity project.
Describe the solution you'd like
In order to help as many people as possible to succeed in creating their first or nth CI pipeline, it will probably be very useful to create some documentation that is well written and stays to the point (no more no less) about how to set up certain concepts.
Concepts could be:
- Project settings to keep in mind when building in CI
- How to set up assembly files for your project (including the test ones)
- How to test your project
- A good example of an editor test
- A good example of a playmode test
(these example tests should be easy to understand and relatable as real world example)
My suggestion would be to create a section called Unity, and put any subjects in there.
Describe alternatives you've considered
- The first place I looked was the Unity forums, but I was unable to find high quality answers. Also many links seem to be broken.
- I have tried to find good resources online, but found that the proper tutorials and examples are from unity themselves and behind a paywall. Even then they are video tutorials, where you can't quickly grab the yeast of it and get started with implementation.
- I tried looking for other open sources, but found that open source in game development (and especially for unity) is still in it's very early stages at this point.
I've done some work on adding tests into my own projects and am working on setting up a template repo based on these topics. I've done a lot of work on my OpenKCC project to include test examples on how to create and run tests in the CI/CD workflow.
Example link to the OpenKCC tests - https://github.com/nicholas-maltbie/OpenKCC/tree/main/Packages/com.nickmaltbie.openkcc/Tests. It has some examples of edit mode and playmode tests and how they can be integrated into validating more complex features of a project. I found YouTube videos to be a bit difficult to follow but can add these examples as a starting point for anyone that wants to learn more about setting up CI and tests for example unity projects in GitHub with the Game-CI workflows. Some of the tests use other standard unity features like mocking inputs and creating test environments/scenes from code. I even included the Moq library and used an interface based structure to make mocking editmode tests easy and effective.
I'm also making a TempalteUnityPackage project that sets are a template base for creating and sharing unity code packages. I setup the default github workflows to include some testing and code coverage measurements for playmode and editmode testing. I'm still working on the documentation but if you think these examples are a good fit for this kind of example @webbertakken I'd be happy to setup a PR and add them to the game-ci documentation as references :)
Hey @nicholas-maltbie, thanks for the suggestion.
Quite a few people have set up template repos for tests. It's generally a great idea but the problem when not under the GameCI org is that the community can't simply add their own test cases to improve the stability for the whole community, nor can we guarantee it's continuity.
We have discussed setting up a single repository for this purpose inside GameCI, but decided against it in favour of the already existing unity-actions
repository, as well as in-action projects in unity-builder
and unity-test-runner
.
The downside of unity-actions
is that making changes inside it could affect pipelines of the actions (hence the in-action projects). The downside of having these in-action projects is that we have multiple and not a single source of truth.
This problem will also be solved when we're moving towards a single repository for a CLI which will hold all the logic behind unity-builder
, unity-test-runner
and eventually even other CI implementations like those of GitLab and CircleCI. In the meantime, unity-builder is the source of truth for most logic and test projects.
This development of the CLI can be followed in the roadmap: https://github.com/orgs/game-ci/projects/4/views/1
Regardless of test projects, we are very open to have a page in our documentation that explains how to set up the project and different kinds of tests for Unity.
Hope this gives a clear overview of where we're going. Let me know if this is a satisfactory answer for you :)
Hey, thanks for the reply. This helps answer the question! I'll work on just adding a summary of tests and how to use them with game ci in the docs and not worry about the template project and reference the unity builder project for now.