forked from getsentry/sentry-unreal
-
Notifications
You must be signed in to change notification settings - Fork 0
171 lines (156 loc) · 7.55 KB
/
Copy pathtest-linux.yml
File metadata and controls
171 lines (156 loc) · 7.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
on:
workflow_call:
inputs:
unreal-version:
required: true
type: string
env:
REGISTRY: ghcr.io
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Free disk space
run: |
# time df -h
sudo time swapoff -a
sudo time rm -f /swapfile
sudo time rm -rf /usr/local/lib/android
sudo time rm -rf /usr/share/dotnet
sudo time rm -rf /usr/share/swift
sudo time rm -rf /usr/local/share/powershell
sudo time rm -rf /usr/local/.ghcup
sudo time rm -rf /usr/local/lib/node_modules
sudo time rm -rf /usr/local/share/boost
sudo time rm -rf /usr/lib/google-cloud-sdk
sudo time rm -rf /usr/lib/jvm
sudo time rm -rf /opt/pipx
sudo time rm -rf /opt/ghc
sudo time rm -rf "$AGENT_TOOLSDIRECTORY"
sudo time apt-get clean
sudo time rm -rf /var/lib/apt/lists/*
# time docker rmi $(docker image ls -aq)
# time du --max-depth=3 --threshold=100M -h /usr /opt /var 2>/dev/null | sort -hr
df -h
- name: Log in to GitHub package registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start Docker container
env:
WORKSPACE_PATH: ${{ github.workspace }}
UNREAL_VERSION: ${{ inputs.unreal-version }}
DISALLOW_RAW_POINTERS: ${{ inputs.unreal-version == '4.27' && 'false' || 'true' }}
run: |
# We start the container with the user ID of the parent GH action user to avoid permission issues on volume.
# For UE 5.4 we have to enable ipv6 to fix container startup issues. See https://github.com/adamrehn/ue4-docker/issues/357
uid=$(id -u) # the GH action user ID
gid=1000 # the ue4 group in the docker container
user='gh'
set -x
docker network create --ipv6 --subnet 2001:0DB8::/112 ip6net
docker run -td \
--name unreal \
--volume "$WORKSPACE_PATH:/workspace" \
--workdir /workspace \
--user $uid:$gid \
--env HOME="/home/$user" \
--env PATH="/home/$user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" \
--env DISALLOW_RAW_POINTERS=$DISALLOW_RAW_POINTERS \
--network ip6net -p 80:80 \
ghcr.io/getsentry/unreal-docker:"$UNREAL_VERSION"-linux
docker logout ghcr.io
# Add the user so it has a home directory (needed to run tests later on)
docker exec --user root unreal useradd -u $uid -g $gid --create-home $user
# Ensure CA certs are in the right directory (needed for running tests)
docker exec --user root unreal bash -c "
mkdir -p /etc/pki/tls/certs ;
cp /etc/ssl/certs/ca-certificates.crt /etc/pki/tls/certs/ca-bundle.crt "
# Chown some paths to the GH user to make UE5 work properly. We can't just chown the whole UnrealEngine or
# docker would implicitly have to copy it to the container and we would run out of space on the GH runner.
- name: Chown Docker container paths
env:
ENGINE_PATH: ${{ inputs.unreal-version == '4.27' && 'Programs/UnrealPak/Saved' || 'Binaries/ThirdParty/DotNet' }}
run: |
uid=$(id -u) # the GH action user ID
docker exec --user root unreal bash -c "
chown -R $uid /home/ue4/UnrealEngine/Engine/Binaries/ThirdParty/Mono/Linux ;
chown -R $uid /home/ue4/UnrealEngine/Engine/\"$ENGINE_PATH\" ;
chown -R $uid /home/ue4/UnrealEngine/Engine/Binaries/ThirdParty/USD/UsdResources/Linux ;
mkdir -p /home/ue4/UnrealEngine/Epic/UnrealEngine && chown -R $uid /home/ue4/UnrealEngine/Epic ;
mkdir -p /home/ue4/UnrealEngine/Engine/Source/Epic/UnrealEngine && chown -R $uid /home/ue4/UnrealEngine/Engine/Source/Epic ;
mkdir -p /home/ue4/UnrealEngine/Engine/Intermediate/Build/BuildCookRun && chown -R $uid /home/ue4/UnrealEngine/Engine/Intermediate/Build/BuildCookRun "
- name: Download package
uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}
- uses: actions/checkout@v4
with:
path: checkout
submodules: recursive
- name: Extract package to sample/Plugins
env:
UNREAL_VERSION: ${{ inputs.unreal-version }}
run: unzip sentry-unreal-*-engine"$UNREAL_VERSION".zip -d checkout/sample/Plugins/sentry
- name: Set permissions for sample
# sentry-native requires write access to sample project directory in order to initialize itself properly
run: docker exec -w /workspace/checkout unreal chmod -R +x sample
- name: Set execute permission for Python3
# Python3 is needed for post-build symbol upload script
run: docker exec --user root unreal chmod +x /home/ue4/UnrealEngine/Engine/Binaries/ThirdParty/Python3/Linux/bin/python3
- name: Update engine's build configuration
run: |
docker exec unreal bash -c "
mkdir -p ~/.config/Unreal\ Engine/UnrealBuildTool ;
cp /workspace/checkout/.github/BuildConfiguration.xml ~/.config/Unreal\ Engine/UnrealBuildTool/ "
- name: Run tests
id: run-tests
env:
EDITOR_BINARY: ${{ inputs.unreal-version == '4.27' && 'UE4Editor' || 'UnrealEditor' }}
SENTRY_UPLOAD_SYMBOLS_AUTOMATICALLY: true
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
run: |
docker exec -w /workspace/checkout/sample \
-e SENTRY_UPLOAD_SYMBOLS_AUTOMATICALLY="$SENTRY_UPLOAD_SYMBOLS_AUTOMATICALLY" \
-e SENTRY_AUTH_TOKEN="$SENTRY_AUTH_TOKEN" \
-e SENTRY_ORG="$SENTRY_ORG" \
-e SENTRY_PROJECT="$SENTRY_PROJECT" \
unreal /home/ue4/UnrealEngine/Engine/Build/BatchFiles/RunUAT.sh BuildCookRun \
-project=/workspace/checkout/sample/SentryPlayground.uproject \
-archivedirectory=/workspace/checkout/sample/Builds \
-platform=Linux \
-nop4 \
-cook \
-build \
-stage \
-prereqss \
-package \
-archive
docker exec -w /workspace/checkout/sample unreal /home/ue4/UnrealEngine/Engine/Binaries/Linux/"$EDITOR_BINARY" \
/workspace/checkout/sample/SentryPlayground.uproject \
-ReportExportPath=/workspace/checkout/sample/Saved/Automation \
-ExecCmds="Automation RunTests Sentry;quit" \
-TestExit="Automation Test Queue Empty" \
-Unattended \
-NoPause \
-NoSplash \
-NullRHI
- name: Collect sample test info
if: ${{ always() && steps.run-tests.outcome == 'failure' }}
uses: actions/upload-artifact@v4
with:
name: UE ${{ inputs.unreal-version }} sample test report (Linux)
path: |
checkout/sample/Saved/Automation
- name: Upload sample build
if: ${{ success() && steps.run-tests.outcome == 'success' }}
uses: actions/upload-artifact@v4
with:
name: UE ${{ inputs.unreal-version }} sample build (Linux)
path: checkout/sample/Builds/${{ inputs.unreal-version == '4.27' && 'LinuxNoEditor' || 'Linux' }}/
retention-days: 1