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