Skip to content

Add BuildGraph implementation for projects

June requested to merge buildgraph into main

This adds scripts which use BuildGraph to distribute a project build over multiple GitLab workers.

It requires a different BuildConfig.json format, like so:

{
    "Type": "Project",
    "Distributions": [
        {
            "Name": "4.26",
            "FolderName": "ExampleUnified_4.26",
            "ProjectName": "ExampleOSS",
            "Build": {
                "Editor": {
                    "Target": "ExampleOSSEditor"
                },
                "Game": {
                    "Targets": [
                        "ExampleOSS"
                    ],
                    "Platforms": [
                        "Win64",
                        "Android",
                        "IOS",
                        "Mac"
                    ],
                    "Configurations": [
                        "DebugGame"
                    ]
                },
                "Server": {
                    "Targets": [
                        "ExampleOSSServer"
                    ],
                    "Platforms": [
                        "Win64",
                        "Linux"
                    ],
                    "Configurations": [
                        "DebugGame"
                    ]
                }
            },
            "Tests": [
                {
                    "Name": "Descriptive Name of Test",
                    "Type": "Gauntlet",
                    "Requires": [
                        {
                            "Type": "Game",
                            "Target": "ExampleOSS",
                            "Platforms": [
                                "Win64",
                                "Android",
                                "IOS",
                                "Mac"
                            ],
                            "Configuration": "DebugGame"
                        }
                    ],
                    "Gauntlet": {
                        "ScriptPath": "BuildScriptsExtra/EOSGauntletTest.cs",
                        "DeviceListPath": "BuildScriptsExtra/DeviceList.json",
                        "TestName": "YourGauntletTestName",
                        "Configuration": "DebugGame",
                        "ResourceGroup": "MobileDevices"
                    }
                },
                // ...
            ]
        },
        // ...
    ]
}

To use it in GitLab, set your main .gitlab-ci.yml up to generate and then use child pipelines:

stages:
  - Generate
  - Execute

variables:
  GIT_CLEAN_FLAGS: none

"Generate":
  stage: Generate
  tags:
    - redpoint-games-windows
  script: |
    git submodule update --init BuildScripts
    if (`$LastExitCode -ne 0) { exit `$LastExitCode }
    .\BuildScripts\Patch_BuildGraph.ps1 -EnginePath "C:\Path\To\UnrealEngine"
    if (`$LastExitCode -ne 0) { exit `$LastExitCode }
    .\BuildScripts\Generate.ps1 -EnginePath "C:\Path\To\UnrealEngine" -MacEnginePath "/Users/Shared/Epic Games/UE_4.26/" -Distribution "4.26" -GitLabYamlPath .gauntlet.gitlab-ci.yml -GitLabAgentTagPrefix my-agent-prefix -WindowsSharedStorageAbsolutePath "X:\" -WindowsLinuxToolchainPath "C:\UnrealToolchains\v17_clang-10.0.1-centos7\"
  only:
    - main
  artifacts:
    paths:
      - .gauntlet.gitlab-ci.yml
      # But you can have more if you call Generate multiple times to generate multiple child pipelines.
  variables:
    GIT_SUBMODULE_STRATEGY: none

"Gauntlet":
  stage: Execute
  needs:
    - "Generate"
  trigger:
    strategy: depend
    include:
      - artifact: .gauntlet.gitlab-ci.yml
        job: "Generate"
  only: 
    refs:
      - main
Edited by June

Merge request reports