Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question CI/CD Pipeline Options

Discussion in 'Testing & Automation' started by unity_76FF83E736BC130FE51B, Jun 20, 2023.

?

Do you use CI/CD pipelines?

  1. Yes

    6 vote(s)
    75.0%
  2. No

    2 vote(s)
    25.0%
  1. unity_76FF83E736BC130FE51B

    unity_76FF83E736BC130FE51B

    Joined:
    Jun 19, 2023
    Posts:
    2
    Hey fellow Unit developers. I would like to automate some of my team's builds and I am wondering what are some good options to use. Specifically:

    - What provider are you using? (GitHub, GitLab, etc)
    - Do you do any testing?
    - Do you run any static analysis?
    - How do you build the codebase?
     
  2. rdjadu

    rdjadu

    Joined:
    May 9, 2022
    Posts:
    118
    • We're using GitHub Actions with our own self-hosted runner (ATM only one). We need Mac and GitHub Mac runners are super expensive and pretty slow. We did use them for a while but installing Unity on the agents alone ate up 10 minutes of running time. We don't want to run stuff on Linux as we want CI to build and run our project the same way we do locally. We're pretty happy with GitHub Actions. Great system and well integrated into GitHub overall.
    • We have automated tests that use the Unity test framework (still <2). There's the odd test that uses NSubstitute but the vast majority of our tests are integration tests that don't isolate. A fair share of them goes directly to our backend services (to the dev and not the production instances).
    • No static analysis. Not even coverage. For us, not very useful.
    • Plain Unity command line automation. We do have a small C# build script in the Unity project.
    The only somewhat unusual thing I guess is that we have our own automation frontend written in C#. IMO it makes no sense to have your automation tools written in some language that about 0.5 programmers on your team actually understand well. So, all our automation is just a .NET Core 6 project. Could be that if I had known about NUKE back then, that's what we would have used.

    We did look at GameCI back then but doing Linux was not an option for us (the project didn't even work on Linux and we have exactly no programmers on the team actually doing Linux; Windows was supposed to be working but didn't work in our testing either). In the end, we figured we need extremely little to run automation on a Unity project so did it custom. The trickiest part was having our automation install Unity. And none of that we use anymore after moving to our self-hosted runner.

    Nice thing about having it as just a custom .NET Core 6 project is that it's trivial to modify this and to run it locally. For example, we have a check that makes sure that our commit messages adhere to our convention. And anyone on the team can understand and modify this stuff because it's just a little bit of C# code invoked directly from one plain and simple GitHub Actions .yml file.

    Our runs aren't the fastest in the world but we stand at 30 mins ATM including test runs and both full iOS and Android builds (IPAs and APKs).

    We are missing automated publishing (e.g. to TestFlight) ATM. We do want to add that. It's really just a matter of pushing our builds somewhere at the end. Right now, we just upload them to GitHub as build artifacts.

    Also, we don't run tests on device. Editor only ATM.
     
    Last edited: Jun 20, 2023
  3. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    7,024
    I use:
    • TDD 100% coverage
    • GameCI with GitHub actions that runs tests in edit & play mode for both minimum supported and most up-to-date Unity versions. Also creates builds for all supported platforms.
    • Static analysis with NDepend. Steep learning curve initially but well worth it.