Skip to content

Commit 9a4d156

Browse files
committed
bring the run back in.
1 parent b5b172d commit 9a4d156

File tree

1 file changed

+87
-3
lines changed

1 file changed

+87
-3
lines changed

.github/workflows/CI.yml

+87-3
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,95 @@ jobs:
9191
key: node-modules-${{ hashFiles('package-lock.json') }}
9292
restore-keys: |
9393
node-modules-
94-
- name: Install dependencies
95-
run: npm install
9694
- name: Run tests
9795
env:
9896
CHROME_HEADLESS: 1
9997
CHROME_PATH: chrome
10098
CHROME_FLAGS: "--headless --disable-gpu --no-sandbox --enable-features=SharedArrayBuffer,CrossOriginIsolation"
101-
run: npm test
99+
HEADERS: '{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp","Cross-Origin-Resource-Policy":"cross-origin","Origin-Agent-Cluster":"?1"}'
100+
run: |
101+
# Start test server with proper headers
102+
npm run serve -- --headers "${HEADERS}" &
103+
104+
# Increase wait time to ensure server is ready
105+
sleep 15
106+
107+
# Verify headers and isolation status
108+
echo "Checking security headers and isolation status..."
109+
curl -I http://localhost:3000/tests/ffmpeg-core-st.test.html
110+
111+
# Run verification script first
112+
echo "Verifying browser environment..."
113+
cat << EOF > verify-browser.html
114+
<!DOCTYPE html>
115+
<html>
116+
<head>
117+
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin">
118+
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp">
119+
</head>
120+
<body>
121+
<script>
122+
console.log('SharedArrayBuffer available:', typeof SharedArrayBuffer !== 'undefined');
123+
console.log('crossOriginIsolated:', window.crossOriginIsolated);
124+
if (!window.crossOriginIsolated || typeof SharedArrayBuffer === 'undefined') {
125+
throw new Error('Browser environment not properly configured for SharedArrayBuffer');
126+
}
127+
</script>
128+
</body>
129+
</html>
130+
EOF
131+
132+
# Run single-threaded tests first
133+
echo "Running single-threaded tests..."
134+
npx mocha-headless-chrome \
135+
--args="$CHROME_FLAGS" \
136+
-a no-sandbox \
137+
-f http://localhost:3000/tests/ffmpeg-core-st.test.html 2>&1 | tee st-core-test.log
138+
139+
npx mocha-headless-chrome \
140+
--args="$CHROME_FLAGS" \
141+
-a no-sandbox \
142+
-f http://localhost:3000/tests/ffmpeg-st.test.html 2>&1 | tee st-test.log
143+
144+
# Run multi-threaded tests
145+
echo "Running multi-threaded tests..."
146+
# Create a test script to verify browser environment
147+
cat << EOF > verify-browser.html
148+
<!DOCTYPE html>
149+
<html>
150+
<head>
151+
<title>Browser Environment Test</title>
152+
</head>
153+
<body>
154+
<script>
155+
console.log('SharedArrayBuffer available:', typeof SharedArrayBuffer !== 'undefined');
156+
console.log('crossOriginIsolated:', window.crossOriginIsolated);
157+
</script>
158+
</body>
159+
</html>
160+
EOF
161+
162+
# Run the verification in Chrome
163+
echo "Verifying browser environment..."
164+
npx mocha-headless-chrome \
165+
--args="$CHROME_FLAGS --enable-features=SharedArrayBuffer,CrossOriginIsolation" \
166+
-a no-sandbox \
167+
-f http://localhost:3000/verify-browser.html
168+
169+
# Run MT tests with verified configuration
170+
npx mocha-headless-chrome \
171+
--args="$CHROME_FLAGS --enable-features=SharedArrayBuffer,CrossOriginIsolation" \
172+
-a no-sandbox \
173+
-f http://localhost:3000/tests/ffmpeg-core-mt.test.html 2>&1 | tee mt-core-test.log
174+
175+
npx mocha-headless-chrome \
176+
--args="$CHROME_FLAGS --enable-features=SharedArrayBuffer,CrossOriginIsolation" \
177+
-a no-sandbox \
178+
-f http://localhost:3000/tests/ffmpeg-mt.test.html 2>&1 | tee mt-test.log
179+
180+
# Display all logs for debugging
181+
echo "=== Test Logs ==="
182+
for log in *-test.log; do
183+
echo "Contents of $log:"
184+
cat $log
185+
done

0 commit comments

Comments
 (0)