Skip to content

Commit 53acbf9

Browse files
committed
Provide a working test environment for GHA builds
1 parent 42d0fac commit 53acbf9

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ jobs:
44
build:
55
name: Build & test
66
runs-on: ubuntu-18.04
7+
container: httptoolkit/act-build-base
78
steps:
89
- uses: actions/checkout@v2
910

@@ -24,9 +25,14 @@ jobs:
2425
2526
- run: npm ci
2627

28+
- name: Install test environment
29+
run: |
30+
apt-get update
31+
apt-get install p7zip-full xterm
32+
cp test/chrome-docker-wrapper.sh /usr/local/bin/google-chrome
2733
- run: npm run build
28-
- run: npm run test
29-
- run: npm run test:release
34+
- run: xvfb-run npm run test
35+
- run: xvfb-run npm run test:release
3036

3137
- uses: actions/upload-artifact@v2
3238
with:

test/chrome-docker-wrapper.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
trap : SIGTERM SIGINT
3+
4+
# We need to inject a --no-sandbox option, because inside Docker Chrome cannot start its
5+
# sandbox, and without this it refuses to start at all.
6+
/usr/bin/google-chrome --no-sandbox "$@" &
7+
CHROME_PID=$!
8+
9+
wait $CHROME_PID
10+
11+
WAIT_EXIT_CODE=$?
12+
13+
# If this script gets killed, kill Chrome with the same signal
14+
if [[ WAIT_EXIT_CODE -gt 128 ]]
15+
then
16+
echo kill -$(($WAIT_EXIT_CODE - 128)) $CHROME_PID
17+
kill -$(($WAIT_EXIT_CODE - 128)) $CHROME_PID
18+
fi

0 commit comments

Comments
 (0)