game-ci / unity-builder

Build Unity projects for different platforms
https://github.com/marketplace/actions/unity-builder
MIT License
839 stars 239 forks source link

importing a package before building #313

Open megetron opened 2 years ago

megetron commented 2 years ago

what i'm trying to achieve is the ability to import external package before building the unity project.

tried to do this (without sucess):

      - name: Import SDK
        uses: game-ci/unity-test-runner@v2
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
        with:
          githubToken: ${{ secrets.GITHUB_TOKEN }}
          customParameters: -quit -batchmode -importPackage mypackage.unitypackage

can one get the unity executable path to run some unity commands such as:

      - name: Import SDK
        run: /opt/unity/Editor/Unity -importPackage mypackage.unitypackage
webbertakken commented 2 years ago

Builds should generally be deterministic. The imported package should be defined in your dependencies (and if need be used conditionally). I'd consider importing a package during CI time bad practice.

That said, I do not know your exact use case. Perhaps it's somehow warranted?

megetron commented 2 years ago

yes agree. usually it is a bad practice.

with that being said, the use case is having a unity project that its main goal is to test a unitypackage (sdk) file.

so actually each version of a unitypackage will be imported to this project and some tests will be executed with this imported package.

so now, when you can import in CI/CD, then you can execute tests versus multiple packages in a matrix manner.

AndrewKahr commented 1 year ago

Have you tried a custom build method with this: https://docs.unity3d.com/ScriptReference/AssetDatabase.ImportPackage.html