Getting started
This guide will demonstrate how to setup build and test automation for your Unity project hosted on gitlab using gitlab-ci.
Overall steps
- 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.
Supported versions
The unity3d-gitlab-ci-example project is
based on unity3d docker images from
game-ci. Any version in the
docker hub unityci/editor
tags list can be used to
test and build projects.
It's generally considered good practice to use the same Unity version for your CI/CD setup as you do to develop your project.
Video tutorial
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
- Clone the unity3d-gitlab-ci-example project
- Copy
.gitlab-ci.yml
to the root of your repository,Assets/Scripts/Editor/BuildCommand.cs
andci
folder to your 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/
- Open and edit the
.gitlab-ci.yml
you copied to your project and update the variables with the versions you need. Your Unity project version can be found inProjectSettings/ProjectVersion.txt
. - If your Unity project is not at the root of your repository, also update UNITY_DIR variable.
- Continue to activation instructions