Repository navigation
361 lines (313 loc) · 15.1 KB
/
Copy pathshared-testing-linux.yml
File metadata and controls
361 lines (313 loc) · 15.1 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
#file: noinspection UndefinedAction,UndefinedParamsPresent
name: "Shared: linux"
on:
workflow_call:
inputs:
pr_number:
type: string
required: true
checkout_ref:
type: string
default: ''
required: false
target_sha:
type: string
required: true
workflow_url:
type: string
required: true
enable_test_exports:
type: boolean
required: false
default: false
enable_coverage:
type: boolean
required: false
default: true
jobs:
linux:
name: "CI: linux-${{ matrix.arch }}/${{ matrix.display_server }}"
runs-on: ${{ matrix.os }}
env:
TARGET_SHA: ${{ inputs.target_sha }}
WORKFLOW_URL: ${{ inputs.workflow_url }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
arch: x64
display_server: x11
libName: linux
rid: linux-x64
- os: ubuntu-latest
arch: x64
display_server: wayland
libName: linux
rid: linux-x64
- os: ubuntu-24.04-arm
arch: arm64
display_server: x11
libName: linux
rid: linux-arm64
- os: ubuntu-24.04-arm
arch: arm64
display_server: wayland
libName: linux
rid: linux-arm64
permissions:
contents: read
statuses: write
checks: write
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.checkout_ref != '' && inputs.checkout_ref || (inputs.pr_number != '' && inputs.pr_number != null && format('refs/pull/{0}/merge', inputs.pr_number) || github.ref) }}
fetch-depth: 1
- name: Setup dependencies
uses: ./.github/actions/setup-dependencies
with:
cache-dotnet: false
- name: Set Linux Check Pending
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ./.github/actions/sync-check
with:
repo: ${{ github.repository }}
sha: ${{ inputs.target_sha }}
context: "CI: linux-${{ matrix.arch }}/${{ matrix.display_server }}"
state: pending
status-description: Linux tests in progress
target-url: ${{ inputs.workflow_url }}
allow-status-422: 'true'
- name: Download Testing Native Build Artifacts
uses: ./.github/actions/download-native-binaries
with:
artifact-type: testing
- name: Compile GSettings schemas
run: sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
- name: Install Wayland compositor
if: matrix.display_server == 'wayland'
run: |
sudo apt-get update
sudo apt-get install -y weston
- name: Restore
run: dotnet restore InfiniFrame.GitHubActions.Testing.slnf /p:NoWarn=NU1503 /p:NativeArch=${{ matrix.arch }}
- name: Build Release
run: |
dotnet build InfiniFrame.GitHubActions.Testing.slnf \
--configuration Release \
--no-restore \
-p:SolutionDir=${{ github.workspace }}/ \
-p:NativeArch=${{ matrix.arch }} \
-p:InfiniFrameSkipNativeBuild=true \
-p:InfiniFrameEnableTestExports=${{ inputs.enable_test_exports }}
- name: Install Native Debugging Tools
run: |
sudo apt-get update
sudo apt-get install -y gdb libc6-dbg
- name: Export Actions Runtime
uses: actions/github-script@v9
with:
script: |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env['ACTIONS_RUNTIME_TOKEN']);
core.exportVariable('ACTIONS_RESULTS_URL', process.env['ACTIONS_RESULTS_URL']);
- name: Run Tests
run: |
echo "Starting desktop environment..."
eval "$(dbus-launch --sh-syntax)"
if [ "${{ matrix.display_server }}" = "wayland" ]; then
echo "=== Wayland Setup ==="
echo "Launching Xvfb (host for nested Wayland compositor)..."
Xvfb :99 \
-screen 0 1920x1080x24 \
-ac \
+extension GLX \
+extension RANDR \
+extension RENDER \
-nolisten tcp \
-noreset &> xvfb.log &
export DISPLAY=:99
echo "Waiting for X server..."
timeout 30 bash -c 'until xdpyinfo >/dev/null 2>&1; do sleep 1; done' || {
echo "X server failed to start."
cat xvfb.log || true
exit 1
}
export XDG_RUNTIME_DIR="/tmp/runtime-$USER"
mkdir -p "$XDG_RUNTIME_DIR"
chmod 700 "$XDG_RUNTIME_DIR"
export XDG_SESSION_TYPE=wayland
export WAYLAND_DISPLAY=wayland-0
echo "Launching Weston (x11 backend, nested in Xvfb)..."
weston --backend=x11 --socket="$WAYLAND_DISPLAY" \
--width=1920 --height=1080 \
&> compositor.log &
echo "Waiting for Wayland compositor..."
timeout 30 bash -c "until [ -S \"$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY\" ]; do sleep 1; done" || {
echo "Wayland compositor failed to start."
cat compositor.log || true
exit 1
}
echo "=== Environment Status ==="
echo "Session: $XDG_SESSION_TYPE"
echo "Wayland display: $WAYLAND_DISPLAY"
echo "D-Bus: $DBUS_SESSION_BUS_ADDRESS"
else
echo "=== X11 Setup ==="
echo "Launching Xvfb..."
Xvfb :99 \
-screen 0 1920x1080x24 \
-ac \
+extension GLX \
+extension RANDR \
+extension RENDER \
-nolisten tcp \
-noreset &> xvfb.log &
export DISPLAY=:99
export XDG_RUNTIME_DIR="/tmp/runtime-$USER"
export XDG_SESSION_TYPE=x11
export DESKTOP_SESSION=openbox
export XDG_CURRENT_DESKTOP=Openbox
mkdir -p "$XDG_RUNTIME_DIR"
chmod 700 "$XDG_RUNTIME_DIR"
echo "Waiting for X server..."
timeout 30 bash -c 'until xdpyinfo >/dev/null 2>&1; do sleep 1; done' || {
echo "X server failed to start."
cat xvfb.log || true
exit 1
}
echo "Starting Openbox..."
openbox &> openbox.log &
timeout 20 bash -c 'until pgrep -x openbox >/dev/null; do sleep 1; done' || {
echo "Openbox failed to start."
cat openbox.log || true
exit 1
}
echo "Openbox is running:"
pgrep -a -x openbox || echo "Openbox missing unexpectedly"
if timeout 5 xwininfo -root >/dev/null 2>&1; then
echo "Window manager responding"
else
echo "Window manager not responding"
exit 1
fi
echo "=== Environment Status ==="
echo "Display: $DISPLAY"
echo "Desktop: $XDG_CURRENT_DESKTOP"
echo "D-Bus: $DBUS_SESSION_BUS_ADDRESS"
fi
export LIBGL_ALWAYS_SOFTWARE=1
export GALLIUM_DRIVER=llvmpipe
export MESA_LOADER_DRIVER_OVERRIDE=llvmpipe
export MESA_GL_VERSION_OVERRIDE=3.3
export WEBKIT_DISABLE_COMPOSITING_MODE=1
export WEBKIT_DISABLE_DMABUF_RENDERER=1
export INFINIFRAME_LINUX_FORCE_SOFTWARE_RENDERING=1
xdpyinfo | head -3 || true
echo "=== OpenGL Info ==="
glxinfo | grep -E "OpenGL renderer|OpenGL vendor|OpenGL version" || true
echo "=== Running Tests ==="
mkdir -p artifacts/native-crash artifacts/testresults
ulimit -c unlimited
sudo sysctl -w kernel.core_uses_pid=1
sudo sysctl -w "kernel.core_pattern=${GITHUB_WORKSPACE}/artifacts/native-crash/core.%e.%p.%t"
exit_code=0
for framework in net8.0 net9.0 net10.0; do
echo "=== Running ${framework} ==="
test_args=(
test
--solution InfiniFrame.GitHubActions.Testing.slnf
--configuration Release
--no-build
--no-restore
--framework "$framework"
-p:NativeArch=${{ matrix.arch }}
-p:InfiniFrameSkipNativeBuild=true
-p:InfiniFrameEnableTestExports=${{ inputs.enable_test_exports }}
--
--no-ansi
--maximum-parallel-tests 1
)
if [ "${{ inputs.enable_coverage }}" = "true" ] && [ "$framework" = "net10.0" ]; then
test_args+=(--results-directory "artifacts/testresults/$framework" --coverage --coverage-output-format cobertura)
fi
framework_exit=0
dotnet "${test_args[@]}" 2>&1 | sed 's/\x1b\[[0-9;]*[a-zA-Z]//g' | tee "artifacts/testresults/${framework}-output.log" || framework_exit=$?
# WebKitGTK emits SIGABRT (exit 134) during process teardown on
# Linux after all tests pass. This is a known race between WebKit
# web-process cleanup and display-server teardown. Treat it as
# success when every test assertion passed (failed: 0 in output).
if [ $framework_exit -eq 134 ]; then
if grep -qE '^\s*failed:\s+0\s*$' "artifacts/testresults/${framework}-output.log" 2>/dev/null; then
echo "WARN: SIGABRT during teardown with all tests passing (WebKitGTK cleanup race) — ignoring"
framework_exit=0
fi
fi
if [ $framework_exit -ne 0 ]; then
exit_code=$framework_exit
fi
done
shopt -s nullglob
for core_file in artifacts/native-crash/core.*; do
core_name="$(basename "$core_file")"
dump_file="artifacts/native-crash/${core_name}.gdb.txt"
core_meta="$(file "$core_file" || true)"
exe_path="$(echo "$core_meta" | sed -n "s/.*execfn: '\\([^']*\\)'.*/\\1/p")"
if [ -z "$exe_path" ] || [ ! -x "$exe_path" ]; then
exe_path="/usr/bin/dotnet"
fi
{
echo "===== CORE FILE ====="
echo "$core_file"
echo
echo "$core_meta"
echo
echo "===== EXECUTABLE ====="
echo "$exe_path"
echo
} > "$dump_file"
gdb -q --batch \
-ex "set pagination off" \
-ex "set confirm off" \
-ex "echo ===== INFO FILES =====\n" \
-ex "info files" \
-ex "echo \n===== THREAD BACKTRACES =====\n" \
-ex "thread apply all bt full" \
-ex "echo \n===== REGISTERS =====\n" \
-ex "info registers" \
-ex "echo \n===== SHARED LIBS =====\n" \
-ex "info sharedlibrary" \
"$exe_path" "$core_file" >> "$dump_file" 2>&1 || true
done
exit $exit_code
- name: Upload Native Crash Diagnostics
if: always()
uses: actions/upload-artifact@v7
with:
name: linux-native-crash-${{ matrix.arch }}-${{ matrix.display_server }}
path: |
artifacts/native-crash/**
core*
if-no-files-found: ignore
- name: Upload C# Coverage
if: ${{ inputs.enable_coverage == true && success() }}
uses: actions/upload-artifact@v7
with:
name: cs-coverage-linux-${{ matrix.arch }}-${{ matrix.display_server }}
path: artifacts/testresults/net10.0/**/*.cobertura.xml
if-no-files-found: warn
retention-days: 1
- name: Update Linux Check
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: ./.github/actions/sync-check
with:
repo: ${{ github.repository }}
sha: ${{ inputs.target_sha }}
context: "CI: linux-${{ matrix.arch }}/${{ matrix.display_server }}"
target-url: ${{ inputs.workflow_url }}
job-status: ${{ job.status }}
success-description: Linux tests passed
failure-description: Linux tests failed