Skip to content

Commit 51e29c3

Browse files
chore: Build custom UE Linux Docker images to update CI (#864)
* Add workflow for building UE Linux Docker images * Test * Switch to using Linux containers * Test * Test * Switch to Linux runner * Test * Update ue-docker-linux.yml * Test CI run with custom Linux container * Fix ghrc auth * Add env * Remove extra arm64 setup * Fix caching * Add more engine versions for linux test * Try tag for ue 5.0 * Revert * Try ubuntu 20.04 for UE 5.0 * Fix * Update ue-docker-linux.yml * Update ue-docker-linux.yml * Update ue-docker-linux.yml * Update workflows * Update ue-docker-linux.yml * Update .github/workflows/test-linux.yml Co-authored-by: Bruno Garcia <[email protected]> * Update .github/workflows/ue-docker-linux.yml Co-authored-by: Bruno Garcia <[email protected]> --------- Co-authored-by: Bruno Garcia <[email protected]>
1 parent a65a50c commit 51e29c3

File tree

5 files changed

+121
-27
lines changed

5 files changed

+121
-27
lines changed

.github/workflows/ci.yml

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
push:
55
paths-ignore:
66
- "**.md"
7-
- "**ue-docker.yml"
87

98
jobs:
109
android-sdk:
@@ -29,16 +28,13 @@ jobs:
2928
uses: ./.github/workflows/sdk-build.yml
3029
with:
3130
target: Linux
32-
# Build for an older GLIBC so that it can run with the old GLIBC included in EpicGames' Unreal docker images.
33-
# See discussion in https://github.com/getsentry/sentry-unreal/pull/173
34-
runsOn: ubuntu-20.04
31+
runsOn: ubuntu-22.04
3532

3633
linux-arm64-sdk:
3734
uses: ./.github/workflows/sdk-build.yml
3835
with:
3936
target: LinuxArm64
4037
runsOn: ubuntu-22.04-arm
41-
container: arm64v8/ubuntu:20.04
4238

4339
windows-crashpad-sdk:
4440
uses: ./.github/workflows/sdk-build.yml
@@ -152,7 +148,8 @@ jobs:
152148
fail-fast: false
153149
matrix:
154150
# Note: these versions must match scripts/packaging/engine-versions.txt
155-
unreal: ['4.27', '5.0', '5.1', '5.2', '5.3', '5.4', '5.5']
151+
# Note: Currently 5.0 is not supported due to ue4-docker issue https://github.com/adamrehn/ue4-docker/issues/373
152+
unreal: ['4.27', '5.1', '5.2', '5.3', '5.4', '5.5']
156153
uses: ./.github/workflows/test-linux.yml
157154
with:
158155
unreal-version: ${{ matrix.unreal }}

.github/workflows/sdk-build.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@ jobs:
2121
run:
2222
shell: bash
2323
steps:
24-
- name: Configure env for Linux arm64 runner
25-
if: ${{ inputs.target == 'LinuxArm64' }}
26-
run: |
27-
apt-get update
28-
apt-get -y install sudo
29-
apt-get -y install wget
30-
apt-get -y install cmake
31-
apt-get -y install software-properties-common
32-
apt-get -y install git
33-
git config --global --add safe.directory $(pwd)
34-
3524
- uses: actions/checkout@v4
3625

3726
- name: Select submodule
@@ -55,8 +44,7 @@ jobs:
5544
with:
5645
path: |
5746
${{ steps.env.outputs.path }}
58-
modules/sentry-java/sentry-android-ndk/build/intermediates/merged_native_libs/release/out/lib
59-
key: sdk=${{ inputs.target }}-${{ hashFiles('submodule-status', 'scripts/build-*.sh', '.github/workflows/sdk.yml') }}
47+
key: sdk=${{ inputs.target }}-${{ hashFiles('submodule-status', 'scripts/build-*.sh', '.github/workflows/sdk-build.yml') }}
6048

6149
- name: Install Linux/LinuxArm64 Dependencies
6250
if: ${{ (inputs.target == 'Linux' || inputs.target == 'LinuxArm64') && steps.cache.outputs.cache-hit != 'true' }}

.github/workflows/test-linux.yml

+11-8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
required: true
66
type: string
77

8+
env:
9+
REGISTRY: ghcr.io
10+
811
jobs:
912
test:
1013
name: Test
@@ -34,9 +37,15 @@ jobs:
3437
# time du --max-depth=3 --threshold=100M -h /usr /opt /var 2>/dev/null | sort -hr
3538
df -h
3639
40+
- name: Log in to GitHub package registry
41+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
42+
with:
43+
registry: ${{ env.REGISTRY }}
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
3747
- name: Start Docker container
3848
run: |
39-
echo ${{ secrets.DOCKER_TOKEN }} | docker login ghcr.io -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
4049
# We start the container with the user ID of the parent GH action user to avoid permission issues on volume.
4150
# For UE 5.4 we have to enable ipv6 to fix container startup issues. See https://github.com/adamrehn/ue4-docker/issues/357
4251
uid=$(id -u) # the GH action user ID
@@ -52,7 +61,7 @@ jobs:
5261
--env HOME="/home/$user" \
5362
--env PATH="/home/$user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
5463
--network ip6net -p 80:80 \
55-
ghcr.io/epicgames/unreal-engine:dev-slim-${{ inputs.unreal-version }}.1
64+
ghcr.io/getsentry/unreal-docker:${{ inputs.unreal-version }}-linux
5665
docker logout ghcr.io
5766
# Add the user so it has a home directory (needed to run tests later on)
5867
docker exec --user root unreal useradd -u $uid -g $gid --create-home $user
@@ -74,12 +83,6 @@ jobs:
7483
mkdir -p /home/ue4/UnrealEngine/Engine/Source/Epic/UnrealEngine && chown -R $uid /home/ue4/UnrealEngine/Engine/Source/Epic ;
7584
mkdir -p /home/ue4/UnrealEngine/Engine/Intermediate/Build/BuildCookRun && chown -R $uid /home/ue4/UnrealEngine/Engine/Intermediate/Build/BuildCookRun "
7685
77-
- name: Setup C++ runtime
78-
run: docker exec --user root unreal bash -c '
79-
apt-get update ;
80-
add-apt-repository ppa:ubuntu-toolchain-r/test ;
81-
apt-get install -y libstdc++6'
82-
8386
- name: Download package
8487
uses: actions/download-artifact@v4
8588
with:

.github/workflows/ue-docker-linux.yml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Build UE Linux Docker image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ue_version:
7+
description: Select Unreal Engine version
8+
required: true
9+
type: choice
10+
options:
11+
- 4.27
12+
- 5.1
13+
- 5.2
14+
- 5.3
15+
- 5.4
16+
- 5.5
17+
ue_repo:
18+
description: Set Unreal Engine repository
19+
required: true
20+
type: string
21+
default: 'https://github.com/getsentry/UnrealEngine.git'
22+
clean_disk:
23+
description: Clean up disk space before Docker build
24+
required: true
25+
type: boolean
26+
default: false
27+
28+
env:
29+
REGISTRY: ghcr.io
30+
31+
jobs:
32+
build:
33+
name: 'Build for UE ${{ inputs.ue_version }}'
34+
runs-on: ubuntu-latest-32-cores
35+
36+
permissions:
37+
contents: read
38+
packages: write
39+
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
44+
# Building docker images for newer UE versions may require extra disk space
45+
- name: Clean up disk space before Docker build
46+
if: ${{ inputs.clean_disk == true }}
47+
run: |
48+
# time df -h
49+
sudo time swapoff -a
50+
sudo time rm -f /swapfile
51+
sudo time rm -rf /usr/local/lib/android
52+
sudo time rm -rf /usr/share/dotnet
53+
sudo time rm -rf /usr/share/swift
54+
sudo time rm -rf /usr/local/share/powershell
55+
sudo time rm -rf /usr/local/.ghcup
56+
sudo time rm -rf /usr/local/lib/node_modules
57+
sudo time rm -rf /usr/local/share/boost
58+
sudo time rm -rf /usr/lib/google-cloud-sdk
59+
sudo time rm -rf /usr/lib/jvm
60+
sudo time rm -rf /opt/pipx
61+
sudo time rm -rf /opt/ghc
62+
sudo time rm -rf "$AGENT_TOOLSDIRECTORY"
63+
sudo time apt-get clean
64+
sudo time rm -rf /var/lib/apt/lists/*
65+
# time docker rmi $(docker image ls -aq)
66+
# time du --max-depth=3 --threshold=100M -h /usr /opt /var 2>/dev/null | sort -hr
67+
df -h
68+
69+
- name: Set up Python
70+
uses: actions/setup-python@v4
71+
with:
72+
python-version: '3.12.8'
73+
architecture: 'x64'
74+
75+
- name: Install unreal-docker
76+
run: |
77+
pip install ue4-docker
78+
79+
- name: Configure unreal-docker
80+
run: |
81+
ue4-docker setup
82+
83+
- name: Build Unreal Engine Docker image
84+
run: |
85+
ue4-docker build custom -repo="${{ inputs.ue_repo }}" -branch="${{ inputs.ue_version }}" \
86+
-basetag ubuntu22.04 \
87+
-suffix "${{ inputs.ue_version }}" \
88+
-username=${{ secrets.DOCKER_USERNAME }} \
89+
-password=${{ secrets.DOCKER_TOKEN }} \
90+
--linux \
91+
--target minimal \
92+
--exclude debug \
93+
--exclude templates \
94+
--exclude ddc
95+
96+
- name: Log in to GitHub package registry
97+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
98+
with:
99+
registry: ${{ env.REGISTRY }}
100+
username: ${{ github.actor }}
101+
password: ${{ secrets.GITHUB_TOKEN }}
102+
103+
- name: Tag and push Docker image with pre-built Unreal Engine
104+
run: |
105+
docker tag adamrehn/ue4-minimal:custom-${{ inputs.ue_version }} ${{ env.REGISTRY }}/getsentry/unreal-docker:${{ inputs.ue_version }}-linux
106+
docker push ${{ env.REGISTRY }}/getsentry/unreal-docker:${{ inputs.ue_version }}-linux

0 commit comments

Comments
 (0)