-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-with-xvfb.sh
executable file
·61 lines (46 loc) · 1.42 KB
/
run-with-xvfb.sh
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
#!/bin/bash -ex
exec > >(tee build.txt) 2>&1
#---------------------------------------------------------------------
# Install all of the various required packages.
#
# We use:
# xvfb to provide a virtual X server
# fluxbox to provide a bare-minimum window manager with click-to-focus
# ffmpeg to record the session
# feh to set a background
#
sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y install xvfb fluxbox feh ffmpeg
#---------------------------------------------------------------------
# Start Xvfb on a new display.
#
Xvfb :99 &
export DISPLAY=:99
sleep 1
#---------------------------------------------------------------------
# Start fluxbox on the X server.
#
fluxbox &
sleep 1
#---------------------------------------------------------------------
# Set a desktop image.
#
feh --bg-tile .github/workflows/wallpaper.jpg
sleep 1
#---------------------------------------------------------------------
# Start recording the session.
#
ffmpeg -f x11grab -y -r 60 -video_size 1280x1024 -i :99 test-suite.webm &
FFMPEG_PID="$!"
#---------------------------------------------------------------------
# Execute the passed-in build command.
#
"$@"
#---------------------------------------------------------------------
# Wait a while, and then instruct ffmpeg to stop recording. This step
# is necessary because video files need to be processed when recording
# stops.
#
sleep 20
kill -INT "${FFMPEG_PID}"