Learn more

Save time with GitHub build automation for Unreal Engine

Inworld Team
October 18, 2023
Related posts
Want to try Inworld?
CONTACT SALES

In our first article in this series, we walked you through Github build automation for Unity. Today, we continue with Unreal Engine. 👩‍💻

In this article, we'll show you how Inworld uses this tool to automate the build and release of our Unreal Engine SDK – but it’s also useful for automating game builds, as well. 

How Inworld uses GitHub build automation for Unreal Engine

Game development requires reliable tools, and at Inworld, we've found that GitHub Actions is a solid choice for our Unreal Engine projects. A big part of our workflow involves building our Native Development Kit (NDK) for the different Windows, macOS, and iOS platforms. The NDK helps us connect our code with the systems they run on. With GitHub Actions, we've set up an automated way to build these NDK—making sure they're always updated and ready to go.

After setting up our NDK, we use them to build our game applications. Every time someone makes a pull request (PR), GitHub Actions kicks in to build the Unreal Engine project using the latest NDK. This ensures that both our software development kits (SDKs) and game applications are consistently high quality for our users.

But building is just one piece of the puzzle. Once everything is built, GitHub Actions helps us package our work and gets our Unreal Engine SDK organized and ready for release. This streamlined approach means we can focus more on development and spend less time on manual tasks. ✨

Benefits of GitHub automated builds 

Delving deeper into our use of GitHub build automation for Unreal Engine, it's clear that automation tools bring a number of benefits to the game development cycle. The concepts of continuous integration and continuous deployment (CI/CD) have become industry standards, and for good reason. They promote faster development cycles, ensuring that game devs can quickly build, test, and release new iterations of their games

And it's not just about speed (though speed is a huge factor). They provide consistency to our builds. Every time we compile our Unreal Engine projects, we know exactly what to expect with the final product.By catching potential issues early in the development process, we can address them proactively. 

With the diverse landscape of gaming platforms today, having a tool that can accommodate those differences is also crucial. GitHub Actions, with its adaptability and comprehensive feature set is a reliable solution that ensures the focus remains on increasing your team’s velocity in creating and deploying great experiences via Unreal Engine, rather than getting bogged down in the intricacies of the build process.

Unreal Engine build automation with GitHub Actions 

In our Github Actions workflow, we focus on the core aspects of building and releasing our NDK and SDK. You can find the different yaml files used in our builds here and follow along.

The Build

Here, we'll dive into how we leverage automation with GitHub Actions to streamline our build process for the multiple build components that go into our SDK. The examples provided in this section follow our NDK build for Windows. 

1. Building the NDK:

build-ndk-win:
    runs-on: [ self-hosted, Windows, X64, w10-1344 ]
    steps: …
    - name: Build NDK (Win64)
      shell: pwsh
      if: steps.ndk-cache-win64.outputs.cache-hit != 'true'
      run: |
        $process = Start-Process -FilePath "C:\Program Files\Python310\Python.exe" -Wait -NoNewWindow -PassThru -ArgumentList InworldAI\Source\ThirdParty\Inworld\dev-tools\ndk-util.py,--platform=Win64,--clean,--build
        if($process.ExitCode -ne 0)
        {
          exit 1
        }

We first start our automation by focusing on the Native Development Kit (NDK), a crucial component in game development that acts as a bridge between the high-level game code and the underlying system functionalities. Within the YAML configuration, we specify a GitHub Actions job, build-ndk-win, optimized to run on a self-hosted runner with designated Windows attributes. This setup ensures a consistent environment for our builds.

The heart of this process is the ndk-util.py script, a Python script tailored to streamline the configuration and building of NDKs. We tell Github Actions to run this script with PowerShell and pass in different arguments depending on the operating system we want to build the NDK for. This makes it easy for developers to tailor the NDK build process to their needs. The flexibility ensures that our build process caters to the diverse landscape of gaming platforms.

The cache mechanism checks if a previously built version of the NDK exists. By doing so, it prevents redundant operations—saving resources and time. 

We end this step by checking for any errors that occurred during this build. The action monitors the entire process, and scans for potential issues. If the script encounters any errors, indicated by a non-zero exit code, it immediately terminates the job. This proactive approach ensures that any issues are caught early and maintains the quality of the build process.

2. Building the build editor:

- name: BuildEditor-Win-50
shell: pwsh
run: |
    [string]$UEPath = "C:\Program Files\Epic Games\UE_5.0"
    [string]$ProjectPath = "$pwd"
    Start-Process -FilePath "$UEPath\Engine\Build\BatchFiles\RunUAT.bat" -ArgumentList BuildEditor,-Project="$ProjectPath\TestInworldFPS\TestInworldFPS\TestInworldFPS.uproject",-platform=Win64,-notools,-configuration=Development+Shipping," > BuildEditorLog.txt" -Wait -NoNewWindow -PassThru

