Search Unity

Question CI for Package Manager Packages?

Discussion in 'Testing & Automation' started by nih_, Mar 24, 2020.

  1. nih_

    nih_

    Joined:
    Aug 7, 2017
    Posts:
    8
    I'm wondering if anyone has any good practices for setting up a Continous Integration Testing environment for a Unity Package structured and saved in Git?

    Given the default file structure of a package (Which does not have any unity project):

    github.com/MyAwesomePackage
    - Package.json
    - Editor
    - Runtime
    - Scripts Etc
    - Tests


    Does there exist any tool or guidelines for these points in a CI environment?:
    1. Run the correct unity version specified in the package manifest.
    2. Setup a temporary Unity project around the Package (and resolve package dependencies)
    3. Run unit and Runtime tests for the Package?


    The closest I have found is the Unity Downloader, but there is no public release of this tool. https://blogs.unity3d.com/2019/07/1...ditor-as-a-continuous-integration-dependency/
     
  2. marwi

    marwi

    Joined:
    Aug 13, 2014
    Posts:
    138
    I had the exact same issue recently and fell back to this repository which collects released editors and posts them on github: https://raw.githubusercontent.com/Larusso/unity-versions-service/master/versions.yml
    With that info you can use unity hub to install those editors by providing the correct changeset, create projects and run your tests.

    Im currently in the process of setting our CI environment up on gitlab (struggling a bit right now with the license management tho, it's a pain)
     
  3. goldbug

    goldbug

    Joined:
    Oct 12, 2011
    Posts:
    768
    You can take a look at my github actions workflow here:
    https://github.com/MirrorNG/MirrorNG/blob/master/.github/workflows/main.yml

    It builds the app, runs the editor and runtime tests, does static analysis with sonar qube, and if everything is ok, it releases it using semantic versioning as an UPM package.

    Here is an example run:
    https://github.com/MirrorNG/MirrorNG/runs/619908579?check_suite_focus=true

    Here are the static analysis reports and coverage:
    https://sonarcloud.io/dashboard?id=MirrorNG_MirrorNG

    The unity version is hardcoded at the moment since that is all I need, but it could be changed
     
  4. andywiecko

    andywiecko

    Joined:
    Nov 18, 2020
    Posts:
    3
    Apologies for the "necro post", but probably one can find it useful.

    Currently, there is the opened merge request, which resolves your issue regarding setting up the CI for the standalone Unity package on GitHub.
    I have already tested this on my package and the feature seems to work as expected :)
     
    nih_ likes this.