-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (142 loc) · 6.51 KB
/
Copy pathgg_regressions_ci.yml
File metadata and controls
152 lines (142 loc) · 6.51 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
name: Graphics CI
on:
push:
branches:
- master
paths:
- 'vlib/**'
- '!vlib/v3/**'
- 'examples/gg/multiwindow.v'
- 'thirdparty/**'
- 'cmd/tools/builders/**.v'
- '**/gg_regressions_ci.yml'
- '!**.md'
pull_request:
paths:
- 'vlib/**'
- '!vlib/v3/**'
- 'examples/gg/multiwindow.v'
- 'thirdparty/**'
- 'cmd/tools/builders/**.v'
- '**/gg_regressions_ci.yml'
- '!**.md'
concurrency:
group: gg-regressions-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
gg-regressions:
runs-on: ubuntu-24.04
timeout-minutes: 20
env:
VFLAGS: -cc tcc
DISPLAY: :99
LIBGL_ALWAYS_SOFTWARE: true
VTMP: /tmp
steps:
- name: Checkout V
uses: actions/checkout@v7
- uses: ./.github/actions/cache-apt-packages-action
- name: Build local v
run: make -j4 && ./v symlink
- name: Clear module cache
run: ./v wipe-cache
- name: Setup dependencies
run: |
# imagemagick : convert, mogrify
# xvfb : xvfb
# openimageio-tools : idiff
# libxcursor-dev libxi-dev : V gfx deps
# libgl1-mesa-dri : For headless rendering / software DRI driver (LIBGL_ALWAYS_SOFTWARE=true)
# freeglut3-dev : Fixes graphic apps compilation with tcc
# libx11-dev : X11 headers for opt-in x.multiwindow X11/Xvfb coverage
# libwayland-dev : Wayland headers for x.multiwindow Wayland compile/probe tests
.github/workflows/disable_azure_mirror.sh
./v retry -- sudo apt update
./v retry -- sudo apt install imagemagick openimageio-tools libgl1-mesa-dev libgl1-mesa-dri xvfb libxcursor-dev libxi-dev libxrandr-dev freeglut3-dev xsel xclip libx11-dev libegl-dev libwayland-dev libxkbcommon-dev libxkbcommon-x11-dev wayland-protocols
./v retry -- ./v download https://raw.githubusercontent.com/tremby/imgur.sh/c98345d/imgur.sh
./v retry -- git clone https://github.com/Larpon/gg-regression-images gg-regression-images
chmod +x ./imgur.sh
- name: Legacy gg import multiwindow isolation
run: env -u DISPLAY -u WAYLAND_DISPLAY -u XDG_SESSION_TYPE ./v test vlib/gg/legacy_import_multiwindow_isolation_test.v
- name: Multiwindow Linux checks
run: |
set -euo pipefail
env -u DISPLAY -u WAYLAND_DISPLAY -u XDG_SESSION_TYPE ./v -d gg_multiwindow test vlib/x/multiwindow vlib/gg/multiwindow_api_d_gg_multiwindow_test.v vlib/gg/frame_pacing_test.v vlib/gg/draw_fns_api_test.v vlib/gg/draw_rect_empty_test.v
env -u DISPLAY -u WAYLAND_DISPLAY -u XDG_SESSION_TYPE ./v -d gg_multiwindow -d sokol_wayland test vlib/x/multiwindow vlib/gg/multiwindow_api_d_gg_multiwindow_test.v vlib/gg/frame_pacing_test.v vlib/gg/draw_fns_api_test.v vlib/gg/draw_rect_empty_test.v
xvfb-run -a -s "-screen 0 1280x1024x24" env -u WAYLAND_DISPLAY -u XDG_SESSION_TYPE LIBGL_ALWAYS_SOFTWARE=true ./v -d gg_multiwindow -d x_multiwindow_x11 test vlib/x/multiwindow vlib/gg/multiwindow_api_d_gg_multiwindow_test.v vlib/gg/frame_pacing_test.v vlib/gg/draw_fns_api_test.v vlib/gg/draw_rect_empty_test.v
./v -d gg_multiwindow -o /tmp/gg_multiwindow_default examples/gg/multiwindow.v
./v -d gg_multiwindow -d x_multiwindow_x11 -o /tmp/gg_multiwindow_x11 examples/gg/multiwindow.v
./v -d gg_multiwindow -d sokol_wayland -o /tmp/gg_multiwindow_wayland examples/gg/multiwindow.v
run_headless_example() {
local label="$1"
local binary="$2"
local stdout
local stderr
local status
stdout="$(mktemp)"
stderr="$(mktemp)"
set +e
env -u DISPLAY -u WAYLAND_DISPLAY -u XDG_SESSION_TYPE \
timeout 20s stdbuf -oL -eL "$binary" >"$stdout" 2>"$stderr"
status=$?
set -e
echo "::group::${label} stdout"
cat "$stdout"
echo "::endgroup::"
echo "::group::${label} stderr"
cat "$stderr"
echo "::endgroup::"
grep -Fq "gg multi-window backend:" "$stdout"
grep -Fq "mock backend selected; stopping after initial lifecycle events" "$stdout"
grep -Fq "live windows:" "$stdout"
grep -Fq "window created:" "$stdout"
if [ "$status" -ne 0 ]; then
echo "${label} failed with status $status"
exit "$status"
fi
}
run_x11_example() {
local label="$1"
local binary="$2"
local stdout
local stderr
local status
stdout="$(mktemp)"
stderr="$(mktemp)"
set +e
xvfb-run -a -s "-screen 0 1280x1024x24" \
env -u WAYLAND_DISPLAY -u XDG_SESSION_TYPE LIBGL_ALWAYS_SOFTWARE=true \
timeout 12s stdbuf -oL -eL "$binary" >"$stdout" 2>"$stderr"
status=$?
set -e
echo "::group::${label} stdout"
cat "$stdout"
echo "::endgroup::"
echo "::group::${label} stderr"
cat "$stderr"
echo "::endgroup::"
grep -Fq "gg multi-window backend:" "$stdout"
grep -Fq "live windows:" "$stdout"
grep -Fq "window created:" "$stdout"
if [ "$status" -eq 124 ]; then
echo "${label} reached the controlled timeout after producing expected launch logs."
return 0
fi
return "$status"
}
run_headless_example "gg multiwindow headless mock" /tmp/gg_multiwindow_default
run_headless_example "gg multiwindow Wayland-build headless mock" /tmp/gg_multiwindow_wayland
run_x11_example "gg multiwindow Xvfb/X11" /tmp/gg_multiwindow_x11
- name: Sample and compare
id: compare
continue-on-error: true
run: |
Xvfb "$DISPLAY" -screen 0 1280x1024x24 -fbdir /var/tmp/ &
sleep 2; while [ ! -f /var/tmp/Xvfb_screen0 ]; do sleep 0.5; done # give xvfb time to start, even on slow CI runs
sleep 5; ./v gret -t ./gg-regression-images/vgret.v_examples.toml -v ./gg-sample_images ./gg-regression-images
- name: Upload regression to imgur
if: steps.compare.outcome != 'success'
run: |
./imgur.sh /tmp/fail.png
./imgur.sh /tmp/diff.png
exit 1