Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ee06e1c

Browse files
committed
Make X11/etc persistent; add ffmpeg
1 parent 01cfd65 commit ee06e1c

File tree

1 file changed

+53
-10
lines changed

1 file changed

+53
-10
lines changed

.github/workflows/main.yml

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,67 @@ jobs:
2828
with:
2929
bundler-cache: true
3030
ruby-version: ${{ matrix.ruby }}
31+
- name: Install gem
32+
run: gem install syntax_tree
3133
- name: Compile extension
3234
run: |
3335
yarn install --frozen-lockfile
3436
yarn compile
35-
- name: Install gem
36-
run: gem install syntax_tree
37-
- name: Setup upterm session
38-
uses: lhotari/action-upterm@v1
39-
with:
40-
limit-access-to-actor: true
41-
- name: Run tests
37+
- name: Setup GUI Environment
38+
run: |
39+
# prerequisites
40+
sudo apt-get install -yq dbus-x11 ffmpeg > /dev/null
41+
mkdir -p ~/bin
42+
mkdir -p ~/var/run
43+
cat <<EOF > ~/bin/xvfb-daemon
44+
#! /bin/bash
45+
echo DISPLAY=\$DISPLAY >> ${GITHUB_ENV}
46+
echo XAUTHORITY=\$XAUTHORITY >> ${GITHUB_ENV}
47+
sleep 86400
48+
EOF
49+
chmod a+x ~/bin/xvfb-daemon
50+
dbus-launch >> ${GITHUB_ENV}
51+
start-stop-daemon --start --quiet --pidfile ~/var/run/Xvfb.pid --make-pidfile --background --exec /usr/bin/xvfb-run -- ~/bin/xvfb-daemon
52+
echo "Waiting for Xvfb to start..."
53+
while ! grep -q DISPLAY= ${GITHUB_ENV}; do
54+
echo -n .
55+
sleep 3
56+
done
57+
if: runner.os == 'Linux'
58+
- name: Start Screen Recording
4259
run: |
43-
sudo apt install dbus-x11
44-
dbus-launch xvfb-run -a npm test
60+
no_close=#--no-close # uncomment to see ffmpeg output (i.e. leave stdio open)
61+
start-stop-daemon $no_close --start --quiet --pidfile ~/var/run/ffmpeg.pid --make-pidfile --background --exec /usr/bin/ffmpeg -- -f x11grab -video_size cif -framerate 10 -i ${DISPLAY}.0+0,0 $PWD/test.mp4
62+
pid=`cat ~/var/run/ffmpeg.pid`
63+
echo "Waiting for ffmpeg (pid $pid) to start recording (display $DISPLAY)..."
64+
while [ ! -f $PWD/test.mp4 ]; do
65+
echo -n .
66+
sleep 3
67+
done
4568
if: runner.os == 'Linux'
46-
- name: Run tests
69+
# - name: Setup SSH Debugging
70+
# uses: lhotari/action-upterm@v1
71+
# with:
72+
# limit-access-to-actor: true
73+
- name: Run Tests
4774
run: npm test
4875
if: runner.os != 'Linux'
76+
- name: Stop Screen Recording
77+
run: |
78+
start-stop-daemon --stop --pidfile ~/var/run/ffmpeg.pid
79+
if: runner.os == 'Linux'
80+
- name: Archive Screen Recording
81+
uses: actions/upload-artifact@v3
82+
with:
83+
name: test-video
84+
path: |
85+
test.mp4
86+
if: runner.os == 'Linux'
87+
- name: Teardown GUI Environment
88+
run: |
89+
start-stop-daemon --stop --pidfile ~/var/run/Xvfb.pid
90+
kill $DBUS_SESSION_BUS_PID
91+
if: runner.os == 'Linux'
4992
automerge:
5093
name: AutoMerge
5194
needs: ci

0 commit comments

Comments
 (0)