Building the editor for the Windows, macOS, and iOS platform is a tedious process that needs to be performed on different sets of hardware. Leveraging the power of automation can significantly simplify this task. At the core of this operation lies Unreal Engine's Automation Tool (UAT), a utility offering a command-line interface (CLI) to tackle various tasks integral to the Unreal Engine development journey such as building, cooking, packaging, and deploying projects.

In this GitHub Action, we use PowerShell to invoke RunUAT.bat, a batch script that allows us to make the most out of UAT's capabilities. Our game projects have unique requirements and configurations. We use the -FilePath parameter to provide the location of RunUAT.bat. Then we configure the build using -ArgumentList to tell the script exactly what type of action we want done.

Since we’re building the editor in this step, we want to pass in BuildEditor as an argument. The remaining arguments can be adjusted according to the platform the editor is being built for.

Logging is important for any development process and the command captures the entire build operation's output, redirecting it to a BuildEditorLog.txt file. This logging ensures that developers can trace back, analyze, and debug any issues or simply review the build process at a later time.

3. Building the game:

- name: BuildGame-Win-50
  shell: pwsh
  run: |
      [string]$UEPath = "C:\Program Files\Epic Games\UE_5.0"
      [string]$ProjectPath = "$pwd"
      Start-Process -FilePath "$UEPath\Engine\Build\BatchFiles\RunUAT.bat" -ArgumentList BuildGame,-Project="$ProjectPath\TestInworldFPS\TestInworldFPS\TestInworldFPS.uproject",-platform=Win64,-notools,-configuration=Development+Shipping," > BuildGameLog.txt" -Wait -NoNewWindow -PassThru

Again, we use the Unreal Engine batch script to build our game project. This time, we pass in BuildGame as an argument into RunUAT instead of BuildEditor.

4. Building the plugin:

- name: BuildPlugin-Win-50
  shell: pwsh
  run: |
      [string]$UEPath = "C:\Program Files\Epic Games\UE_5.0"
      [string]$ProjectPath = "$pwd"
      Start-Process -FilePath "$UEPath\Engine\Build\BatchFiles\RunUAT.bat" -ArgumentList BuildPlugin,-plugin="$ProjectPath\TestInworldFPS\TestInworldFPS\Plugins\InworldAI\InworldAI.uplugin",-TargetPlatforms=Win64,-package="$ProjectPath\PluginBuild"," > BuildPluginLog.txt" -Wait -NoNewWindow -PassThru

Finally, we finish off the last build with the same Github Actions used for building the game and the editor. BuildPlugin is passed in as the argument and now we’re done. 

The Release

Once all components are built, our final task is to send it out to the community. We take the multiple artifacts from the build jobs and combine them into one final SDK.

1. Uploading the Unreal Engine applications:

jobs:
  upload-ndk-win:
    runs-on: [ self-hosted, Windows, X64, w10-1344 ]
    steps:

    …
    - uses: actions/upload-artifact@v3
      with:
        name: NDK-Source
        path: |
          InworldAI\inworld-ndk\build\Package
          !InworldAI\inworld-ndk\build\Package\lib
    - uses: actions/upload-artifact@v3
      with:
        name: Win-NDK-lib
        path: InworldAI\inworld-ndk\build\Package\lib\Win64

After building the NDKs and game applications, we need to store these artifacts for subsequent steps. The Github Action actions/upload-artifact@v3 uploads the previous build artifacts and preps us for the final step in the automation process. 

2. Uploading the Unreal Engine SDK:

package:
    steps:
      - uses: actions/download-artifact@v3
        with:
          name: NDK-Source

        …
      - uses: actions/upload-artifact@v3
        with:
          name: inworld-unreal-sdk
          path: |
            InworldAI
            !InworldAI/inworld-ndk
            InworldMetahuman
            InworldReadyPlayerMe

This final step packages everything together. Using the actions/download-artifact@v3 action, previously built artifacts like the inworld-unreal-sdk are downloaded to the Build/ directory. Then, using the actions/upload-artifact@v3 action, the complete Unreal SDK is uploaded, excluding specific directories to maintain a clean SDK structure.
In this final step, GitHub Actions packages all our developed components. The actions/download-artifact@v3 action retrieves the multiple artifacts from the previous jobs (NDKs and game applications) and places them in the locally available Build/ directory for further operations.

We then use the actions/upload-artifact@v3 action to package the Unreal Engine SDK and upload the content into the Github repository.

With these steps, we’ve completed our Unreal Engine SDK build using an automated build and release process. 

Conclusion

Technologies like GitHub build automation are pivotal in today's game development landscape. At Inworld, we’re always looking to embrace tech that can improve our development cycle. Automation not only streamlines our internal operations but also guarantees our users receive consistent and high-quality experiences. 
If you've found these insights into our use of GitHub Actions for Unreal Engine helpful, we'd love to hear from you. Join our Discord community, check out our Unreal Engine SDK, and start using Inworld today!

Stay connected

Get the latest updates, events, and offers from Inworld.