General·

How To Set Up Continuous Integration with Unreal Engine Plugin

Using CI/CD is key to reducing bugs and shipping Unreal plugins more quickly. In this article, I want to share how I set up Unreal CI with GitHub actions. It works with UE 4 and UE 5. You can support multiple engine versions from the same codebase.

First step - Prepare a Windows PC

We will need a Windows PC that will work as your server. You can rent one from the cloud or use an old PC that stands unused in a corner of your studio. Either way, it will need to be running permanently.

Install Visual Studio 2022 and 2019

Installing Visual Studio 2022 will be simple. For 2019, you need to do some digging on the Microsoft website. You also might need to log in to your Microsoft account to access the older version.

When installing make sure to tick the "Game Development with C++"

On the right, make sure you select: "Windows 10 SDK", "Windows 11 SDK", "Unreal Engine Installer"

After this steps, you should have 2 Visual Studio versions in the Visual Studio Installer:

Install Old Individual Components

The version of the tools used to build UE changes from one version to another. A specific version works only with a particular tool. UAT selects the optimal version of the tool; however, if it is not available, it will use the incorrect one.

That's why you need to install multiple versions of Individual Components - the more you have, the better. For simplicity, I recommend installing all versions of some tools, such as "MSVC v143 - VS 2022 C++ x64/x86 build tools".

Do same to "Windows SDK". Just install all of them, it's the simplest way.

If one of the builds later fails on the base Unreal source code, not even the plugin, the reason is likely that you do not have a specific version of some component installed.

Download Unreal Engine Versions

Open the Epic Games Launcher and install all UE versions that you want to support.

You can disable all installation options - you will not need them for building a plugin.

Second step - Set up a self-hosted runner

Put your plugin into a GitHub repository. For this tutorial, let's assume your plugin name is AwesomePlugin. Then, in the root of your repository, you should have a folder called AwesomePlugin. Inside it should be file AwesomePlugin.uplugin. Make sure the names match.

Go to your repo, then the Settings tab.

Go to Actions -> Runners -> New self-hosted runner.

Select Windows, then proceed with the setup.

Do not run Runner as a Windows service! - We use PowerShell in action, which can create issues with permissions.

Open PowerShell, run ./run.cmd, and leave the console window open.

Add a GitHub action

In the root of your repository, create a .github/workflows folder. Then add this build-unreal.yml file. Ensure that you replace C:\Program Files\Epic Games\ with the installation folder of all UE versions. Replace AwesomePlugin with your plugin name.

name: Unreal Plugin Build
on:
  workflow_dispatch:

  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]
    
jobs:
  build:
    runs-on: self-hosted
    
    strategy:
      fail-fast: false
      matrix:
        unreal_version: [ 'UE_4.26', 'UE_4.27', 'UE_5.0', 'UE_5.1', 'UE_5.2', 'UE_5.3', 'UE_5.4', 'UE_5.5', 'UE_5.6' ]

    steps:
      - name: Checkout Repo
        uses: actions/checkout@v4
      - name: Clean Previous Build
        run: |
          Remove-Item -Path "${{ github.workspace }}/Package" -Recurse -Force -ErrorAction SilentlyContinue
          Remove-Item -Path "${{ github.workspace }}/AwesomePlugin/Intermediate" -Recurse -Force -ErrorAction SilentlyContinue
          Remove-Item -Path "${{ github.workspace }}/AwesomePlugin/Binaries" -Recurse -Force -ErrorAction SilentlyContinue   

      - name: Build Plugin for ${{ matrix.unreal_version }}
        run: |
          & "C:\Program Files\Epic Games\${{ matrix.unreal_version }}\Engine\Build\BatchFiles\RunUAT.bat" BuildPlugin -plugin="${{ github.workspace }}/AwesomePlugin/AwesomePlugin.uplugin" -package="${{ github.workspace }}/Package/${{ matrix.unreal_version }}"

Done! Now whenever you push to main, your plugin will build for all UE versions you specified!