A simple example on how to use Travis-CI to build, test, and deploy a Unity Package to a Github Release. The example Unity Package is a scene with a cube bouncing.
It works by using a Mac OS X version of Unity. This version does not require signing in to build a unity package (unlike the Windows and Linux versions). Travis-CI then builds the project as a Windows 64-bit player and runs test cases against the player. See https://docs.unity3d.com/Manual/testing-editortestsrunner.html for executing a test script in a Unity build. Then a Unity package is built and deployed to a GitHub release when all test cases successfully pass.
I recommend reading a more detailed explaination on how to do this through this blog post: https://hackernoon.com/writing-an-open-source-unity-package-877bad3c8913
Do configure the .travis.yml
file to your needs:
- TRAVIS_TAG - the GitHub release tag to deploy, if a release already exists with the same tag the release ZIP folder will be replaced
- UNITY_PROJECT_NAME - the name of the release, the ZIP folder will be named
$UNITY_PROJECT_NAME-v$TRAVIS_TAG
It is possible to upgrade the version of Unity used in Travis-CI. See install_unity.sh
. Not all Unity versions may be supported.