Unity Actions
The fastest and easiest way to automatically test and build any Unity project!
Supported versions
It's generally considered good practice to use the same Unity version for Unity Actions as you do to develop your project.
Unity Actions are based on the unity3d images from GabLeRoux. Any version in this list can be used to test and build projects.
Setup
Mental model
There are two parts to setting up Unity Actions;
- Configuring a license
- Setting up a workflow
First time using GitHub Actions?
Read the official documentation on how to setup a workflow.
Any subsequent steps assume you have read the above.
Setting up license
All actions utilize an installment of Unity, and as such need to be activated.
To set up your license for use in Unity Actions, create a file called
.github/workflows/activate.yml in your repository and follow the steps for
either personal or professoinal license below.
Personal license
- Request your activation file for usage on GitHub using Request Manual Activation File.
- Request your license on license.unity3d.com.
- Open
Github><Your repository>>Settings>Secretsand set the contents of the resulting license file toUNITY_LICENSEas a secret.
Professional license
- Open
Github><Your repository>>Settings>Secretsand create the following secrets;UNITY_SERIAL- (Add the code that looks likeXX-XXXX-XXXX-XXXX-XXXX-XXXX)UNITY_EMAIL- (Add the email address that you use to login to Unity)UNITY_PASSWORD- (Add the password that you use to login to Unity)
Optional steps
-
Verify your license using Activate and for pro licenses also Return License. This is to free up the license allocation after usage.
Note: Test runner and Builder already include these steps.
Setting up a workflow
Setting up a workflow is easy!
Create a file called .github/workflows/main.yml in your repository and configure the following steps;
- Checkout a repository using Checkout.
- Cache your library folder using Cache.
- Configure your test job using Test Runner.
- Configure your build job using Builder.
- Deploy your application.
Detailed instructions for each step can be found in the corresponding actions.
Example
Below is a simple example.
This example assumes that your Unity project is in the root of your repository.
name: Actions 😎
on:
pull_request: {}
push: { branches: [master] }
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
jobs:
build:
name: Build my project ✨
runs-on: ubuntu-latest
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
lfs: true
# Cache
- uses: actions/cache@v1.1.0
with:
path: Library
key: Library
# Test
- name: Run tests
uses: webbertakken/unity-test-runner@v1.2
with:
unityVersion: 2019.2.11f1
# Build
- name: Build project
uses: webbertakken/unity-builder@v0.9
with:
unityVersion: 2019.2.11f1
targetPlatform: WebGL
# Output
- uses: actions/upload-artifact@v1
with:
name: Build
path: build
Project Status
Checkout
| Description | Done | Status |
|---|---|---|
| Checkout project | ✔ | Native support |
Configure
| Description | Done | Status |
|---|---|---|
| Request activation file | ✔ | |
| Activate license | ✔ | |
| Return license | ✔ |
Test
| Description | Done | Status |
|---|---|---|
| Test edit mode | ✔ | |
| Test play mode | ✔ | |
| Test all in one | ✔ |
Build
| Description | Done | Status |
|---|---|---|
| Build for WebGL | ✔ | |
| Build for Windows | ✔ | |
| Build for Linux | ✔ | |
| Build for MacOS | ✔ | |
| Build for Android | ❌ | In progress |
| Build for iOS | ✔ | |
| Build for Windows store | ❌ | In progress |
| Build for PS4 | ❌ | In progress |
| Build for XboxOne | ❌ | In progress |
| Build for tvOS | ❌ | In progress |
| Build for Switch | ❌ | In progress |
Reference implementation
A full example implementation can be found in main.yml of this repo.