This guide will demonstrate how to setup build and test automation for your Unity project hosted on gitlab using gitlab-ci.
- Understand how gitlab-ci works.
- Configure a license for Unity.
- Add build scripts and integrations in your Unity project
- Set up a gitlab-ci pipeline for your project.
- Result: Accept merge requests with more confidence.
First time using Gitlab CI?
Read the official documentation about Getting started with GitLab CI/CD.
Any subsequent steps assume you have read the above.
It's generally considered good practice to use the same Unity version for your CI/CD setup as you do to develop your project.
Setting up gitlab-ci for your Unity project
I don't have a Unity project yet
- Fork the unity3d-gitlab-ci-example project
- Clone the fork you just created locally
- Continue to activation instructions
I already have my own Unity project
Assuming you've cloned the example project in the parent folder of your project, and your Unity project is at the root of your repository, execute these commands from the root folder of your project:
mkdir -p Assets/Scripts/Editor/
cp ../unity3d-gitlab-ci-example/.gitlab-ci.yml ./
cp -r ../unity3d-gitlab-ci-example/ci ./
cp ../unity3d-gitlab-ci-example/Assets/Scripts/Editor/BuildCommand.cs ./Assets/Scripts/Editor/
If your Unity project is not at the root of your repository, also update UNITY_DIR variable.
Continue to activation instructions