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

Commit 0acd3a9

Browse files
committed
Add tests to CI w/ video recording for easy debug
1 parent 3e03c5b commit 0acd3a9

File tree

1 file changed

+102
-20
lines changed

1 file changed

+102
-20
lines changed

.github/workflows/main.yml

Lines changed: 102 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,116 @@
11
name: Main
22
on:
3-
- push
4-
- pull_request_target
3+
- push
4+
- pull_request_target
55
jobs:
66
ci:
77
name: CI
8-
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
os:
11+
# - macos-latest
12+
- ubuntu-latest
13+
# - windows-latest
14+
ruby:
15+
- 3.1
16+
# - 3.0
17+
# - 2.7
18+
runs-on: ${{ matrix.os }}
919
env:
1020
CI: true
1121
steps:
12-
- uses: actions/checkout@master
13-
- uses: actions/setup-node@v3
14-
with:
15-
node-version: 14.x
16-
cache: yarn
17-
- name: Compile
18-
run: |
19-
yarn install --frozen-lockfile
20-
yarn compile
22+
- uses: actions/checkout@master
23+
- uses: actions/setup-node@v3
24+
with:
25+
node-version: 14.x
26+
cache: yarn
27+
- uses: ruby/setup-ruby@v1
28+
with:
29+
bundler-cache: true
30+
ruby-version: ${{ matrix.ruby }}
31+
- name: Install gem
32+
run: gem install syntax_tree
33+
- name: Compile extension
34+
run: |
35+
yarn install --frozen-lockfile
36+
yarn compile
37+
- name: Setup GUI Environment
38+
run: |
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
56+
if: runner.os == 'Linux'
57+
- name: Start Screen Recording
58+
run: |
59+
mkdir -p $PWD/videos-raw
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 -- -nostdin -f x11grab -video_size 1280x1024 -framerate 10 -i ${DISPLAY}.0+0,0 $PWD/videos-raw/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/videos-raw/test.mp4 ]; do
65+
# echo -n .
66+
# sleep 3
67+
# done
68+
if: runner.os == 'Linux'
69+
- name: Cache VS Code Binary
70+
id: vscode-test
71+
uses: actions/cache@v3
72+
with:
73+
path: .vscode-test/
74+
key: ${{ runner.os }}-vscode-test
75+
# - name: SSH Debug Breakpoint
76+
# uses: lhotari/action-upterm@v1
77+
# with:
78+
# limit-access-to-actor: true
79+
- name: Run Tests
80+
run: npm test
81+
- name: Stop Screen Recording
82+
run: |
83+
start-stop-daemon --stop --pidfile ~/var/run/ffmpeg.pid
84+
sleep 3
85+
mkdir -p $PWD/videos
86+
for f in $PWD/videos-raw/*.mp4; do
87+
out=`basename $f`
88+
ffmpeg -i $f -vf format=yuv420p $PWD/videos/$out
89+
done
90+
if: always() && runner.os == 'Linux'
91+
- name: Archive Screen Recording
92+
uses: actions/upload-artifact@v3
93+
with:
94+
name: videos
95+
path: |
96+
videos/
97+
if: always() && runner.os == 'Linux'
98+
- name: Teardown GUI Environment
99+
run: |
100+
start-stop-daemon --stop --pidfile ~/var/run/Xvfb.pid
101+
kill $DBUS_SESSION_BUS_PID
102+
if: always() && runner.os == 'Linux'
21103
automerge:
22104
name: AutoMerge
23105
needs: ci
24106
runs-on: ubuntu-latest
25107
if: github.event_name == 'pull_request_target' && (github.actor == github.repository_owner || github.actor == 'dependabot[bot]')
26108
steps:
27-
- uses: actions/github-script@v6
28-
with:
29-
script: |
30-
github.pulls.merge({
31-
owner: context.payload.repository.owner.login,
32-
repo: context.payload.repository.name,
33-
pull_number: context.payload.pull_request.number
34-
})
109+
- uses: actions/github-script@v6
110+
with:
111+
script: |
112+
github.pulls.merge({
113+
owner: context.payload.repository.owner.login,
114+
repo: context.payload.repository.name,
115+
pull_number: context.payload.pull_request.number
116+
})

0 commit comments

Comments
 (0)