Setting up Gitlab CI for Unreal Engine 4

This tutorial provides documentation and resources on how to configure Gitlab CI to compile and build your Unreal Engine 4 project. The tutorial is also available on Github.

For our university project we needed a solution for Unreal Engine 4 build automation. After trying Jenkins CI but running into network limitations due to the university network we started using Gitlab CI to automate our builds.

This tutorial and files are based on the great Jenkins tutorial by Zack Devine, check it out if you want to use Jenkins instead!


Before you begin: Set up your Gitlab repository as normal and clone it to your desktop. You can go ahead and add your Unreal Engine 4 project to the repository.

This documentation is solely meant to configure a Gitlab runner on Windows servers and desktops. This may work on GNU/Linux build servers but the included scripts have only been tested for Windows desktops.

We will configure our pipeline so that it will only archive our builds during scheduled builds and manual builds started through the Gitlab interface. This way you prevent flooding your disk space with archived builds.

Setting up the Runner

Gitlab uses runners to run the jobs defined in the .gitlab-ci.yml file (which we will create in the last step of this tutorial). We will set up a Windows desktop as our runner.

Download the runner executable from and follow the installation process described in the documentation.

Register the Runner
Now we need to register our runner. Inside your Gitlab project go to Settings -> CI/CD -> General pipelines settings and obtain the runner token.

Follow the registration progress described in but do not enter any tags when prompted. Finaly pick Shell as your executor after which we should have our runner set up.

Configure the Build Scripts
Download the build scripts and move them to another folder. For example: C:/BuildScripts/.
Make sure you replace PROJECT_NAME inside the scripts with the name of your project.

Creating a Gitlab Pipeline

Once we have our runner set up we can configure our pipeline. Start by creating a .gitlab-ci.yml file inside your repository. This file tells the Gitlab runner what to do when a pipeline is triggered.

Add the following to the .gitlab-ci.yml file.
  GIT_STRATEGY: none        # we disable fetch, clone or checkout for every job
  GIT_CHECKOUT: "false"     # as we only want to checkout and fetch in the preperation stage

  - preperations
  - compile
  - build
  - cook
  - package

  stage: preperations
    GIT_STRATEGY: fetch
    GIT_CHECKOUT: "true"
    - call "C:\PATH_TO_FILES\StartBuild.bat"

  stage: compile
    - call "C:\PATH_TO_FILES\CompileScripts.bat"

  stage: build
    - call "C:\PATH_TO_FILES\BuildFiles.bat"

  stage: cook
    - call "C:\PATH_TO_FILES\CookProject.bat"

  stage: package
    - web                 # only archive when started through the web interface
    - schedules           # only archive when started at a specific schedule
    - echo "Adding build to the artifacts"
    - call C:\PATH_TO_FILES\Archive.bat
    expire_in: 5 days

Commit the file and your pipeline should be triggered! Gitlab will now build and compile your project everytime files are pushed to your repository. It will archive the build only when triggered through the web interface or on a scheduled time.

Finaly you might want to add Slack Notifications.

If you have any questions, suggestions or feedback feel free to contact me.

Share this Post: