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

Commit 95efeb2

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

File tree

2 files changed

+54
-12
lines changed

2 files changed

+54
-12
lines changed

.github/workflows/main.yml

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,66 @@ 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
4238
run: |
43-
sudo apt install dbus-x11
44-
dbus-launch xvfb-run -a npm test
39+
sudo apt-get install -yq dbus-x11 ffmpeg > /dev/null
40+
mkdir -p ~/bin
41+
mkdir -p ~/var/run
42+
cat <<EOF > ~/bin/xvfb-shim
43+
#! /bin/bash
44+
echo DISPLAY=\$DISPLAY >> ${GITHUB_ENV}
45+
echo XAUTHORITY=\$XAUTHORITY >> ${GITHUB_ENV}
46+
sleep 86400
47+
EOF
48+
chmod a+x ~/bin/xvfb-shim
49+
dbus-launch >> ${GITHUB_ENV}
50+
start-stop-daemon --start --quiet --pidfile ~/var/run/Xvfb.pid --make-pidfile --background --exec /usr/bin/xvfb-run -- ~/bin/xvfb-shim
51+
echo -n "Waiting for Xvfb to start..."
52+
while ! grep -q DISPLAY= ${GITHUB_ENV}; do
53+
echo -n .
54+
sleep 3
55+
done
4556
if: runner.os == 'Linux'
46-
- name: Run tests
57+
- name: Start Screen Recording
58+
run: |
59+
no_close=--no-close # uncomment to see ffmpeg output (i.e. leave stdio open)
60+
start-stop-daemon $no_close --start --quiet --pidfile ~/var/run/ffmpeg.pid --make-pidfile --background --exec /usr/bin/ffmpeg -- -nostdin -f x11grab -video_size 1280x1024 -framerate 10 -i ${DISPLAY}.0+0,0 $PWD/test.mp4
61+
pid=`cat ~/var/run/ffmpeg.pid`
62+
echo "Waiting for ffmpeg (pid $pid) to start recording (display $DISPLAY)..."
63+
while [ ! -f $PWD/test.mp4 ]; do
64+
echo -n .
65+
sleep 3
66+
done
67+
if: runner.os == 'Linux'
68+
# - name: Setup SSH Debugging
69+
# uses: lhotari/action-upterm@v1
70+
# with:
71+
# limit-access-to-actor: true
72+
- name: Run Tests
4773
run: npm test
48-
if: runner.os != 'Linux'
74+
- name: Stop Screen Recording
75+
run: |
76+
start-stop-daemon --stop --pidfile ~/var/run/ffmpeg.pid
77+
sleep 3
78+
if: always() && runner.os == 'Linux'
79+
- name: Archive Screen Recording
80+
uses: actions/upload-artifact@v3
81+
with:
82+
name: test-video
83+
path: |
84+
test.mp4
85+
if: always() && runner.os == 'Linux'
86+
- name: Teardown GUI Environment
87+
run: |
88+
start-stop-daemon --stop --pidfile ~/var/run/Xvfb.pid
89+
kill $DBUS_SESSION_BUS_PID
90+
if: always() && runner.os == 'Linux'
4991
automerge:
5092
name: AutoMerge
5193
needs: ci

src/test/suite/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function run(): Promise<void> {
77
const mocha = new Mocha({
88
asyncOnly: true,
99
color: true,
10-
timeout: 300000, // five minutes (since we can't say "no timeout")
10+
timeout: 60000, // one minute (since we can't say "no timeout")
1111
ui: 'tdd'
1212
});
1313

0 commit comments

Comments
 (0)